diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-09-24 20:42:02 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-09-24 20:42:02 +0000 |
commit | b1b208a1f514ccb90b5afba0af49d6aa39dee21b (patch) | |
tree | 9e963dc53906d98aca9f536f1528959bfcce07db | |
parent | 752ad8fde7160c51f21cfcf92d84c7f534259051 (diff) | |
download | bcm5719-llvm-b1b208a1f514ccb90b5afba0af49d6aa39dee21b.tar.gz bcm5719-llvm-b1b208a1f514ccb90b5afba0af49d6aa39dee21b.zip |
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).
llvm-svn: 282337
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 827e2524915..7983240c3dd 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1502,6 +1502,14 @@ void computeKnownBits(const Value *V, APInt &KnownZero, APInt &KnownOne, // 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) |