summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2015-10-06 20:20:45 +0000
committerPhilip Reames <listmail@philipreames.com>2015-10-06 20:20:45 +0000
commit675418ebc0da35635591ff38964af03505e12269 (patch)
tree6d690b43aefc5904b79a2ea6df4b89b1ab7ac289 /llvm/lib/Analysis/ValueTracking.cpp
parent39eb9de757cfd5dff4eeca4b15e44ec3760261f7 (diff)
downloadbcm5719-llvm-675418ebc0da35635591ff38964af03505e12269.tar.gz
bcm5719-llvm-675418ebc0da35635591ff38964af03505e12269.zip
Extend known bits to understand @llvm.bswap
This is a cleaned up patch from the one written by John Regehr based on the findings of the Souper superoptimizer. When writing tests, I was surprised to find that instsimplify apparently doesn't know how to collapse bit test sequences based purely on known bits. This required me to split my tests across both instsimplify and instcombine. Differential Revision: http://reviews.llvm.org/D13250 llvm-svn: 249453
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index f0b04b7133d..d3723037dda 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1358,6 +1358,12 @@ static void computeKnownBitsFromOperator(Operator *I, APInt &KnownZero,
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
switch (II->getIntrinsicID()) {
default: break;
+ case Intrinsic::bswap:
+ computeKnownBits(I->getOperand(0), KnownZero2, KnownOne2, DL,
+ Depth + 1, Q);
+ KnownZero |= KnownZero2.byteSwap();
+ KnownOne |= KnownOne2.byteSwap();
+ break;
case Intrinsic::ctlz:
case Intrinsic::cttz: {
unsigned LowBits = Log2_32(BitWidth)+1;
OpenPOWER on IntegriCloud