[llvm] [SCEVExpander] Fix addrec cost model (PR #106704)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 12:44:45 PDT 2024


https://github.com/preames approved this pull request.

LGTM, but with some questions.  If you're confident you understand this, feel free to move forward.

I'm slightly worried about the "literal" expansion bit here.  For the straight forward expansion, your change is clearly correct.  However, do we ever end up with a "non-literal" expansion?  SCEVExpander has the "literal" bit, and I've never fully understood it's interactions.  

If we end up trying to generate some kind of closed form expansion for the addrec, the prior formulation involving multiplies seems closer to correct.  Now, I'd expect that to have been handled by e.g. getSCEVAtScope, but is there maybe some interaction there?  Did we maybe duplicate some code in SCEVExpander which we shouldn't have?

https://github.com/llvm/llvm-project/pull/106704


More information about the llvm-commits mailing list