[llvm-dev] [RFC] New pass: LoopExitValues

Steve King via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 10 16:37:16 PDT 2015


On Thu, Sep 10, 2015 at 3:43 PM, Jake VanAdrighem
<jvanadrighem at gmail.com> wrote:
> Which cases does this pass handle which aren't otherwise optimized out by
> passes like GlobalValueNumbering or DeadCodeElimination?
>

The case uniquely handled here is one in which a computation after a
loop so happens to be redundant with a value left over from loop
execution.  At each nesting level of N nested loops, the pass compares
computable SCEVs looking for matches.  This sounds specialized to me,
but I'm not knowledgeable enough in LLVM's many passes to know which
one comes closest to this sort of optimization.  My colleague that
originally wrote the pass noted that redundancies found by this pass
pop up after loop transforms like LSR.

Previously, I showed examples of the type of optimization performed by
this pass -- they're bulky so I won't cut and paste here.  In
particular, check out the before-and-after IR example James asked for.

Regards,
-steve


More information about the llvm-dev mailing list