1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s
4 declare void @unknown_fun()
6 define void @different_type(ptr %ptr, i1 %cmp) {
7 ; CHECK-LABEL: @different_type(
8 ; CHECK-NEXT: store i32 0, ptr [[PTR:%.*]], align 4
9 ; CHECK-NEXT: br i1 [[CMP:%.*]], label [[IF_THEN:%.*]], label [[RET_END:%.*]]
11 ; CHECK-NEXT: store i64 1, ptr [[PTR]], align 4
12 ; CHECK-NEXT: br label [[RET_END]]
14 ; CHECK-NEXT: ret void
17 br i1 %cmp, label %if.then, label %ret.end
27 define void @readonly_call(ptr %ptr, i1 %cmp) {
28 ; CHECK-LABEL: @readonly_call(
29 ; CHECK-NEXT: ret.end:
30 ; CHECK-NEXT: store i32 0, ptr [[PTR:%.*]], align 4
31 ; CHECK-NEXT: call void @unknown_fun() #[[ATTR0:[0-9]+]]
32 ; CHECK-NEXT: [[SPEC_STORE_SELECT:%.*]] = select i1 [[CMP:%.*]], i32 1, i32 0
33 ; CHECK-NEXT: store i32 [[SPEC_STORE_SELECT]], ptr [[PTR]], align 4
34 ; CHECK-NEXT: ret void
37 call void @unknown_fun() readonly
38 br i1 %cmp, label %if.then, label %ret.end
48 define void @atomic_and_simple(ptr %ptr, i1 %cmp) {
49 ; CHECK-LABEL: @atomic_and_simple(
50 ; CHECK-NEXT: store atomic i32 0, ptr [[PTR:%.*]] seq_cst, align 4
51 ; CHECK-NEXT: br i1 [[CMP:%.*]], label [[IF_THEN:%.*]], label [[RET_END:%.*]]
53 ; CHECK-NEXT: store i32 1, ptr [[PTR]], align 4
54 ; CHECK-NEXT: br label [[RET_END]]
56 ; CHECK-NEXT: ret void
58 store atomic i32 0, ptr %ptr seq_cst, align 4
59 br i1 %cmp, label %if.then, label %ret.end