1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -structurizecfg %s | FileCheck %s
4 define void @invert_condition(i1 %arg) {
5 ; CHECK-LABEL: @invert_condition(
7 ; CHECK-NEXT: [[TMP:%.*]] = load volatile float, ptr addrspace(1) undef
8 ; CHECK-NEXT: [[TMP1:%.*]] = load volatile float, ptr addrspace(1) undef
9 ; CHECK-NEXT: br label [[BB2:%.*]]
11 ; CHECK-NEXT: [[TMP3:%.*]] = fcmp oge float [[TMP]], [[TMP1]]
12 ; CHECK-NEXT: [[TMP4:%.*]] = xor i1 [[ARG:%.*]], [[TMP3]]
13 ; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[TMP4]], true
14 ; CHECK-NEXT: br i1 [[TMP0]], label [[BB5:%.*]], label [[BB2]]
16 ; CHECK-NEXT: ret void
19 %tmp = load volatile float, ptr addrspace(1) undef
20 %tmp1 = load volatile float, ptr addrspace(1) undef
23 bb2: ; preds = %bb2, %bb
24 %tmp3 = fcmp oge float %tmp, %tmp1
25 %tmp4 = xor i1 %arg, %tmp3
26 br i1 %tmp4, label %bb2, label %bb5
32 define void @invert_condition_phi(i32 %arg) {
33 ; CHECK-LABEL: @invert_condition_phi(
34 ; CHECK-NEXT: main_body:
35 ; CHECK-NEXT: [[I5:%.*]] = icmp eq i32 [[ARG:%.*]], 0
36 ; CHECK-NEXT: [[I5_INV:%.*]] = xor i1 [[I5]], true
37 ; CHECK-NEXT: br i1 [[I5_INV]], label [[IF1:%.*]], label [[ENDIF1:%.*]]
39 ; CHECK-NEXT: br label [[ENDIF1]]
41 ; CHECK-NEXT: [[I7:%.*]] = phi i1 [ [[I5]], [[MAIN_BODY:%.*]] ], [ false, [[IF1]] ]
42 ; CHECK-NEXT: [[I7_INV:%.*]] = xor i1 [[I7]], true
43 ; CHECK-NEXT: br i1 [[I7_INV]], label [[IF4:%.*]], label [[ENDIF4:%.*]]
45 ; CHECK-NEXT: br label [[ENDIF4]]
47 ; CHECK-NEXT: ret void
50 %i5 = icmp eq i32 %arg, 0
51 br i1 %i5, label %endif1, label %if1
57 %i7 = phi i1 [ false, %if1 ], [ %i5, %main_body ]
58 br i1 %i7, label %endif4, label %if4