[clang] [llvm] [PromoteMemToReg] Insert store undef when removing lifetime markers (PR #191909)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 19 12:38:27 PDT 2026
================
@@ -546,9 +545,20 @@ static void removeIntrinsicUsers(AllocaInst *AI) {
Inst->dropDroppableUse(UU);
continue;
}
+
Inst->eraseFromParent();
}
}
+
+ // Same as above for lifetime intrinsics directly on the alloca.
+ if (auto *II = dyn_cast<IntrinsicInst>(I))
+ if (II->isLifetimeStartOrEnd()) {
+ auto *Store = new StoreInst(UndefValue::get(AI->getAllocatedType()), AI,
----------------
nikic wrote:
This needs to use the common type of all loads/stores, rather than the allocated type, which is not required to be the same.
https://github.com/llvm/llvm-project/pull/191909
More information about the cfe-commits
mailing list