[PATCH] D101916: [LoopVectorize] Fix crash for predicated instructions with scalable VF

Caroline via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 05:45:53 PDT 2021


CarolineConcatto added a comment.

Hey @sdesmalen,
Thank you for pointing out the missing flag on the test.
I have moved the test to be inside the AArch64 folder.
One thing I am not sure is the fix I added in getinstructionCost for scalable vector with BR instruction.
I believe it makes sense to not compute the cost of scalarized predicated instruction when VF is scalable, but not sure if the cost is correct.
Or if it should be invalid.



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6828-6829
         // for emulated masked memrefs.
-        if (!useEmulatedMaskMemRefHack(&I) &&
-            computePredInstDiscount(&I, ScalarCosts, VF) >= 0)
-          ScalarCostsVF.insert(ScalarCosts.begin(), ScalarCosts.end());
+        if (!VF.isScalable())
+          if (!useEmulatedMaskMemRefHack(&I) &&
+              computePredInstDiscount(&I, ScalarCosts, VF) >= 0)
----------------
sdesmalen wrote:
> Can you merge these conditions, i.e. `if (!VFScalable() && !useEmulatedMaskMemRefHack(&I) && ..`
Is it ok if I do:

        if (!VF.isScalable() && !useEmulatedMaskMemRefHack(&I))
          if (computePredInstDiscount(&I, ScalarCosts, VF) >= 0)

Because computePredInstDiscount should not be called for scalable vector.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101916



More information about the llvm-commits mailing list