[PATCH] D117005: [DSE] Remove alloc function check in canSkipDef()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 03:36:53 PST 2022


nikic created this revision.
nikic added reviewers: fhahn, reames, yurai007.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

canSkipDef() currently skips inaccessiblememonly calls, but not if they are allocation functions. This check was added in D103009 <https://reviews.llvm.org/D103009>, but I don't understand why. There are no test failures if it is removed, and I don't really see what relation it has to the implemented transform (as canSkipDef() is not used on the storeIsNoop() path, as far as I can tell).

Either this is dead code, or we're missing a test.


https://reviews.llvm.org/D117005

Files:
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp


Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -705,11 +705,9 @@
   // Calls that only access inaccessible memory cannot read or write any memory
   // locations we consider for elimination.
   if (auto *CB = dyn_cast<CallBase>(DI))
-    if (CB->onlyAccessesInaccessibleMemory()) {
-      if (isAllocLikeFn(DI, &TLI))
-        return false;
+    if (CB->onlyAccessesInaccessibleMemory())
       return true;
-    }
+
   // We can eliminate stores to locations not visible to the caller across
   // throwing instructions.
   if (DI->mayThrow() && !DefVisibleToCaller)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117005.398893.patch
Type: text/x-patch
Size: 763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220111/5e0959ba/attachment.bin>


More information about the llvm-commits mailing list