[PATCH] Allow call-slop optzn for destinations with a suitable dereferenceable attribute

hfinkel at anl.gov hfinkel at anl.gov
Thu Oct 16 12:36:06 PDT 2014


================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:637
@@ -636,5 +636,3 @@
   } else if (Argument *A = dyn_cast<Argument>(cpyDest)) {
-    // If the destination is an sret parameter then only accesses that are
-    // outside of the returned struct type can trap.
-    if (!A->hasStructRetAttr())
-      return false;
+    if (A->getDereferenceableBytes() < srcSize) {
+      // If the destination is an sret parameter then only accesses that are
----------------
But if you do it this way you're now *requiring* the dereferenceable attribute, and we don't want to do that.

What you want to do is keep the existing logic for sret, and just add additional support for dereferenceable.

http://reviews.llvm.org/D5832






More information about the llvm-commits mailing list