[all-commits] [llvm/llvm-project] 8f891b: [LoopVectorize] Uninitialized phi node leads to a ...

serguei-katkov via All-commits all-commits at lists.llvm.org
Tue Jun 21 21:19:52 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f891b7c391e3a233373cc02c38be5d90e9b27d9
  Author: Serguei Katkov <serguei.katkov at azul.com>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    A llvm/test/Transforms/LoopVectorize/create-induction-resume.ll

  Log Message:
  [LoopVectorize] Uninitialized phi node leads to a crash in SSAUpdater.

createInductionResumeValues creates a phi node placeholder
without filling incoming values. Then it generates the incoming values.

It includes triggering of SCEV expander which may invoke SSAUpdater.
SSAUpdater has an optimization to detect number of predecessors
basing on incoming values if there is phi node.
In case phi node is not filled with incoming values - the number of predecessors
is detected as 0 and this leads to segmentation fault.

In other words SSAUpdater expects that phi is in good shape while
LoopVectorizer breaks this requirement.

The fix is just prepare all incoming values first and then build a phi node.

Reviewed By: fhahn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D128033

More information about the All-commits mailing list