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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 17 00:25:56 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG00b77d917cd8: [DSE] Remove alloc function check in canSkipDef() (authored by nikic).

Changed prior to commit:
  https://reviews.llvm.org/D117005?vs=398893&id=400456#toc

Repository:
  rG LLVM Github Monorepo

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

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
@@ -699,17 +699,14 @@
 }
 
 // Check if we can ignore \p D for DSE.
-bool canSkipDef(MemoryDef *D, bool DefVisibleToCaller,
-                const TargetLibraryInfo &TLI) {
+bool canSkipDef(MemoryDef *D, bool DefVisibleToCaller) {
   Instruction *DI = D->getMemoryInst();
   // 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)
@@ -1264,8 +1261,8 @@
       MemoryDef *CurrentDef = cast<MemoryDef>(Current);
       Instruction *CurrentI = CurrentDef->getMemoryInst();
 
-      if (canSkipDef(CurrentDef, !isInvisibleToCallerBeforeRet(KillingUndObj),
-                     TLI)) {
+      if (canSkipDef(CurrentDef,
+                     !isInvisibleToCallerBeforeRet(KillingUndObj))) {
         CanOptimize = false;
         continue;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117005.400456.patch
Type: text/x-patch
Size: 1428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220117/e4f7bc9e/attachment.bin>


More information about the llvm-commits mailing list