[llvm] 16bb71f - [DSE, MemorySSA] Add a few additional debug messages.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 6 12:31:35 PDT 2020
Author: Florian Hahn
Date: 2020-09-06T20:31:00+01:00
New Revision: 16bb71fd4f898d296397336ecb81b79a7297933c
URL: https://github.com/llvm/llvm-project/commit/16bb71fd4f898d296397336ecb81b79a7297933c
DIFF: https://github.com/llvm/llvm-project/commit/16bb71fd4f898d296397336ecb81b79a7297933c.diff
LOG: [DSE,MemorySSA] Add a few additional debug messages.
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 0296d20bc07b..109e15d6d7cf 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1828,29 +1828,42 @@ struct DSEState {
MemoryAccess *Current = StartAccess;
Instruction *KillingI = KillingDef->getMemoryInst();
bool StepAgain;
- LLVM_DEBUG(dbgs() << " trying to get dominating access for "
- << *StartAccess << "\n");
+ LLVM_DEBUG(dbgs() << " trying to get dominating access\n");
// Find the next clobbering Mod access for DefLoc, starting at StartAccess.
do {
StepAgain = false;
+ LLVM_DEBUG({
+ dbgs() << " visiting " << *Current;
+ if (!MSSA.isLiveOnEntryDef(Current) && isa<MemoryUseOrDef>(Current))
+ dbgs() << " (" << *cast<MemoryUseOrDef>(Current)->getMemoryInst()
+ << ")";
+ dbgs() << "\n";
+ });
+
// Reached TOP.
- if (MSSA.isLiveOnEntryDef(Current))
+ if (MSSA.isLiveOnEntryDef(Current)) {
+ LLVM_DEBUG(dbgs() << " ... found LiveOnEntryDef\n");
return None;
+ }
// Cost of a step. Accesses in the same block are more likely to be valid
// candidates for elimination, hence consider them cheaper.
unsigned StepCost = KillingDef->getBlock() == Current->getBlock()
? MemorySSASameBBStepCost
: MemorySSAOtherBBStepCost;
- if (WalkerStepLimit <= StepCost)
+ if (WalkerStepLimit <= StepCost) {
+ LLVM_DEBUG(dbgs() << " ... hit walker step limit\n");
return None;
+ }
WalkerStepLimit -= StepCost;
// Return for MemoryPhis. They cannot be eliminated directly and the
// caller is responsible for traversing them.
- if (isa<MemoryPhi>(Current))
+ if (isa<MemoryPhi>(Current)) {
+ LLVM_DEBUG(dbgs() << " ... found MemoryPhi\n");
return Current;
+ }
// Below, check if CurrentDef is a valid candidate to be eliminated by
// KillingDef. If it is not, check the next candidate.
More information about the llvm-commits
mailing list