[PATCH] D34000: [LazyValueInfo] Don't run the more complex predicate handling code for EQ and NE in getPredicateResult
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 7 10:04:30 PDT 2017
craig.topper created this revision.
Unless I'm mistaken, the special handling for EQ/NE should cover everything and there is no reason to fallthrough to the more complex code. For that matter I'm not sure there's any reason to special case EQ/NE other than avoiding creating temporary ConstantRanges.
This patch moves the complex code into an else so we only do it when we are handling a predicate other than EQ/NE.
https://reviews.llvm.org/D34000
Files:
lib/Analysis/LazyValueInfo.cpp
Index: lib/Analysis/LazyValueInfo.cpp
===================================================================
--- lib/Analysis/LazyValueInfo.cpp
+++ lib/Analysis/LazyValueInfo.cpp
@@ -1692,15 +1692,15 @@
if (CR.isSingleElement())
return LazyValueInfo::False;
+ } else {
+ // Handle more complex predicates.
+ ConstantRange TrueValues = ConstantRange::makeExactICmpRegion(
+ (ICmpInst::Predicate)Pred, CI->getValue());
+ if (TrueValues.contains(CR))
+ return LazyValueInfo::True;
+ if (TrueValues.inverse().contains(CR))
+ return LazyValueInfo::False;
}
-
- // Handle more complex predicates.
- ConstantRange TrueValues = ConstantRange::makeExactICmpRegion(
- (ICmpInst::Predicate)Pred, CI->getValue());
- if (TrueValues.contains(CR))
- return LazyValueInfo::True;
- if (TrueValues.inverse().contains(CR))
- return LazyValueInfo::False;
return LazyValueInfo::Unknown;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34000.101763.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170607/8c929659/attachment.bin>
More information about the llvm-commits
mailing list