[PATCH] D36552: [LVI] Fix LVI compile time regression around constantFoldUser()
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 18:33:17 PDT 2017
sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.
lgtm
================
Comment at: lib/Analysis/LazyValueInfo.cpp:1377
+// to call it.
+static bool canConstantFoldUser(User *Usr) {
+ return isa<CastInst>(Usr) || isa<BinaryOperator>(Usr);
----------------
I'd call this `isOperationFoldable` since we're not checking if `Usr` is foldable or not but only looking at its operation to see if it could //possibly// be constant folded.
================
Comment at: lib/Analysis/LazyValueInfo.cpp:1446
assert(Result.isOverdefined() && "Result isn't overdefined");
- if (isa<IntegerType>(Val->getType())) {
+ // Check with canConstantFoldUser() first to avoid checking the operands
+ // which can be expensive for a large phi, etc.
----------------
s/checking the operands/linearly iterating over the operands unnecessarily/
s/large phi/instructions with many operands/ (I don't think "phi" is relevant here -- this could also have happened with a large call, invoke or GEP instruction).
================
Comment at: lib/Analysis/LazyValueInfo.cpp:1491
return false;
- bool ValUsesCondition = false;
+ bool ValUsesConditionAndFoldable = false;
if (Condition != Val) {
----------------
s/ValUsesConditionAndFoldable/ValUsesConditionAndMayBeFoldable/
https://reviews.llvm.org/D36552
More information about the llvm-commits
mailing list