[PATCH] D35974: AMDGPU: Add pass to replace out arguments

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 22:44:02 PDT 2017


rampitec added inline comments.


================
Comment at: lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp:300
+  RetAttrs.addAttribute(Attribute::NoAlias);
+  NewFunc->removeAttributes(AttributeList::ReturnIndex, RetAttrs);
+  // TODO: How to preserve metadata?
----------------
arsenm wrote:
> rampitec wrote:
> > arsenm wrote:
> > > rampitec wrote:
> > > > Consider also marking it always inline.
> > > The stub function is marked as always inline. The new function here steals the body of the old function, the original function is then marked always inline
> > I mean stub gets original attributes. The new function gets original attributes + always inline. That way it will be always inlined into stub if otherwise not simplified. I.e. if at the end call to a stub will not be replaced with a call to the new function we will have no extra call.
> > 
> > You can also check the heuristic isWrapperOnlyCall() in the AMDInline.cpp from HSAIL, which basically implements the same logic: inline everything into a wrapper/stub.
> This is what happens, it's just mechanically the original IR function becomes the stub
If the original had no always inline, new will not get it either. In a worst case we can end up with two calls.


https://reviews.llvm.org/D35974





More information about the llvm-commits mailing list