From 00a877f96af7da2723aedbb73918eeb2d38c960b Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 3 Mar 2022 11:36:21 -0800 Subject: [PATCH] [DSE] Cache liveOnEntry as clobbering access This builds on @fhahn's D112313, and caches the liveOnEntry node as a optimized access. D112313 tied to only cache a known clobber. This change adds caching the fact that no clobber exists. It still does not cache may-clobber results. Differential Revision: https://reviews.llvm.org/D120842 --- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index fd6c6014b45d..60196e3f3d93 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -1237,6 +1237,9 @@ struct DSEState { // Reached TOP. if (MSSA.isLiveOnEntryDef(Current)) { LLVM_DEBUG(dbgs() << " ... found LiveOnEntryDef\n"); + if (CanOptimize && Current != KillingDef->getDefiningAccess()) + // The first clobbering def is... none. + KillingDef->setOptimized(Current); return None; }