aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2023-11-30 13:00:26 +0000
committerGitHub <noreply@github.com>2023-11-30 13:00:26 +0000
commit5ba5211a477f0d513eaed2b35e04239f005a30bd (patch)
tree20caa95e24be08daa1962a60ee80dc82b7c0c9f9 /llvm/lib/IR/Instructions.cpp
parentb8a5a015d12c698a3254898c94d0adffe0724fa8 (diff)
downloadllvm-5ba5211a477f0d513eaed2b35e04239f005a30bd.zip
llvm-5ba5211a477f0d513eaed2b35e04239f005a30bd.tar.gz
llvm-5ba5211a477f0d513eaed2b35e04239f005a30bd.tar.bz2
[DebugInfo][RemoveDIs] Have LICM insert at iterator positions (#73671)
Because we're storing some extra debug-info information in the iterator class, we need to insert new LICM-created stores using such iterators. Switch LICM to storing iterators instead of pointers when it promotes variables in loops, add a test for the desired behaviour, and enable RemoveDIs instrumentation on a variety of other LICM tests for good measure. (This would appear to be the only pass in LLVM that needs to store iterators on the heap).
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r--llvm/lib/IR/Instructions.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 2ea9c05..bc228a5 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1462,6 +1462,9 @@ StoreInst::StoreInst(Value *val, Value *addr, Instruction *InsertBefore)
StoreInst::StoreInst(Value *val, Value *addr, BasicBlock *InsertAtEnd)
: StoreInst(val, addr, /*isVolatile=*/false, InsertAtEnd) {}
+StoreInst::StoreInst(Value *val, Value *addr, BasicBlock::iterator InsertBefore)
+ : StoreInst(val, addr, /*isVolatile=*/false, InsertBefore) {}
+
StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
Instruction *InsertBefore)
: StoreInst(val, addr, isVolatile,
@@ -1474,6 +1477,12 @@ StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
computeLoadStoreDefaultAlign(val->getType(), InsertAtEnd),
InsertAtEnd) {}
+StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
+ BasicBlock::iterator InsertBefore)
+ : StoreInst(val, addr, isVolatile,
+ computeLoadStoreDefaultAlign(val->getType(), &*InsertBefore),
+ InsertBefore) {}
+
StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
Instruction *InsertBefore)
: StoreInst(val, addr, isVolatile, Align, AtomicOrdering::NotAtomic,
@@ -1485,6 +1494,11 @@ StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
SyncScope::System, InsertAtEnd) {}
StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
+ BasicBlock::iterator InsertBefore)
+ : StoreInst(val, addr, isVolatile, Align, AtomicOrdering::NotAtomic,
+ SyncScope::System, InsertBefore) {}
+
+StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
AtomicOrdering Order, SyncScope::ID SSID,
Instruction *InsertBefore)
: Instruction(Type::getVoidTy(val->getContext()), Store,
@@ -1512,6 +1526,20 @@ StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
AssertOK();
}
+StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
+ AtomicOrdering Order, SyncScope::ID SSID,
+ BasicBlock::iterator InsertBefore)
+ : Instruction(Type::getVoidTy(val->getContext()), Store,
+ OperandTraits<StoreInst>::op_begin(this),
+ OperandTraits<StoreInst>::operands(this)) {
+ Op<0>() = val;
+ Op<1>() = addr;
+ setVolatile(isVolatile);
+ setAlignment(Align);
+ setAtomic(Order, SSID);
+ insertBefore(*InsertBefore->getParent(), InsertBefore);
+ AssertOK();
+}
//===----------------------------------------------------------------------===//
// AtomicCmpXchgInst Implementation