[llvm] [Mem2Reg] Don't use single store optimization for potentially poison value (PR #97711)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 4 04:15:55 PDT 2024
================
@@ -525,7 +525,14 @@ rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, LargeBlockInfo &LBI,
SmallSet<DbgAssignIntrinsic *, 8> *DbgAssignsToDelete,
SmallSet<DbgVariableRecord *, 8> *DVRAssignsToDelete) {
StoreInst *OnlyStore = Info.OnlyStore;
- bool StoringGlobalVal = !isa<Instruction>(OnlyStore->getOperand(0));
+ Value *ReplVal = OnlyStore->getOperand(0);
+ // Loads may either load the stored value or uninitialized memory (undef).
+ // If the stored value may be poison, then replacing an uninitialized memory
+ // load with it would be incorrect.
----------------
DianQK wrote:
Ahhhh, I reread this comment and it looks fine.
https://github.com/llvm/llvm-project/pull/97711
More information about the llvm-commits
mailing list