[llvm] 1091fad - [VPlan] Fix stack-use-after-scope in VPInstruction::generate (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 08:51:25 PST 2024
Author: Florian Hahn
Date: 2024-12-06T16:50:54Z
New Revision: 1091fad31a83d5ab87eb6fa11fe3bdb3f0d152ea
URL: https://github.com/llvm/llvm-project/commit/1091fad31a83d5ab87eb6fa11fe3bdb3f0d152ea
DIFF: https://github.com/llvm/llvm-project/commit/1091fad31a83d5ab87eb6fa11fe3bdb3f0d152ea.diff
LOG: [VPlan] Fix stack-use-after-scope in VPInstruction::generate (NFC).
Fix stack-use-after-scope introduced in 0678e2058364ec by pulling out
the vector to a dedicated variable.
Should fix ASan/MSan failures, including
https://lab.llvm.org/buildbot/#/builders/169/builds/6111.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 07587e195c5472..80b62127e1c116 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -631,8 +631,8 @@ Value *VPInstruction::generate(VPTransformState &State) {
NewPhi->addIncoming(IncomingFromVPlanPred, VPlanPred);
// TODO: Predecessors are temporarily reversed to reduce test changes.
// Remove it and update remaining tests after functional change landed.
- for (auto *OtherPred :
- reverse(to_vector(predecessors(Builder.GetInsertBlock())))) {
+ auto Predecessors = to_vector(predecessors(Builder.GetInsertBlock()));
+ for (auto *OtherPred : reverse(Predecessors)) {
assert(OtherPred != VPlanPred &&
"VPlan predecessors should not be connected yet");
NewPhi->addIncoming(IncomingFromOtherPreds, OtherPred);
More information about the llvm-commits
mailing list