Page MenuHomePhabricator

[LSR][SCEVExpander] Avoid blind cast 'Factor' to SCEVConstant in FactorOutConstant.

Authored by huihuiz on Jun 1 2020, 8:46 PM.



In SCEVExpander FactorOutConstant(), when GEP indexing into/over scalable vector,
it is legal for the 'Factor' in a MulExpr to be the size of a scalable vector
instead of a compile-time constant.

Current upstream crash with the test attached.

Diff Detail

Event Timeline

huihuiz created this revision.Jun 1 2020, 8:46 PM

What does expandAddToGEP actually end up doing in your testcase? If it's not generating ideal code, we might want to leave a FIXME pointing that out.

huihuiz updated this revision to Diff 268321.Jun 3 2020, 3:49 PM

Thanks Eli for pointing this out!

In the test case provided, the generated IR is less ideal with base 'scalar_vector' cast to i8* and do uglygep over it.
I have added the FIXME in SCEVExpander::expandAddToGEP.

efriedma accepted this revision.Jun 4 2020, 9:07 AM


This revision is now accepted and ready to land.Jun 4 2020, 9:07 AM
This revision was automatically updated to reflect the committed changes.