[PATCH] D153697: [LV] Freeze start value for select-reductions.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 24 03:46:07 PDT 2023


fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin.
Herald added subscribers: artagnon, StephenFan, rogfer01, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a subscriber: vkmr.
Herald added a project: LLVM.

When creating select-reductions, we are introducing multiple new uses of
the reduction start value. If the start value may be undef or poison,
then differnet uses (e.g in the final select or vector compares) can
evaluate to different values, leading to incorrect results.

To avoid this, freeze the start value in the preheader by introducing a
new Freeze VPInstruction.

Depends on D153696 <https://reviews.llvm.org/D153696>.

Fixes #62565.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153697

Files:
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/sve-select-cmp.ll
  llvm/test/Transforms/LoopVectorize/select-cmp.ll
  llvm/test/Transforms/LoopVectorize/select-reduction-start-value-may-be-undef-or-poison.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153697.534189.patch
Type: text/x-patch
Size: 24342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230624/5f9304b9/attachment.bin>


More information about the llvm-commits mailing list