Skip to content

Commit 1091fad

Browse files
committed
[VPlan] Fix stack-use-after-scope in VPInstruction::generate (NFC).
Fix stack-use-after-scope introduced in 0678e20 by pulling out the vector to a dedicated variable. Should fix ASan/MSan failures, including https://lab.llvm.org/buildbot/#/builders/169/builds/6111.
1 parent a46ee73 commit 1091fad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ Value *VPInstruction::generate(VPTransformState &State) {
631631
NewPhi->addIncoming(IncomingFromVPlanPred, VPlanPred);
632632
// TODO: Predecessors are temporarily reversed to reduce test changes.
633633
// Remove it and update remaining tests after functional change landed.
634-
for (auto *OtherPred :
635-
reverse(to_vector(predecessors(Builder.GetInsertBlock())))) {
634+
auto Predecessors = to_vector(predecessors(Builder.GetInsertBlock()));
635+
for (auto *OtherPred : reverse(Predecessors)) {
636636
assert(OtherPred != VPlanPred &&
637637
"VPlan predecessors should not be connected yet");
638638
NewPhi->addIncoming(IncomingFromOtherPreds, OtherPred);

0 commit comments

Comments
 (0)