Because LSR happens at a late stage where mul of a power of 2 is
typically canonicalized to shl, this canonicalization emits code that
can be better CSE'ed.
Details
Diff Detail
Event Timeline
lib/Analysis/ScalarEvolutionExpander.cpp | ||
---|---|---|
791 | Btw, visitUDivExpr does similar canonicalization too. |
I don't see anything wrong with this change, but I also do not know LSR well enough to LGTM it. I suppose you'll have to wait for Andy to chime in.
lib/Analysis/ScalarEvolutionExpander.cpp | ||
---|---|---|
30 | I'd add using namespace PatternMatch; here. | |
770 | With the using declaration, we can remove the scope qualifiers here. | |
770–776 | Seeing the continue here is a little confusing, can we just make it an if/else? | |
772–773 | I'd use Constant::getIntegerValue instead as it handles the case where Ty is a vector type. |
I'd add using namespace PatternMatch; here.