[llvm] ac7c482 - [MemCpyOpt] Add extra debug output (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 22:29:37 PDT 2024


Author: Nikita Popov
Date: 2024-05-21T07:29:26+02:00
New Revision: ac7c482ca581cdab11558b5a37ae5095a1638fd2

URL: https://github.com/llvm/llvm-project/commit/ac7c482ca581cdab11558b5a37ae5095a1638fd2
DIFF: https://github.com/llvm/llvm-project/commit/ac7c482ca581cdab11558b5a37ae5095a1638fd2.diff

LOG: [MemCpyOpt] Add extra debug output (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 7ef5dceffec0d..8fe3780bcf1b3 100644
--- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -983,10 +983,8 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
       append_range(srcUseList, U->users());
       continue;
     }
-    if (const auto *G = dyn_cast<GetElementPtrInst>(U)) {
-      if (!G->hasAllZeroIndices())
-        return false;
-
+    if (const auto *G = dyn_cast<GetElementPtrInst>(U);
+        G && G->hasAllZeroIndices()) {
       append_range(srcUseList, U->users());
       continue;
     }
@@ -994,8 +992,10 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
       if (IT->isLifetimeStartOrEnd())
         continue;
 
-    if (U != C && U != cpyLoad)
+    if (U != C && U != cpyLoad) {
+      LLVM_DEBUG(dbgs() << "Call slot: Source accessed by " << *U << "\n");
       return false;
+    }
   }
 
   // Check whether src is captured by the called function, in which case there


        


More information about the llvm-commits mailing list