[PATCH] ArgumentPromotion: Drop sret attribute on functions that are only called directly.

Reid Kleckner rnk at google.com
Wed Jun 10 13:51:22 PDT 2015


lgtm

This might be an interesting change, since we'll basically remove sret from all directly called functions in LTO builds, even if we weren't going to do arg promotion. I'm pretty confident it's safe, though.


================
Comment at: lib/Transforms/IPO/ArgumentPromotion.cpp:258-262
@@ +257,7 @@
+        CallSite CS(U.getUser());
+        CS.setAttributes(
+            CS.getAttributes()
+                .removeAttribute(F->getContext(), ArgNo + 1,
+                                 Attribute::StructRet)
+                .addAttribute(F->getContext(), ArgNo + 1, Attribute::NoAlias));
+      }
----------------
I think this is inefficient because we end up with lots of temporary attribute sets, but whatever. It's kind of an API deficiency. =/

The alternative would be to compute the set of parameters that are losing sret and feed that into DoPromotion, which is ugly.

http://reviews.llvm.org/D10353

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list