Skip to content

Commit

Permalink
[LV] Ensure fixNonInductionPHIs uses a valid insertion point.
Browse files Browse the repository at this point in the history
In some cases, Builder's insertion point may be invalidated before using
it in VPTransformState::get. Make sure the insertion point is
up-to-date.

This should fix various sanitizer errors, like
https://lab.llvm.org/buildbot/#/builders/5/builds/4933/steps/9/logs/stdio
  • Loading branch information
fhahn committed Feb 23, 2021
1 parent 2af5275 commit de40423
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4374,6 +4374,8 @@ void InnerLoopVectorizer::fixNonInductionPHIs(VPTransformState &State) {
VPWidenPHIRecipe *VPPhi =
cast<VPWidenPHIRecipe>(State.Plan->getVPValue(OrigPhi));
PHINode *NewPhi = cast<PHINode>(State.get(VPPhi, 0));
// Make sure the builder has a valid insert point.
Builder.SetInsertPoint(NewPhi);
for (unsigned i = 0; i < VPPhi->getNumOperands(); ++i) {
VPValue *Inc = VPPhi->getIncomingValue(i);
VPBasicBlock *VPBB = VPPhi->getIncomingBlock(i);
Expand Down

0 comments on commit de40423

Please sign in to comment.