aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 43574a5..9bbb89e 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -6092,6 +6092,13 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
}
if (!ResultIndex) {
+ auto PtrInst = dyn_cast<Instruction>(ResultPtr);
+ // We know that we have a pointer without any offsets. If this pointer
+ // originates from a different basic block than the current one, we
+ // must be able to recreate it in the current basic block.
+ // We do not support the recreation of any instructions yet.
+ if (PtrInst && PtrInst->getParent() != MemoryInst->getParent())
+ return Modified;
SunkAddr = ResultPtr;
} else {
if (ResultPtr->getType() != I8PtrTy)