1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt %loadexampleirtransforms -passes=tut-simplifycfg -tut-simplifycfg-version=v1 -S < %s | FileCheck %s
3 ; RUN: opt %loadexampleirtransforms -passes=tut-simplifycfg -tut-simplifycfg-version=v2 -S < %s | FileCheck %s
4 ; RUN: opt %loadexampleirtransforms -passes=tut-simplifycfg -tut-simplifycfg-version=v3 -S < %s | FileCheck %s
9 ; CHECK-NEXT: ret i32 10
12 br i1 true, label %if.then, label %if.else
22 ; CHECK-LABEL: @simp2(
24 ; CHECK-NEXT: ret i32 200
27 br i1 false, label %if.then, label %if.else
36 declare void @foo(i64)
38 define i64 @merge_into_predecessor(i64 %a, i64 %b) {
39 ; CHECK-LABEL: @merge_into_predecessor(
41 ; CHECK-NEXT: [[R:%.*]] = add i64 [[A:%.*]], [[B:%.*]]
42 ; CHECK-NEXT: call void @foo(i64 [[R]])
43 ; CHECK-NEXT: call void @foo(i64 [[A]])
44 ; CHECK-NEXT: ret i64 [[R]]
51 call void @foo(i64 %r)
52 call void @foo(i64 %a)
53 br label %bb.next.next
59 define i64 @merge_into_predecessor_with_phi(i64 %a, i64 %b, i1 %c) {
60 ; CHECK-LABEL: @merge_into_predecessor_with_phi(
62 ; CHECK-NEXT: call void @foo(i64 [[B:%.*]])
63 ; CHECK-NEXT: [[R:%.*]] = add i64 [[A:%.*]], [[B]]
64 ; CHECK-NEXT: call void @foo(i64 [[R]])
65 ; CHECK-NEXT: call void @foo(i64 [[A]])
66 ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB_NEXT_NEXT:%.*]], label [[BB_EXIT:%.*]]
67 ; CHECK: bb.next.next:
68 ; CHECK-NEXT: br label [[BB_EXIT]]
70 ; CHECK-NEXT: [[RET:%.*]] = phi i64 [ [[R]], [[ENTRY:%.*]] ], [ 10, [[BB_NEXT_NEXT]] ]
71 ; CHECK-NEXT: ret i64 [[RET]]
74 call void @foo(i64 %b)
79 call void @foo(i64 %r)
80 call void @foo(i64 %a)
81 br i1 %c, label %bb.next.next, label %bb.exit
87 %ret = phi i64 [ %r, %bb.next], [ 10, %bb.next.next]