[PATCH] D112313: [DSE] Optimize defining access of defs while walking upwards.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 20 13:21:09 PST 2021


nikic requested changes to this revision.
nikic added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1422
+                     TLI)) {
+        CanOptimize &= !isa<FenceInst>(CurrentDef->getMemoryInst());
         continue;
----------------
Looking at how canSkipDef() is defined, I think this is wrong on two fronts:

First, canSkipDef() skips any mayThrow() instruction if `!DefVisibleToCaller`. But what if this is a non-nounwind call that clobbers KillingLoc?

Second, canSkipDef() skips lifetime intrinsics, but I believe those are considered clobbering by MSSA (they effectively write an undef value to the location).


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1477
         LLVM_DEBUG(dbgs() << "  ... not guaranteed loop independent\n");
         WalkerStepLimit -= 1;
+        CanOptimize = false;
----------------
On an unrelated note, why does this explicitly adjust WalkerStepLimit?


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:2187
 #endif
-
   if (!Changed)
----------------
Spurious change


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112313/new/

https://reviews.llvm.org/D112313



More information about the llvm-commits mailing list