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
6 define i32 @phi_cond_branch_eliminated() {
7 ; CHECK-LABEL: @phi_cond_branch_eliminated(
9 ; CHECK-NEXT: ret i32 20
12 br i1 true, label %bb.2, label %bb.3
18 %ret = phi i32 [ 10, %entry ], [ 20, %bb.2 ]
22 define i32 @phi_removed() {
23 ; CHECK-LABEL: @phi_removed(
25 ; CHECK-NEXT: br label [[BB_3:%.*]]
27 ; CHECK-NEXT: ret i32 0
30 br i1 false, label %bb.2, label %bb.3
33 %pv = phi i32 [ 10, %entry ]
40 define i32 @phi_in_dead_region() {
41 ; CHECK-LABEL: @phi_in_dead_region(
43 ; CHECK-NEXT: ret i32 1
49 br i1 true, label %bb.2, label %bb.3
55 %ret = phi i32 [ 10, %bb.1 ], [ 20, %bb.2 ]
59 define i32 @phi_in_mergable_blocks() {
60 ; CHECK-LABEL: @phi_in_mergable_blocks(
62 ; CHECK-NEXT: ret i32 10
68 %pv = phi i32 [ 10, %entry ]