[PATCH] D16908: [ValueTracking] Use Constant::isZeroValue() in isKnownZero()
Jun Bum Lim via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 4 16:59:31 PST 2016
junbuml created this revision.
junbuml added reviewers: sanjoy, mcrosier, majnemer.
junbuml added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.
In isKnownNonZero(), simply use Constant::isZeroValue().
http://reviews.llvm.org/D16908
Files:
lib/Analysis/ValueTracking.cpp
Index: lib/Analysis/ValueTracking.cpp
===================================================================
--- lib/Analysis/ValueTracking.cpp
+++ lib/Analysis/ValueTracking.cpp
@@ -1907,15 +1907,8 @@
/// defined. Supports values with integer or pointer type and vectors of
/// integers.
bool isKnownNonZero(Value *V, unsigned Depth, const Query &Q) {
- if (Constant *C = dyn_cast<Constant>(V)) {
- if (C->isNullValue())
- return false;
- if (isa<ConstantInt>(C))
- // Must be non-zero due to null test above.
- return true;
- // TODO: Handle vectors
- return false;
- }
+ if (Constant *C = dyn_cast<Constant>(V))
+ return !C->isZeroValue();
if (Instruction* I = dyn_cast<Instruction>(V)) {
if (MDNode *Ranges = I->getMetadata(LLVMContext::MD_range)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16908.46980.patch
Type: text/x-patch
Size: 797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160205/b7050732/attachment.bin>
More information about the llvm-commits
mailing list