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 | ||
---|---|---|
792 | 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 | ||
---|---|---|
31–32 | I'd add using namespace PatternMatch; here. | |
772 | With the using declaration, we can remove the scope qualifiers here. | |
772–778 | Seeing the continue here is a little confusing, can we just make it an if/else? | |
774–775 | I'd use Constant::getIntegerValue instead as it handles the case where Ty is a vector type. |
I'd add using namespace PatternMatch; here.