<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I am not sure what you are asking?</div><div><br></div><div>Without transferring the attributes the call site will have no parameter attributes (of the callee functions).</div><div><br></div><div>My reading of the LangRef is that this should not be:</div><div><ol class="arabic" style="list-style-position: initial; list-style-image: initial;"><li><p class="first" style="margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; margin-top: 0px !important;"><span style="background-color: rgba(255, 255, 255, 0);">‘<tt class="docutils literal"><span class="pre">function</span> <span class="pre">args</span></tt>‘: argument list whose types match the function signature argument types and parameter attributes.</span></p></li></ol></div><div>Specifically, if the sret attribute (on some target it changes the abi) attribute is not applied to call sites) I have cases that fail after running this pass.<br><br>Sent from my iPhone</div><div><br>On Jul 18, 2015, at 8:45 PM, Nick Lewycky <<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>> wrote:<br><br></div><blockquote type="cite"><div><span>Arnold Schwaighofer wrote:</span><br><blockquote type="cite"><span>Author: arnolds</span><br></blockquote><blockquote type="cite"><span>Date: Fri Jul 17 13:59:08 2015</span><br></blockquote><blockquote type="cite"><span>New Revision: 242558</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D242558-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=DPCjTli64sYglbnTnKC7MvdjwE6U5MSXljsFzmbuDcI&s=AU3JkYwjgEN23h8zeuGg2xvw_Pd_urPbuK__Q1zpI1o&e=">http://llvm.org/viewvc/llvm-project?rev=242558&view=rev</a></span><br></blockquote><blockquote type="cite"><span>Log:</span><br></blockquote><blockquote type="cite"><span>MergeFuncs: Transfer the function parameter attributes to the call site</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span><a href="rdar://21516488">rdar://21516488</a></span><br></blockquote><span></span><br><span>This doesn't make sense. I don't see any way that the call instruction gets any attributes that aren't already present on the callee function. Can you add a testcase where that isn't true?</span><br><span></span><br><span>Nick</span><br><span></span><br><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Added:</span><br></blockquote><blockquote type="cite"><span>     llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll</span><br></blockquote><blockquote type="cite"><span>Modified:</span><br></blockquote><blockquote type="cite"><span>     llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp</span><br></blockquote><blockquote type="cite"><span>     llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll</span><br></blockquote><blockquote type="cite"><span>     llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp</span><br></blockquote><blockquote type="cite"><span>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Transforms_IPO_MergeFunctions.cpp-3Frev-3D242558-26r1-3D242557-26r2-3D242558-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=DPCjTli64sYglbnTnKC7MvdjwE6U5MSXljsFzmbuDcI&s=0hHQ64Km6Zc5uC4vIBmQq0tUWM0hFX9WbzYZO6mS9pQ&e=">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=242558&r1=242557&r2=242558&view=diff</a></span><br></blockquote><blockquote type="cite"><span>==============================================================================</span><br></blockquote><blockquote type="cite"><span>--- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original)</span><br></blockquote><blockquote type="cite"><span>+++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jul 17 13:59:08 2015</span><br></blockquote><blockquote type="cite"><span>@@ -1361,6 +1361,7 @@ void MergeFunctions::writeThunk(Function</span><br></blockquote><blockquote type="cite"><span>    CallInst *CI = Builder.CreateCall(F, Args);</span><br></blockquote><blockquote type="cite"><span>    CI->setTailCall();</span><br></blockquote><blockquote type="cite"><span>    CI->setCallingConv(F->getCallingConv());</span><br></blockquote><blockquote type="cite"><span>+  CI->setAttributes(F->getAttributes());</span><br></blockquote><blockquote type="cite"><span>    if (NewG->getReturnType()->isVoidTy()) {</span><br></blockquote><blockquote type="cite"><span>      Builder.CreateRetVoid();</span><br></blockquote><blockquote type="cite"><span>    } else {</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Added: llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll</span><br></blockquote><blockquote type="cite"><span>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_Transforms_MergeFunc_apply-5Ffunction-5Fattributes.ll-3Frev-3D242558-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=DPCjTli64sYglbnTnKC7MvdjwE6U5MSXljsFzmbuDcI&s=oDyFKdPX-IJxjHbcYQt2q4s1WX6KAWrsmnOAsKRZwss&e=">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll?rev=242558&view=auto</a></span><br></blockquote><blockquote type="cite"><span>==============================================================================</span><br></blockquote><blockquote type="cite"><span>--- llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll (added)</span><br></blockquote><blockquote type="cite"><span>+++ llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll Fri Jul 17 13:59:08 2015</span><br></blockquote><blockquote type="cite"><span>@@ -0,0 +1,22 @@</span><br></blockquote><blockquote type="cite"><span>+; RUN: opt -S -mergefunc<  %s | FileCheck %s</span><br></blockquote><blockquote type="cite"><span>+%Si = type<{ i32 }></span><br></blockquote><blockquote type="cite"><span>+</span><br></blockquote><blockquote type="cite"><span>+define void @sum(%Si* noalias sret %a, i32 %x, i32 %y) {</span><br></blockquote><blockquote type="cite"><span>+  %sum = add i32 %x, %y</span><br></blockquote><blockquote type="cite"><span>+  %sum2 = add i32 %sum, %y</span><br></blockquote><blockquote type="cite"><span>+  %sum3 = add i32 %sum2, %y</span><br></blockquote><blockquote type="cite"><span>+  ret void</span><br></blockquote><blockquote type="cite"><span>+}</span><br></blockquote><blockquote type="cite"><span>+</span><br></blockquote><blockquote type="cite"><span>+define void @add(%Si* noalias sret %a, i32 %x, i32 %y) {</span><br></blockquote><blockquote type="cite"><span>+  %sum = add i32 %x, %y</span><br></blockquote><blockquote type="cite"><span>+  %sum2 = add i32 %sum, %y</span><br></blockquote><blockquote type="cite"><span>+  %sum3 = add i32 %sum2, %y</span><br></blockquote><blockquote type="cite"><span>+  ret void</span><br></blockquote><blockquote type="cite"><span>+}</span><br></blockquote><blockquote type="cite"><span>+</span><br></blockquote><blockquote type="cite"><span>+; Make sure we transfer the parameter attributes to the call site.</span><br></blockquote><blockquote type="cite"><span>+</span><br></blockquote><blockquote type="cite"><span>+; CHECK-LABEL: define void @sum(%Si* noalias sret, i32, i32)</span><br></blockquote><blockquote type="cite"><span>+; CHECK: tail call void @add(%Si* noalias sret %{{.*}}, i32 %{{.*}}, i32 %{{.*}})</span><br></blockquote><blockquote type="cite"><span>+; CHECK: ret void</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Modified: llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll</span><br></blockquote><blockquote type="cite"><span>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_Transforms_MergeFunc_inttoptr-2Daddress-2Dspace.ll-3Frev-3D242558-26r1-3D242557-26r2-3D242558-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=DPCjTli64sYglbnTnKC7MvdjwE6U5MSXljsFzmbuDcI&s=grRo64gg6cEddLXKnGXBJMC_64FfYrkO5rYJUbAZFMw&e=">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll?rev=242558&r1=242557&r2=242558&view=diff</a></span><br></blockquote><blockquote type="cite"><span>==============================================================================</span><br></blockquote><blockquote type="cite"><span>--- llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll (original)</span><br></blockquote><blockquote type="cite"><span>+++ llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll Fri Jul 17 13:59:08 2015</span><br></blockquote><blockquote type="cite"><span>@@ -21,7 +21,7 @@ define internal i8* @func35(%.qux.2585 a</span><br></blockquote><blockquote type="cite"><span>  bb:</span><br></blockquote><blockquote type="cite"><span>  ; CHECK-LABEL: @func35(</span><br></blockquote><blockquote type="cite"><span>  ; CHECK: %[[V2:.+]] = bitcast %.qux.2585 addrspace(1)* %{{.*}} to %.qux.2496 addrspace(1)*</span><br></blockquote><blockquote type="cite"><span>-; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* %[[V2]])</span><br></blockquote><blockquote type="cite"><span>+; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* nocapture %[[V2]])</span><br></blockquote><blockquote type="cite"><span>  ; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*</span><br></blockquote><blockquote type="cite"><span>    %tmp = getelementptr inbounds %.qux.2585, %.qux.2585 addrspace(1)* %this, i32 0, i32 2</span><br></blockquote><blockquote type="cite"><span>    %tmp1 = load i8*, i8* addrspace(1)* %tmp, align 4</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Modified: llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll</span><br></blockquote><blockquote type="cite"><span>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_Transforms_MergeFunc_inttoptr.ll-3Frev-3D242558-26r1-3D242557-26r2-3D242558-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=DPCjTli64sYglbnTnKC7MvdjwE6U5MSXljsFzmbuDcI&s=lsJYKtLqvqAdKntbddF14cNqHGmPl4WbOPQB3D4SkMA&e=">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll?rev=242558&r1=242557&r2=242558&view=diff</a></span><br></blockquote><blockquote type="cite"><span>==============================================================================</span><br></blockquote><blockquote type="cite"><span>--- llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll (original)</span><br></blockquote><blockquote type="cite"><span>+++ llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll Fri Jul 17 13:59:08 2015</span><br></blockquote><blockquote type="cite"><span>@@ -48,7 +48,7 @@ define internal i8* @func35(%.qux.2585*</span><br></blockquote><blockquote type="cite"><span>  bb:</span><br></blockquote><blockquote type="cite"><span>  ; CHECK-LABEL: @func35(</span><br></blockquote><blockquote type="cite"><span>  ; CHECK: %[[V2:.+]] = bitcast %.qux.2585* %{{.*}} to %.qux.2496*</span><br></blockquote><blockquote type="cite"><span>-; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* %[[V2]])</span><br></blockquote><blockquote type="cite"><span>+; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* nocapture %[[V2]])</span><br></blockquote><blockquote type="cite"><span>  ; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*</span><br></blockquote><blockquote type="cite"><span>    %tmp = getelementptr inbounds %.qux.2585, %.qux.2585* %this, i32 0, i32 2</span><br></blockquote><blockquote type="cite"><span>    %tmp1 = load i8*, i8** %tmp, align 4</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>_______________________________________________</span><br></blockquote><blockquote type="cite"><span>llvm-commits mailing list</span><br></blockquote><blockquote type="cite"><span><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a></span><br></blockquote><blockquote type="cite"><span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><span></span><br></div></blockquote></body></html>