[llvm] [SROA] Conservatively do not split the alloca if ptr is laundered (PR #107557)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 09:04:02 PDT 2024
================
@@ -81,7 +81,8 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI) {
return false;
} else if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(U)) {
if (!II->isLifetimeStartOrEnd() && !II->isDroppable() &&
- II->getIntrinsicID() != Intrinsic::fake_use)
+ II->getIntrinsicID() != Intrinsic::fake_use &&
+ !II->isLaunderOrStripInvariantGroup())
----------------
antoniofrighetto wrote:
I might be wrong, but we don't seem to have logic to handle the others here, do we actually need any specific logic in mem2reg? Why should we scan their uses? The change seems to be needed as the alloca is marked as promotable, as otherwise we would assert in PromoteMemoryToRegister. I don't think we want to mark the alloca as non-promotable when visiting the intrinsic and prevent mem2reg from having the chance to simplify the alloca further.
https://github.com/llvm/llvm-project/pull/107557
More information about the llvm-commits
mailing list