[llvm] r282337 - Analysis: Return early for UndefValue in computeKnownBits
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 24 13:42:03 PDT 2016
Author: dexonsmith
Date: Sat Sep 24 15:42:02 2016
New Revision: 282337
URL: http://llvm.org/viewvc/llvm-project?rev=282337&view=rev
Log:
Analysis: Return early for UndefValue in computeKnownBits
There is no benefit in looking through assumptions on UndefValue to
guess known bits. Return early to avoid walking their use-lists, and
assert that all instances of ConstantData are handled here for similar
reasons (UndefValue was the only integer/pointer holdout).
Modified:
llvm/trunk/lib/Analysis/ValueTracking.cpp
Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=282337&r1=282336&r2=282337&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Sat Sep 24 15:42:02 2016
@@ -1502,6 +1502,14 @@ void computeKnownBits(const Value *V, AP
// Start out not knowing anything.
KnownZero.clearAllBits(); KnownOne.clearAllBits();
+ // We can't imply anything about undefs.
+ if (isa<UndefValue>(V))
+ return;
+
+ // There's no point in looking through other users of ConstantData for
+ // assumptions. Confirm that we've handled them all.
+ assert(!isa<ConstantData>(V) && "Unhandled constant data!");
+
// Limit search depth.
// All recursive calls that increase depth must come after this.
if (Depth == MaxDepth)
More information about the llvm-commits
mailing list