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 @remove_dead_blocks() {
7 ; CHECK-LABEL: @remove_dead_blocks(
9 ; CHECK-NEXT: ret i32 1
22 ; CHECK-LABEL: @simp1(
24 ; CHECK-NEXT: ret i32 1
26 ; CHECK-NEXT: ret i32 2
35 br i1 undef, label %bb.1, label %bb.3
41 define i32 @remove_dead_block_with_phi() {
42 ; CHECK-LABEL: @remove_dead_block_with_phi(
44 ; CHECK-NEXT: br label [[BB_2:%.*]]
46 ; CHECK-NEXT: ret i32 1
55 %rv = phi i32 [ 1, %entry ], [ 2, %bb.1 ]
59 define i32 @remove_dead_blocks_remaining_uses(i32 %a) {
60 ; CHECK-LABEL: @remove_dead_blocks_remaining_uses(
62 ; CHECK-NEXT: ret i32 1
75 define i32 @remove_dead_blocks_remaining_uses2(i32 %a, i1 %cond) {
76 ; CHECK-LABEL: @remove_dead_blocks_remaining_uses2(
78 ; CHECK-NEXT: ret i32 1
80 ; CHECK-NEXT: [[RES2:%.*]] = add i32 poison, 10
81 ; CHECK-NEXT: [[RES3:%.*]] = mul i32 [[RES2]], poison
82 ; CHECK-NEXT: ret i32 [[RES3]]
84 ; CHECK-NEXT: ret i32 poison
90 %res2 = add i32 %res, 10
91 %res3 = mul i32 %res2, %res
101 %res = add i32 %a, 10
102 br i1 %cond, label %bb.2, label %bb.3