[PATCH] D26217: Consider all SCEVMulExpr operands for factoring in FactorOutConstant

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 19:00:53 PST 2016


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


================
Comment at: lib/Analysis/ScalarEvolutionExpander.cpp:265
+    for (unsigned i = 0, e = M->getNumOperands(); i < e; ++i) {
+      if (const SCEVConstant *C = dyn_cast<SCEVConstant>(M->getOperand(i)))
+        if (!C->getAPInt().srem(FC->getAPInt())) {
----------------
I'm not sure when you expect this to fire -- you should never have a SCEV mul expression with multiple constant operands, they should have all been folded into one (i.e. `(2 * 3 * %val)` => `(6 * %val)`).  If that's not happening in some case, that's the real bug.


https://reviews.llvm.org/D26217





More information about the llvm-commits mailing list