diff options
| author | James Molloy <james.molloy@arm.com> | 2015-09-24 16:06:32 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2015-09-24 16:06:32 +0000 |
| commit | b6be1ebb7d53475c4edd88131efd52a84e1b6b23 (patch) | |
| tree | 768162cdb68ab434730a0473eff68f25e23930c2 /llvm/test/Analysis/ValueTracking/knownzero-shift.ll | |
| parent | bd432b2d04b2aa0a42ec6c222e898baed339980e (diff) | |
| download | bcm5719-llvm-b6be1ebb7d53475c4edd88131efd52a84e1b6b23.tar.gz bcm5719-llvm-b6be1ebb7d53475c4edd88131efd52a84e1b6b23.zip | |
[ValueTracking] Teach isKnownNonZero a new trick
If the shifter operand is a constant, and all of the bits shifted out
are known to be zero, then if X is known non-zero at least one
non-zero bit must remain.
llvm-svn: 248508
Diffstat (limited to 'llvm/test/Analysis/ValueTracking/knownzero-shift.ll')
| -rw-r--r-- | llvm/test/Analysis/ValueTracking/knownzero-shift.ll | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ValueTracking/knownzero-shift.ll b/llvm/test/Analysis/ValueTracking/knownzero-shift.ll new file mode 100644 index 00000000000..835d87a9d9c --- /dev/null +++ b/llvm/test/Analysis/ValueTracking/knownzero-shift.ll @@ -0,0 +1,14 @@ +; RUN: opt -instsimplify -S < %s | FileCheck %s + +; CHECK-LABEL: @test +define i1 @test(i8 %p, i8* %pq) { + %q = load i8, i8* %pq, !range !0 ; %q is known nonzero; no known bits + %1 = or i8 %p, 2 ; %1[1] = 1 + %2 = and i8 %1, 254 ; %2[0] = 0, %2[1] = 1 + %A = lshr i8 %2, 1 ; We should know that %A is nonzero. + %x = icmp eq i8 %A, 0 + ; CHECK: ret i1 false + ret i1 %x +} + +!0 = !{ i8 1, i8 5 } |

