summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-01-03 02:33:25 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-01-03 02:33:25 +0000
commit8df46c92897a8e1ac7925ab5f26d1b47a393a4d6 (patch)
tree13b425fde48e02e794a8e1dd21d210646e444ac2 /llvm/lib/Analysis
parent0f53d9a2ee556992aaa822fb21da66ca41539ffb (diff)
downloadbcm5719-llvm-8df46c92897a8e1ac7925ab5f26d1b47a393a4d6.tar.gz
bcm5719-llvm-8df46c92897a8e1ac7925ab5f26d1b47a393a4d6.zip
ValueTracking: Make computeKnownBits for Arguments a little more clear
We would sometimes leave the out-param APInts untouched while going through computeKnownBits. While I don't know of a way to trigger a bug involving this in practice, it goes against the overall design of computeKnownBits. Found via code inspection. llvm-svn: 225109
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 3a0efa76b2f..6fdf4afebc2 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -831,6 +831,9 @@ void computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne,
if (Align)
KnownZero = APInt::getLowBitsSet(BitWidth, countTrailingZeros(Align));
+ else
+ KnownZero.clearAllBits();
+ KnownOne.clearAllBits();
// Don't give up yet... there might be an assumption that provides more
// information...
OpenPOWER on IntegriCloud