[PATCH] D109368: [LV] Don't vectorize if we can prove RT + vector cost >= scalar cost.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 3 09:26:43 PST 2022


fhahn updated this revision to Diff 397084.
fhahn added a comment.

Rebased, removed some code that became dead and also introduced a new cut-off on the number of runtime checks. This cutoff is there to only control compile-time. This fixes some excessive compile-time regressions, especially in mafft (was +15%).

While the cutoff is not ideal, I think we have to accept a bound on the number of runtime checks, because in degenerate cases vectorization can add a lot of additional code. For one ccase in mafft, vectorizing a loop with 325 runtime checks caused a 200% compile-time regression for that file. Note that the choosen cutoff is already higher than the previous pragma threshold.

Compile-time impact with this patch : http://llvm-compile-time-tracker.com/compare.php?from=05ce750b7968c548cf10a5f1413cf5aac3f1b083&to=f2093a608e33dc48dc2b8ebbbb1d0cd45b9bf6e7&stat=instructions

NewPM-O3: +0.25%
NewPM-ReleaseThinLTO: +0.18%
NewPM-ReleaseLTO-g: +0.18%


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109368/new/

https://reviews.llvm.org/D109368

Files:
  llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/runtime-check-size-based-threshold.ll
  llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll
  llvm/test/Transforms/LoopVectorize/X86/pointer-runtime-checks-unprofitable.ll
  llvm/test/Transforms/LoopVectorize/X86/pr23997.ll
  llvm/test/Transforms/LoopVectorize/X86/pr35432.ll
  llvm/test/Transforms/LoopVectorize/X86/runtime-limit.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109368.397084.patch
Type: text/x-patch
Size: 24132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220103/6466d731/attachment.bin>


More information about the llvm-commits mailing list