This is an archive of the discontinued LLVM Phabricator instance.

Consider all SCEVMulExpr operands for factoring in FactorOutConstant
AbandonedPublic

Authored by vhscampos on Nov 1 2016, 3:04 PM.

Details

Summary

In FactorOutConstant function, when the expression is a SCEVMulExpr, the code was considering only the first operand for factoring. As the comment in line 258 states, all operands should be tested until one suitable is found.

I also removed the TODO about SCEVSDivExpr since this class is not present anymore in LLVM.

Diff Detail

Event Timeline

vhscampos updated this revision to Diff 76638.Nov 1 2016, 3:04 PM
vhscampos retitled this revision from to Consider all SCEVMulExpr operands for factoring in FactorOutConstant.
vhscampos updated this object.
vhscampos added reviewers: sanjoy, sunfish.
vhscampos added a subscriber: llvm-commits.
sanjoy requested changes to this revision.Nov 8 2016, 7:00 PM
sanjoy edited edge metadata.
sanjoy added inline comments.
lib/Analysis/ScalarEvolutionExpander.cpp
265

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.

This revision now requires changes to proceed.Nov 8 2016, 7:00 PM

Okay. Thanks for the clarification. Should I create another patch just for the removal of lines 223-225?

Okay. Thanks for the clarification. Should I create another patch just for the removal of lines 223-225?

Sure. Feel free to just check that patch in without pre-commit review.

vhscampos abandoned this revision.Oct 18 2019, 6:33 AM