[PATCH] D107580: [VectorCombine] Support AND/UREM indices that require freezing.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 07:26:39 PDT 2021


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

Seems fine to me, thanks.



================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:785-786
+
+  ScalarizationResult(StatusTy S, Value *ToFreeze = nullptr)
+      : Status(S), ToFreeze(ToFreeze) {}
+
----------------
maybe


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:816
+    Builder.SetInsertPoint(cast<Instruction>(&UserI));
+    Value *Frozen = Builder.CreateFreeze(ToFreeze);
+    for (Use &U : make_early_inc_range((UserI.operands())))
----------------



================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:843-844
+  if (isGuaranteedNotToBePoison(Idx, &AC)) {
+    if (ValidIndices.contains(computeConstantRange(Idx, true, &AC, CtxI, 0)))
+      return ScalarizationResult::safe();
+    return ScalarizationResult::unsafe();
----------------
@nlopes I wanted to check what can we do for potentially OOB insertions,
and i guess this is an alive2 problem:
https://alive2.llvm.org/ce/z/VhUXF-
https://alive2.llvm.org/ce/z/qHk9Wv
?


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:989-991
+    auto ScalarIdx = canScalarizeAccess(FixedVT, UI->getOperand(1), &I, AC);
+    if (!ScalarIdx.isSafe())
       return false;
----------------
This should either contain a FIXME comment, or a comment saying that here freeze won't help.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107580



More information about the llvm-commits mailing list