[llvm] [CodeGenPrepare] Handle address sinking obtained from invoke (PR #143566)
Evgenii Kudriashov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 11 16:59:33 PDT 2025
================
@@ -6099,6 +6099,13 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
}
if (!ResultIndex) {
+ auto PtrInst = dyn_cast<Instruction>(ResultPtr);
+ // Here we know that we have just a pointer without any offsets. If
+ // this pointer comes from a different from the current basic block we
+ // need to know how to recreate it in another basic block.
+ // Currently we don't support recreation of any of instruction.
+ if (PtrInst && PtrInst->getParent() != MemoryInst->getParent())
----------------
e-kud wrote:
Here we can change the predicate to
```
if (!PtrInst || PtrInst->getParent() != MemoryInst->getParent())
```
To skip arguments and global pointers. I'm not sure if it is completely correct.
https://github.com/llvm/llvm-project/pull/143566
More information about the llvm-commits
mailing list