[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 14:53:17 PDT 2017

sanjoy requested changes to this revision.
sanjoy added inline comments.
This revision now requires changes to proceed.

Comment at: lib/Analysis/LazyValueInfo.cpp:1408
+// to call it.
+static bool canConstantFoldUser(Value *Val) {
+  return isa<CastInst>(Val) || isa<BinaryOperator>(Val);
Please add an assert in constantFolderUser that this is true for its input.  Also please s/`Value *Val`/`User *U`/

Comment at: lib/Analysis/LazyValueInfo.cpp:1494
       if (User *Usr = dyn_cast<User>(Val))
         ValUsesCondition = usesOperand(Usr, Condition);
       if (!ValUsesCondition)
Don't you need to guard this too?


More information about the llvm-commits mailing list