[llvm] [DSE] Check write location in IsRedundantStore (PR #93400)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 25 23:00:20 PDT 2024
https://github.com/eaeltsin created https://github.com/llvm/llvm-project/pull/93400
Fix https://github.com/llvm/llvm-project/issues/93298
>From 385e1e6b34bf7b169e33440dcbaa4051437baf55 Mon Sep 17 00:00:00 2001
From: Evgeny Eltsin <eaeltsin at google.com>
Date: Sun, 26 May 2024 05:48:41 +0000
Subject: [PATCH] [DSE] Check write location in IsRedundantStore
---
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index ed4212d29cef7..172cce2cfa381 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -2109,10 +2109,12 @@ struct DSEState {
if (auto *MemSetI = dyn_cast<MemSetInst>(UpperInst)) {
if (auto *SI = dyn_cast<StoreInst>(DefInst)) {
// MemSetInst must have a write location.
- MemoryLocation UpperLoc = *getLocForWrite(UpperInst);
+ auto UpperLoc = getLocForWrite(UpperInst);
+ if (!UpperLoc)
+ return false;
int64_t InstWriteOffset = 0;
int64_t DepWriteOffset = 0;
- auto OR = isOverwrite(UpperInst, DefInst, UpperLoc, *MaybeDefLoc,
+ auto OR = isOverwrite(UpperInst, DefInst, *UpperLoc, *MaybeDefLoc,
InstWriteOffset, DepWriteOffset);
Value *StoredByte = isBytewiseValue(SI->getValueOperand(), DL);
return StoredByte && StoredByte == MemSetI->getOperand(1) &&
More information about the llvm-commits
mailing list