[all-commits] [llvm/llvm-project] acea6e: [Passes] Only run extra vector passes if loops hav...

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Dec 10 03:43:11 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: acea6e9cfa4c4a0e8678c7cacede3d0c965dfc36
      https://github.com/llvm/llvm-project/commit/acea6e9cfa4c4a0e8678c7cacede3d0c965dfc36
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-12-10 (Fri, 10 Dec 2021)

  Changed paths:
    M llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
    M llvm/lib/Passes/PassBuilderPipelines.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Other/opt-pipeline-vector-passes.ll

  Log Message:
  -----------
  [Passes] Only run extra vector passes if loops have been vectorized.

This patch uses a similar trick as in D113947 to only run the extra
passes after vectorization on functions where loops have been
vectorized.

The reason for running the 'extra vector passes' is
simplification/unswitching of the runtime checks created by LV, there
should be no need to run them if nothing got vectorized

To do that, a new dummy analysis ShouldRunExtraVectorPasses has been
added. If loops have been vectorized for a function, LV will cache the
analysis. At the moment it uses MadeCFGChanges as proxy for loop
vectorized, which isn't perfect (it could be too aggressive, e.g.
because no runtime checks have been added), but should be good enough
for now.

The extra passes are now managed by a new FunctionPassManager that
runs its passes only if ShouldRunExtraVectorPasses has been cached.

Without this patch, `-extra-vectorizer-passes` has the following
compile-time impact:

NewPM-O3: +4.86%
NewPM-ReleaseThinLTO: +3.56%
NewPM-ReleaseLTO-g: +7.17%

http://llvm-compile-time-tracker.com/compare.php?from=ead3979a92fc33add4710c4510d6906260dcb4ad&to=c292da649e2c6e88a31e702fdc474727d09c72bc&stat=instructions

With this patch, that gets reduced to

NewPM-O3: +1.43%
NewPM-ReleaseThinLTO: +1.00%
NewPM-ReleaseLTO-g: +1.58%

http://llvm-compile-time-tracker.com/compare.php?from=ead3979a92fc33add4710c4510d6906260dcb4ad&to=e67d86b57810011cf285eb9aa1944781be6096f0&stat=instructions

It is probably still too high to enable by default, but much better.

Reviewed By: aeubanks

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




More information about the All-commits mailing list