[LoopVectorize] Classify pointer induction updates as scalar only if they have one use
authorKerry McLaughlin <kerry.mclaughlin@arm.com>
Mon, 11 Oct 2021 10:06:36 +0000 (11:06 +0100)
committerKerry McLaughlin <kerry.mclaughlin@arm.com>
Tue, 12 Oct 2021 12:24:49 +0000 (13:24 +0100)
commit1439ef1a3f05c708bf5a57c4623cf895d7268413
tree4308b0c76d87e20ed2b226fc136bb26e2193118a
parent67b10532c637b22c0926517d27f84759893a7258
[LoopVectorize] Classify pointer induction updates as scalar only if they have one use

collectLoopScalars collects pointer induction updates in ScalarPtrs, assuming
that the instruction will be scalar after vectorization. This may crash later
in VPReplicateRecipe::execute() if there there is another user of the instruction
other than the Phi node which needs to be widened.

This changes collectLoopScalars so that if there are any other users of
Update other than a Phi node, it is not added to ScalarPtrs.

Reviewed By: david-arm, fhahn

Differential Revision: https://reviews.llvm.org/D111294
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-gep.ll