xref: /llvm-project/llvm/test/Transforms/LowerWidenableCondition/basic.ll (revision 230b4e49ea874f4372dae85c17116c36b864a415)
1cee313d2SEric Christopher; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2*230b4e49SRoman Lebedev; RUN: opt -S -passes=lower-widenable-condition < %s        | FileCheck %s
3cee313d2SEric Christopher; RUN: opt -S -passes=lower-widenable-condition < %s | FileCheck %s
4cee313d2SEric Christopher
5cee313d2SEric Christopher; Basic test case: make sure that all widenable conditions turn into i1 true.
6cee313d2SEric Christopherdefine void @f_0(i1 %cond_0, i1 %cond_1) {
7cee313d2SEric Christopher; CHECK-LABEL: @f_0(
8cee313d2SEric Christopher; CHECK-NEXT:  entry:
9cee313d2SEric Christopher; CHECK-NEXT:    [[EXIPLICIT_GUARD_COND:%.*]] = and i1 [[COND_0:%.*]], true
10cee313d2SEric Christopher; CHECK-NEXT:    br i1 [[EXIPLICIT_GUARD_COND]], label [[GUARDED:%.*]], label [[DEOPT:%.*]]
11cee313d2SEric Christopher; CHECK:       deopt:
12cee313d2SEric Christopher; CHECK-NEXT:    unreachable
13cee313d2SEric Christopher; CHECK:       guarded:
14cee313d2SEric Christopher; CHECK-NEXT:    [[EXIPLICIT_GUARD_COND4:%.*]] = and i1 [[COND_1:%.*]], true
15cee313d2SEric Christopher; CHECK-NEXT:    br i1 [[EXIPLICIT_GUARD_COND4]], label [[GUARDED1:%.*]], label [[DEOPT2:%.*]]
16cee313d2SEric Christopher; CHECK:       deopt2:
17cee313d2SEric Christopher; CHECK-NEXT:    unreachable
18cee313d2SEric Christopher; CHECK:       guarded1:
19cee313d2SEric Christopher; CHECK-NEXT:    ret void
20cee313d2SEric Christopher;
21cee313d2SEric Christopherentry:
22cee313d2SEric Christopher  %widenable_cond = call i1 @llvm.experimental.widenable.condition()
23cee313d2SEric Christopher  %exiplicit_guard_cond = and i1 %cond_0, %widenable_cond
24cee313d2SEric Christopher  br i1 %exiplicit_guard_cond, label %guarded, label %deopt
25cee313d2SEric Christopher
26cee313d2SEric Christopherdeopt:                                            ; preds = %entry
27cee313d2SEric Christopher  unreachable
28cee313d2SEric Christopher
29cee313d2SEric Christopherguarded:                                          ; preds = %entry
30cee313d2SEric Christopher  %widenable_cond3 = call i1 @llvm.experimental.widenable.condition()
31cee313d2SEric Christopher  %exiplicit_guard_cond4 = and i1 %cond_1, %widenable_cond3
32cee313d2SEric Christopher  br i1 %exiplicit_guard_cond4, label %guarded1, label %deopt2
33cee313d2SEric Christopher
34cee313d2SEric Christopherdeopt2:                                           ; preds = %guarded
35cee313d2SEric Christopher  unreachable
36cee313d2SEric Christopher
37cee313d2SEric Christopherguarded1:                                         ; preds = %guarded
38cee313d2SEric Christopher  ret void
39cee313d2SEric Christopher}
40cee313d2SEric Christopher
41cee313d2SEric Christopher; Function Attrs: inaccessiblememonly nounwind
42cee313d2SEric Christopherdeclare i1 @llvm.experimental.widenable.condition() #0
43cee313d2SEric Christopher
44cee313d2SEric Christopherattributes #0 = { inaccessiblememonly nounwind }
45