[llvm] de40423 - [LV] Ensure fixNonInductionPHIs uses a valid insertion point.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 10:51:40 PST 2021
Author: Florian Hahn
Date: 2021-02-23T18:51:05Z
New Revision: de40423c8512c9cfa0b244314b5e342056ec6d49
URL: https://github.com/llvm/llvm-project/commit/de40423c8512c9cfa0b244314b5e342056ec6d49
DIFF: https://github.com/llvm/llvm-project/commit/de40423c8512c9cfa0b244314b5e342056ec6d49.diff
LOG: [LV] Ensure fixNonInductionPHIs uses a valid insertion point.
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
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index cebb8ece2827..5594cb9f7fe3 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -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);
More information about the llvm-commits
mailing list