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

Steve King via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 14 11:08:08 PDT 2015


On Fri, Sep 11, 2015 at 10:06 AM, Hal Finkel <hfinkel at anl.gov> wrote:
> Also, if these redundant expressions involve induction variables, then that's something that the IndVarSimplify is already supposed to do, and if it is missing cases, then we should improve that pass (and, thus, folding what you've done into IndVarSimplify might be the right way to go).

Hal, thanks for the info.  Turns out IndVarSimplify intentionally
creates redundant calculation of loop exit values!

//   2. Any use outside of the loop of an expression derived from the indvar
//      is changed to compute the derived value outside of the loop, eliminating
//      the dependence on the exit value of the induction variable.  If the only
//      purpose of the loop is to compute the exit value of some derived
//      expression, this transformation will make the loop dead.

I understand the stated purpose for the redundancy, but there is no
mention of undoing the damage.  The LoopExitValues pass seems to be
exactly the cleanup that was missing.  Do passes coming after IVS like
LSR need the redundant calculations in place to identify dead loops or
should IVS have cleaned up after itself immediately?

Regards,
-steve


More information about the llvm-dev mailing list