1475ddca5SAlexandros Lamprineas; RUN: opt -passes="ipsccp<func-spec>" -force-specialization -S < %s | FileCheck %s
22556f581SChuanqi Xu
3*e15d72adSAlexandros Lamprineas; CHECK-NOT: foo.specialized.{{[0-9]+}}
42556f581SChuanqi Xu
52556f581SChuanqi Xutarget datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
62556f581SChuanqi Xu
72556f581SChuanqi Xu@A = external dso_local constant i32, align 4
82556f581SChuanqi Xu@B = external dso_local constant i32, align 4
92556f581SChuanqi Xu@C = external dso_local constant i32, align 4
102556f581SChuanqi Xu@D = external dso_local constant i32, align 4
112556f581SChuanqi Xu
122556f581SChuanqi Xudeclare i1 @cond_begin()
132556f581SChuanqi Xudeclare i1 @cond_end()
142556f581SChuanqi Xudeclare i1 @getCond()
152556f581SChuanqi Xu
16ebdf5aefSMatt Arsenaultdefine internal i32 @foo(i32 %x, ptr %b, ptr %c) alwaysinline {
172556f581SChuanqi Xuentry:
182556f581SChuanqi Xu  br label %loop.entry
192556f581SChuanqi Xu
202556f581SChuanqi Xuloop.entry:
212556f581SChuanqi Xu  br label %loop2.entry
222556f581SChuanqi Xu
232556f581SChuanqi Xuloop2.entry:
242556f581SChuanqi Xu  br label %loop2.body
252556f581SChuanqi Xu
262556f581SChuanqi Xuloop2.body:
27ebdf5aefSMatt Arsenault  %0 = load i32, ptr %b, align 4
28ebdf5aefSMatt Arsenault  %1 = load i32, ptr %c, align 4
292556f581SChuanqi Xu  %add.0 = add nsw i32 %0, %1
302556f581SChuanqi Xu  %add = add nsw i32 %add.0, %x
312556f581SChuanqi Xu  br label %loop2.end
322556f581SChuanqi Xu
332556f581SChuanqi Xuloop2.end:
342556f581SChuanqi Xu  %cond.end = call i1 @cond_end()
352556f581SChuanqi Xu  br i1 %cond.end, label %loop2.entry, label %loop.end
362556f581SChuanqi Xu
372556f581SChuanqi Xuloop.end:
382556f581SChuanqi Xu  %cond2.end = call i1 @getCond()
392556f581SChuanqi Xu  br i1 %cond2.end, label %loop.entry, label %return
402556f581SChuanqi Xu
412556f581SChuanqi Xureturn:
422556f581SChuanqi Xu  ret i32 %add
432556f581SChuanqi Xu}
442556f581SChuanqi Xu
452556f581SChuanqi Xudefine dso_local i32 @bar(i32 %x, i32 %y) {
462556f581SChuanqi Xuentry:
472556f581SChuanqi Xu  %tobool = icmp ne i32 %x, 0
482556f581SChuanqi Xu  br i1 %tobool, label %if.then, label %if.else
492556f581SChuanqi Xu
502556f581SChuanqi Xuif.then:
51ebdf5aefSMatt Arsenault  %call = call i32 @foo(i32 %x, ptr @A, ptr @C)
522556f581SChuanqi Xu  br label %return
532556f581SChuanqi Xu
542556f581SChuanqi Xuif.else:
55ebdf5aefSMatt Arsenault  %call1 = call i32 @foo(i32 %y, ptr @B, ptr @D)
562556f581SChuanqi Xu  br label %return
572556f581SChuanqi Xu
582556f581SChuanqi Xureturn:
592556f581SChuanqi Xu  %retval.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ]
602556f581SChuanqi Xu  ret i32 %retval.0
612556f581SChuanqi Xu}
62