[PATCH] D133687: [LoopVectorize][Fix] Crash when invariant store address is calculated inside loop

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 00:27:26 PDT 2022


fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM with the inline comment addressed, thanks!



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp:953
+      if (Instruction *Ptr = dyn_cast<Instruction>(SI->getPointerOperand())) {
+        if (isInvariantStoreOfReduction(SI) && TheLoop->contains(Ptr)) {
+          reportVectorizationFailure(
----------------
To simplify the code, please add an early continue if the store is not `isInvariantStoreOfReduction(SI)` and remove the 2 separate checks on line 953 and 939


Please also add the test above to ensure the regression is guarded against.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133687



More information about the llvm-commits mailing list