From 26c8dcc692fb2addd475446cfff24d6a4e958bca Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 4 Apr 2012 12:51:34 +0000 Subject: Always compute all the bits in ComputeMaskedBits. This allows us to keep passing reduced masks to SimplifyDemandedBits, but know about all the bits if SimplifyDemandedBits fails. This allows instcombine to simplify cases like the one in the included testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154011 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/pr12251.ll | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/Transforms/InstCombine/pr12251.ll (limited to 'test/Transforms') diff --git a/test/Transforms/InstCombine/pr12251.ll b/test/Transforms/InstCombine/pr12251.ll new file mode 100644 index 0000000000..74a41eb7d2 --- /dev/null +++ b/test/Transforms/InstCombine/pr12251.ll @@ -0,0 +1,15 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +define zeroext i1 @_Z3fooPb(i8* nocapture %x) { +entry: + %a = load i8* %x, align 1, !range !0 + %b = and i8 %a, 1 + %tobool = icmp ne i8 %b, 0 + ret i1 %tobool +} + +; CHECK: %a = load i8* %x, align 1, !range !0 +; CHECK-NEXT: %tobool = icmp ne i8 %a, 0 +; CHECK-NEXT: ret i1 %tobool + +!0 = metadata !{i8 0, i8 2} -- cgit v1.2.3-70-g09d2