blob: dfe122abbf9463efed1a84ce480578b798ec5cbb [file] [log] [blame]
Tanya Lattnerf04d8d12008-03-18 03:45:45 +00001; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
Reid Spencer9aafdcf2007-04-15 09:21:47 +00002; RUN: not grep select
Chris Lattner1c7efba2004-10-14 05:12:50 +00003
4;; The PHI node in this example should not be turned into a select, as we are
5;; not able to ifcvt the entire block. As such, converting to a select just
6;; introduces inefficiency without saving copies.
7
Tanya Lattnerf04d8d12008-03-18 03:45:45 +00008define i32 @bar(i1 %C) {
Chris Lattner1c7efba2004-10-14 05:12:50 +00009entry:
Tanya Lattnerf04d8d12008-03-18 03:45:45 +000010 br i1 %C, label %then, label %endif
11then: ; preds = %entry
12 %tmp.3 = call i32 @qux( ) ; <i32> [#uses=0]
Chris Lattner1c7efba2004-10-14 05:12:50 +000013 br label %endif
Tanya Lattnerf04d8d12008-03-18 03:45:45 +000014endif: ; preds = %then, %entry
15 %R = phi i32 [ 123, %entry ], [ 12312, %then ] ; <i32> [#uses=1]
16 ;; stuff to disable tail duplication
17 call i32 @qux( ) ; <i32>:0 [#uses=0]
18 call i32 @qux( ) ; <i32>:1 [#uses=0]
19 call i32 @qux( ) ; <i32>:2 [#uses=0]
20 call i32 @qux( ) ; <i32>:3 [#uses=0]
21 call i32 @qux( ) ; <i32>:4 [#uses=0]
22 call i32 @qux( ) ; <i32>:5 [#uses=0]
23 call i32 @qux( ) ; <i32>:6 [#uses=0]
24 ret i32 %R
Chris Lattner1c7efba2004-10-14 05:12:50 +000025}
26
Tanya Lattnerf04d8d12008-03-18 03:45:45 +000027declare i32 @qux()