diff options
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/narrow.ll | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/llvm/test/Transforms/InstCombine/narrow.ll b/llvm/test/Transforms/InstCombine/narrow.ll index 5dd13a09662..7416568f586 100644 --- a/llvm/test/Transforms/InstCombine/narrow.ll +++ b/llvm/test/Transforms/InstCombine/narrow.ll @@ -1,18 +1,19 @@ -; This file contains various testcases that check to see that instcombine -; is narrowing computations when possible. -; RUN: opt < %s -instcombine -S | \ -; RUN: grep "ret i1 false" +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instcombine -S | FileCheck %s + +; Eliminating the casts in this testcase (by narrowing the AND operation) +; allows instcombine to realize the function always returns false. -; test1 - Eliminating the casts in this testcase (by narrowing the AND -; operation) allows instcombine to realize the function always returns false. -; define i1 @test1(i32 %A, i32 %B) { - %C1 = icmp slt i32 %A, %B ; <i1> [#uses=1] - %ELIM1 = zext i1 %C1 to i32 ; <i32> [#uses=1] - %C2 = icmp sgt i32 %A, %B ; <i1> [#uses=1] - %ELIM2 = zext i1 %C2 to i32 ; <i32> [#uses=1] - %C3 = and i32 %ELIM1, %ELIM2 ; <i32> [#uses=1] - %ELIM3 = trunc i32 %C3 to i1 ; <i1> [#uses=1] - ret i1 %ELIM3 +; CHECK-LABEL: @test1( +; CHECK-NEXT: ret i1 false +; + %C1 = icmp slt i32 %A, %B + %ELIM1 = zext i1 %C1 to i32 + %C2 = icmp sgt i32 %A, %B + %ELIM2 = zext i1 %C2 to i32 + %C3 = and i32 %ELIM1, %ELIM2 + %ELIM3 = trunc i32 %C3 to i1 + ret i1 %ELIM3 } |

