[PATCH] D12706: Handle non-constant shifts in computeKnownBits, and use computeKnownBits for constant folding in InstCombine/Simplify
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 04:16:25 PDT 2015
jmolloy added a subscriber: jmolloy.
================
Comment at: lib/Analysis/ValueTracking.cpp:983
@@ +982,3 @@
+ if (!(ShiftAmtKZ & (BitWidth-1)) && !(ShiftAmtKO & (BitWidth-1)))
+ return;
+
----------------
It seems we could do slightly better here; If the shifter operand is known to be nonzero, we know that we're shifting by at least 1:
if (isKnownNonZero(I->getOperand(0), DL, Depth + 1, Q)) {
KnownZero = KZF(KnownZero, 1);
KnownOne = KOF(KnownOne, 1);
}
I have a similar patch that I was just about to send upstream, but obviously it conflicts with yours and yours handles many more cases.
Would you be able to put this test in too or should I wait until you've committed this and add it myself?
Repository:
rL LLVM
http://reviews.llvm.org/D12706
More information about the llvm-commits
mailing list