1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
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.
8 define i32 @bar(i1 %C) {
11 ; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ENDIF:%.*]]
13 ; CHECK-NEXT: [[TMP_3:%.*]] = call i32 @qux()
14 ; CHECK-NEXT: br label [[ENDIF]]
16 ; CHECK-NEXT: [[R:%.*]] = phi i32 [ 123, [[ENTRY:%.*]] ], [ 12312, [[THEN]] ]
17 ; CHECK-NEXT: [[TMP0:%.*]] = call i32 @qux()
18 ; CHECK-NEXT: [[TMP1:%.*]] = call i32 @qux()
19 ; CHECK-NEXT: [[TMP2:%.*]] = call i32 @qux()
20 ; CHECK-NEXT: [[TMP3:%.*]] = call i32 @qux()
21 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @qux()
22 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 @qux()
23 ; CHECK-NEXT: [[TMP6:%.*]] = call i32 @qux()
24 ; CHECK-NEXT: ret i32 [[R]]
27 br i1 %C, label %then, label %endif
28 then: ; preds = %entry
29 %tmp.3 = call i32 @qux( ) ; <i32> [#uses=0]
31 endif: ; preds = %then, %entry
32 %R = phi i32 [ 123, %entry ], [ 12312, %then ] ; <i32> [#uses=1]
33 ;; stuff to disable tail duplication
34 call i32 @qux( ) ; <i32>:0 [#uses=0]
35 call i32 @qux( ) ; <i32>:1 [#uses=0]
36 call i32 @qux( ) ; <i32>:2 [#uses=0]
37 call i32 @qux( ) ; <i32>:3 [#uses=0]
38 call i32 @qux( ) ; <i32>:4 [#uses=0]
39 call i32 @qux( ) ; <i32>:5 [#uses=0]
40 call i32 @qux( ) ; <i32>:6 [#uses=0]