From d1a1cce5b130630df0c821e8cafe5f683ccccb90 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Tue, 18 Aug 2020 11:12:31 +0100 Subject: [PATCH] [DSE,MemorySSA] Do not use callCapturesBefore in isReadClobber. Using callCapturesBefore potentially improves the precision and the number of stores we can remove. But in practice, it seems to have very little impact in terms of stores removed. For example, for SPEC2000/SPEC2006/MultiSource with -O3 -flto, ~50 more stores are removed (out of ~26900 stores removed). But in terms of compile-time, it is very expensive and the patch gives substantial compile-time improvements: Geomean O3 -0.24%, ReleaseThinLTO -0.47%, ReleaseLTO-g -0.39%. http://llvm-compile-time-tracker.com/compare.php?from=612a0bff88ed906c83b82f079d4c49e5fecfb9d0&to=e6c86b96d20d97dd88e903a409bd8d39b6114312&stat=instructions --- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index b0ed22e..9d0e026 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -1762,11 +1762,11 @@ struct DSEState { if (CB->onlyAccessesInaccessibleMemory()) return false; - ModRefInfo MR = BatchAA.getModRefInfo(UseInst, DefLoc); - // If necessary, perform additional analysis. - if (isRefSet(MR)) - MR = AA.callCapturesBefore(UseInst, DefLoc, &DT); - return isRefSet(MR); + // NOTE: For calls, the number of stores removed could be slightly improved + // by using AA.callCapturesBefore(UseInst, DefLoc, &DT), but that showed to + // be expensive compared to the benefits in practice. For now, avoid more + // expensive analysis to limit compile-time. + return isRefSet(BatchAA.getModRefInfo(UseInst, DefLoc)); } // Find a MemoryDef writing to \p DefLoc and dominating \p Current, with no -- 2.7.4