xref: /aosp_15_r20/external/llvm/test/Transforms/Util/flattencfg.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -flattencfg -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; This test checks whether the pass completes without a crash.
5*9880d681SAndroid Build Coastguard Worker; The code is not transformed in any way
6*9880d681SAndroid Build Coastguard Worker;
7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @test_not_crash
8*9880d681SAndroid Build Coastguard Workerdefine void @test_not_crash(i32 %in_a) #0 {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker  %cmp0 = icmp eq i32 %in_a, -1
11*9880d681SAndroid Build Coastguard Worker  %cmp1 = icmp ne i32 %in_a, 0
12*9880d681SAndroid Build Coastguard Worker  %cond0 = and i1 %cmp0, %cmp1
13*9880d681SAndroid Build Coastguard Worker  br i1 %cond0, label %b0, label %b1
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerb0:                                ; preds = %entry
16*9880d681SAndroid Build Coastguard Worker  %cmp2 = icmp eq i32 %in_a, 0
17*9880d681SAndroid Build Coastguard Worker  %cmp3 = icmp ne i32 %in_a, 1
18*9880d681SAndroid Build Coastguard Worker  %cond1 = or i1 %cmp2, %cmp3
19*9880d681SAndroid Build Coastguard Worker  br i1 %cond1, label %exit, label %b1
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerb1:                                       ; preds = %entry, %b0
22*9880d681SAndroid Build Coastguard Worker  br label %exit
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerexit:                               ; preds = %entry, %b0, %b1
25*9880d681SAndroid Build Coastguard Worker  ret void
26*9880d681SAndroid Build Coastguard Worker}
27