xref: /aosp_15_r20/external/llvm/test/Transforms/SimplifyCFG/branch-fold-test.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; This test ensures that the simplifycfg pass continues to constant fold
2*9880d681SAndroid Build Coastguard Worker; terminator instructions.
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -simplifycfg -S | not grep br
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine i32 @test(i32 %A, i32 %B) {
7*9880d681SAndroid Build Coastguard WorkerJ:
8*9880d681SAndroid Build Coastguard Worker        %C = add i32 %A, 12             ; <i32> [#uses=2]
9*9880d681SAndroid Build Coastguard Worker        br i1 true, label %L, label %K
10*9880d681SAndroid Build Coastguard WorkerL:              ; preds = %J
11*9880d681SAndroid Build Coastguard Worker        %D = add i32 %C, %B             ; <i32> [#uses=1]
12*9880d681SAndroid Build Coastguard Worker        ret i32 %D
13*9880d681SAndroid Build Coastguard WorkerK:              ; preds = %J
14*9880d681SAndroid Build Coastguard Worker        %E = add i32 %C, %B             ; <i32> [#uses=1]
15*9880d681SAndroid Build Coastguard Worker        ret i32 %E
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18