[llvm] 9dde514 - [NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 29 06:34:39 PDT 2021
Author: David Sherwood
Date: 2021-06-29T14:34:30+01:00
New Revision: 9dde51416209a5552156384b9c2b08b676818d70
URL: https://github.com/llvm/llvm-project/commit/9dde51416209a5552156384b9c2b08b676818d70
DIFF: https://github.com/llvm/llvm-project/commit/9dde51416209a5552156384b9c2b08b676818d70.diff
LOG: [NFC] Remove shadowed variable in InnerLoopVectorizer::createInductionVariable
Avoid creating a IRBuilder stack variable with the same name as the
class member.
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 f99352a3f075..c79c57cb2bdb 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3071,7 +3071,13 @@ PHINode *InnerLoopVectorizer::createInductionVariable(Loop *L, Value *Start,
if (!Latch)
Latch = Header;
- IRBuilder<> Builder(&*Header->getFirstInsertionPt());
+ // Set the Builder to a valid Block pointer as the existing one could get
+ // deleted below.
+ Builder.SetInsertPoint(&*LoopVectorBody->getFirstInsertionPt());
+
+ IRBuilder<>::InsertPointGuard Guard(Builder);
+ Builder.SetInsertPoint(&*Header->getFirstInsertionPt());
+
Instruction *OldInst = getDebugLocFromInstOrOperands(OldInduction);
setDebugLocFromInst(Builder, OldInst);
auto *Induction = Builder.CreatePHI(Start->getType(), 2, "index");
More information about the llvm-commits
mailing list