[llvm-dev] Request suggestions about how to remove redundencies caused by SCEV expansion fundementally

Andrew Trick via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 24 08:53:05 PDT 2016

> On Aug 23, 2016, at 11:30 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> Hi Wei,
> I've not seen GCC's SCEV so I cannot make a comparative comment here
> (maybe Chris, Andy or Dan can chime in here), but I personally am in
> the "make the cleanup passes smarter" camp.  We can also try to make
> SCEV expansion smarter -- not by putting more things in SCEVExpander
> (it is already complex enough!), but by splitting out a dedicated
> SCEVSimplifier that you invoke on code generated from SCEVExpander to
> strength reduce it.  SCEVSimplifier can then internally use routines
> in SCEV, so that it is "as smart as" SCEV in most cases.
> — Sanjoy

SCEV is super useful as an analysis without SCEVExpander. The only real issue with SCEV itself is invalidating the expressions.

I’ve always thought SCEVExpander is very dangerous to use directly. Ideally the SCEV expression should always be reformulated based on existing IR values before expanding. It would be nice if that was provided as a layer of functionality on top of SCEVExpander.


More information about the llvm-dev mailing list