[llvm] bbbec71 - [DSE.MSSA] Only use callCapturesBefore for calls.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 8 07:16:50 PDT 2020
Author: Florian Hahn
Date: 2020-04-08T15:12:33+01:00
New Revision: bbbec716090243d42260c4ef47c8a7695950b52f
URL: https://github.com/llvm/llvm-project/commit/bbbec716090243d42260c4ef47c8a7695950b52f
DIFF: https://github.com/llvm/llvm-project/commit/bbbec716090243d42260c4ef47c8a7695950b52f.diff
LOG: [DSE.MSSA] Only use callCapturesBefore for calls.
callCapturesBefore always returns ModRef , if UseInst isn't a call. As
we only call it if we already know Mod is set, this only destroys the
Must bit for non-calls.
Added:
Modified:
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index bccfefabfad1..7b0a8776dad9 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1575,12 +1575,13 @@ struct DSEState {
ModRefInfo MR = AA.getModRefInfo(UseInst, DefLoc);
// If necessary, perform additional analysis.
- if (isModSet(MR))
+ if (isModSet(MR) && isa<CallBase>(UseInst))
MR = AA.callCapturesBefore(UseInst, DefLoc, &DT);
Optional<MemoryLocation> UseLoc = getLocForWriteEx(UseInst);
return isModSet(MR) && isMustSet(MR) &&
- UseLoc->Size.getValue() >= DefLoc.Size.getValue();
+ (UseLoc->Size.hasValue() && DefLoc.Size.hasValue() &&
+ UseLoc->Size.getValue() >= DefLoc.Size.getValue());
}
/// Returns true if \p Use may read from \p DefLoc.
More information about the llvm-commits
mailing list