Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | ; RUN: opt -S -lower-widenable-condition < %s | FileCheck %s |
| 3 | ; RUN: opt -S -passes=lower-widenable-condition < %s | FileCheck %s |
| 4 | |
| 5 | ; Basic test case: make sure that all widenable conditions turn into i1 true. |
| 6 | define void @f_0(i1 %cond_0, i1 %cond_1) { |
| 7 | ; CHECK-LABEL: @f_0( |
| 8 | ; CHECK-NEXT: entry: |
| 9 | ; CHECK-NEXT: [[EXIPLICIT_GUARD_COND:%.*]] = and i1 [[COND_0:%.*]], true |
| 10 | ; CHECK-NEXT: br i1 [[EXIPLICIT_GUARD_COND]], label [[GUARDED:%.*]], label [[DEOPT:%.*]] |
| 11 | ; CHECK: deopt: |
| 12 | ; CHECK-NEXT: unreachable |
| 13 | ; CHECK: guarded: |
| 14 | ; CHECK-NEXT: [[EXIPLICIT_GUARD_COND4:%.*]] = and i1 [[COND_1:%.*]], true |
| 15 | ; CHECK-NEXT: br i1 [[EXIPLICIT_GUARD_COND4]], label [[GUARDED1:%.*]], label [[DEOPT2:%.*]] |
| 16 | ; CHECK: deopt2: |
| 17 | ; CHECK-NEXT: unreachable |
| 18 | ; CHECK: guarded1: |
| 19 | ; CHECK-NEXT: ret void |
| 20 | ; |
| 21 | entry: |
| 22 | %widenable_cond = call i1 @llvm.experimental.widenable.condition() |
| 23 | %exiplicit_guard_cond = and i1 %cond_0, %widenable_cond |
| 24 | br i1 %exiplicit_guard_cond, label %guarded, label %deopt |
| 25 | |
| 26 | deopt: ; preds = %entry |
| 27 | unreachable |
| 28 | |
| 29 | guarded: ; preds = %entry |
| 30 | %widenable_cond3 = call i1 @llvm.experimental.widenable.condition() |
| 31 | %exiplicit_guard_cond4 = and i1 %cond_1, %widenable_cond3 |
| 32 | br i1 %exiplicit_guard_cond4, label %guarded1, label %deopt2 |
| 33 | |
| 34 | deopt2: ; preds = %guarded |
| 35 | unreachable |
| 36 | |
| 37 | guarded1: ; preds = %guarded |
| 38 | ret void |
| 39 | } |
| 40 | |
| 41 | ; Function Attrs: inaccessiblememonly nounwind |
| 42 | declare i1 @llvm.experimental.widenable.condition() #0 |
| 43 | |
| 44 | attributes #0 = { inaccessiblememonly nounwind } |