[PATCH] D38374: [memcpyopt] Memcpy-memcpy dependence isn't detected across basic blocks

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 23:50:29 PST 2017


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


================
Comment at: lib/Analysis/MemoryDependenceAnalysis.cpp:925
+
+void MemoryDependenceResults::getSpecificNonLocalPointerDependency(
+    Instruction *QueryInst,
----------------
Would it be better to call this `getNonLocalPointerDependencyFrom`, in line with `getPointerDependencyFrom`?


================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:1240
 
+  SmallVector<NonLocalDepResult, 2> NonLocalDepResults;
+  if (SrcDepInfo.isNonLocal()) {
----------------
Why not push this `SmallVector` into the `if` block?


================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:1274
     if (MemSetInst *MDep = dyn_cast<MemSetInst>(SrcDepInfo.getInst()))
       if (performMemCpyToMemSetOptzn(M, MDep)) {
         MD->removeInstruction(M);
----------------
IIUC, this may try to create illegal IR (def not dominating use) if it finds the non-local memset via a backedge since it tries to create a memset before the memcpy using the memset's value operand, which may not dominate the memcpy with your change.


Repository:
  rL LLVM

https://reviews.llvm.org/D38374





More information about the llvm-commits mailing list