[llvm] 565b56a - [NFC] Clean up uses of LoadInst constructor.
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 16:29:10 PDT 2020
Author: Eli Friedman
Date: 2020-04-07T16:28:53-07:00
New Revision: 565b56a72cff067456e186c3fe7bca9a49c61cd7
URL: https://github.com/llvm/llvm-project/commit/565b56a72cff067456e186c3fe7bca9a49c61cd7
DIFF: https://github.com/llvm/llvm-project/commit/565b56a72cff067456e186c3fe7bca9a49c61cd7.diff
LOG: [NFC] Clean up uses of LoadInst constructor.
Added:
Modified:
llvm/examples/BrainF/BrainF.cpp
llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
Removed:
################################################################################
diff --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp
index 2937f8c6cc1d..eef64d3df2df 100644
--- a/llvm/examples/BrainF/BrainF.cpp
+++ b/llvm/examples/BrainF/BrainF.cpp
@@ -440,7 +440,8 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
Value *head_0 = phi;
//%tape.%d = load i8 *%head.%d
- LoadInst *tape_0 = new LoadInst(head_0, tapereg, testbb);
+ LoadInst *tape_0 = new LoadInst(IntegerType::getInt8Ty(C), head_0,
+ tapereg, testbb);
//%test.%d = icmp eq i8 %tape.%d, 0
ICmpInst *test_0 = new ICmpInst(*testbb, ICmpInst::ICMP_EQ, tape_0,
diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
index 7a6bbaf2e16d..067b5a84856c 100644
--- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
+++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
@@ -878,8 +878,8 @@ bool BPFAbstractMemberAccess::transformGEPChain(Module &M, CallInst *Call,
if (CInfo.Kind == BPFPreserveFieldInfoAI) {
// Load the global variable which represents the returned field info.
- auto *LDInst = new LoadInst(Type::getInt32Ty(BB->getContext()), GV);
- BB->getInstList().insert(Call->getIterator(), LDInst);
+ auto *LDInst = new LoadInst(Type::getInt32Ty(BB->getContext()), GV, "",
+ Call);
Call->replaceAllUsesWith(LDInst);
Call->eraseFromParent();
return true;
@@ -896,8 +896,7 @@ bool BPFAbstractMemberAccess::transformGEPChain(Module &M, CallInst *Call,
// The original Call inst is removed.
// Load the global variable.
- auto *LDInst = new LoadInst(Type::getInt64Ty(BB->getContext()), GV);
- BB->getInstList().insert(Call->getIterator(), LDInst);
+ auto *LDInst = new LoadInst(Type::getInt64Ty(BB->getContext()), GV, "", Call);
// Generate a BitCast
auto *BCInst = new BitCastInst(Base, Type::getInt8PtrTy(BB->getContext()));
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index d026e4793b15..a261040d10bc 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -1169,9 +1169,9 @@ CallInst *CodeExtractor::emitCallAndSwitchStatement(Function *newFunction,
Output = ReloadOutputs[i];
}
LoadInst *load = new LoadInst(outputs[i]->getType(), Output,
- outputs[i]->getName() + ".reload");
+ outputs[i]->getName() + ".reload",
+ codeReplacer);
Reloads.push_back(load);
- codeReplacer->getInstList().push_back(load);
std::vector<User *> Users(outputs[i]->user_begin(), outputs[i]->user_end());
for (unsigned u = 0, e = Users.size(); u != e; ++u) {
Instruction *inst = cast<Instruction>(Users[u]);
More information about the llvm-commits
mailing list