[all-commits] [llvm/llvm-project] a8d745: [PassManager] Run Induction Variable Simplificatio...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Nov 25 08:20:57 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a8d74517dcff42d3300aa144820b2772c1560a96
      https://github.com/llvm/llvm-project/commit/a8d74517dcff42d3300aa144820b2772c1560a96
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
    M llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
    M llvm/test/Other/new-pm-defaults.ll
    M llvm/test/Other/new-pm-thinlto-defaults.ll
    M llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
    M llvm/test/Other/opt-O2-pipeline.ll
    M llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
    M llvm/test/Other/opt-O3-pipeline.ll
    M llvm/test/Other/opt-Os-pipeline.ll
    M llvm/test/Transforms/PhaseOrdering/ARM/arm_fill_q7.ll
    M llvm/test/Transforms/PhaseOrdering/X86/loop-idiom-vs-indvars.ll

  Log Message:
  -----------
  [PassManager] Run Induction Variable Simplification pass *after* Recognize loop idioms pass, not before

Currently, `-indvars` runs first, and then immediately after `-loop-idiom` does.
I'm not really sure if `-loop-idiom` requires `-indvars` to run beforehand,
but i'm *very* sure that `-indvars` requires `-loop-idiom` to run afterwards,
as it can be seen in the phase-ordering test.

LoopIdiom runs on two types of loops: countable ones, and uncountable ones.
For uncountable ones, IndVars obviously didn't make any change to them,
since they are uncountable, so for them the order should be irrelevant.
For countable ones, well, they should have been countable before IndVars
for IndVars to make any change to them, and since SCEV is used on them,
it shouldn't matter if IndVars have already canonicalized them.
So i don't really see why we'd want the current ordering.

Should this cause issues, it will give us a reproducer test case
that shows flaws in this logic, and we then could adjust accordingly.

While this is quite likely beneficial in-the-wild already,
it's a required part for the full motivational pattern
behind `left-shift-until-bittest` loop idiom (D91038).

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D91800




More information about the All-commits mailing list