blob: 5f8456ba40541e09d266aa5eea07bf3c6750caa3 [file] [log] [blame]
Tom Stellarde1631dd2013-10-21 20:07:30 +00001; RUN: opt < %s -simplifycfg -S | FileCheck %s
2
3; This test checks that the SimplifyCFG pass won't duplicate a call to a
4; function marked noduplicate.
5;
6; CHECK-LABEL: @noduplicate
7; CHECK: call void @barrier
8; CHECK-NOT: call void @barrier
9define void @noduplicate(i32 %cond, i32* %out) {
10entry:
David Blaikie79e6c742015-02-27 19:29:02 +000011 %out1 = getelementptr i32, i32* %out, i32 1
12 %out2 = getelementptr i32, i32* %out, i32 2
Tom Stellarde1631dd2013-10-21 20:07:30 +000013 %cmp = icmp eq i32 %cond, 0
14 br i1 %cmp, label %if.then, label %if.end
15
16if.then:
17 store i32 5, i32* %out
18 br label %if.end
19
20if.end:
21 call void @barrier() #0
22 br i1 %cmp, label %cond.end, label %cond.false
23
24cond.false:
25 store i32 5, i32* %out1
26 br label %cond.end
27
28cond.end:
29 %value = phi i32 [ 1, %cond.false ], [ 0, %if.end ]
30 store i32 %value, i32* %out2
31 ret void
32}
33
34; Function Attrs: noduplicate nounwind
35declare void @barrier() #0
36
37attributes #0 = { noduplicate nounwind }