diff options
author | Evgenii Kudriashov <evgenii.kudriashov@intel.com> | 2025-06-28 23:30:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-28 23:30:03 +0200 |
commit | 5ffdd9480d80719dc0ff83417ae58a91c157fd79 (patch) | |
tree | b7a9a33913e6d895d790a42580e881f7d2543c7d /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 3ea7fc73397032e71fb20d27084f4552211bb1f6 (diff) | |
download | llvm-5ffdd9480d80719dc0ff83417ae58a91c157fd79.zip llvm-5ffdd9480d80719dc0ff83417ae58a91c157fd79.tar.gz llvm-5ffdd9480d80719dc0ff83417ae58a91c157fd79.tar.bz2 |
[CodeGenPrepare] Filter out unrecreatable addresses from memory optimization (#143566)
Follow up on #139303
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 7 |
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) |