[llvm] r242558 - MergeFuncs: Transfer the function parameter attributes to the call site
Nick Lewycky
nicholas at mxc.ca
Sat Jul 18 20:45:31 PDT 2015
Arnold Schwaighofer wrote:
> Author: arnolds
> Date: Fri Jul 17 13:59:08 2015
> New Revision: 242558
>
> URL: http://llvm.org/viewvc/llvm-project?rev=242558&view=rev
> Log:
> MergeFuncs: Transfer the function parameter attributes to the call site
>
> rdar://21516488
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?
Nick
>
> Added:
> llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll
> Modified:
> llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
> llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll
> llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll
>
> Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=242558&r1=242557&r2=242558&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jul 17 13:59:08 2015
> @@ -1361,6 +1361,7 @@ void MergeFunctions::writeThunk(Function
> CallInst *CI = Builder.CreateCall(F, Args);
> CI->setTailCall();
> CI->setCallingConv(F->getCallingConv());
> + CI->setAttributes(F->getAttributes());
> if (NewG->getReturnType()->isVoidTy()) {
> Builder.CreateRetVoid();
> } else {
>
> Added: llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll?rev=242558&view=auto
> ==============================================================================
> --- llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll (added)
> +++ llvm/trunk/test/Transforms/MergeFunc/apply_function_attributes.ll Fri Jul 17 13:59:08 2015
> @@ -0,0 +1,22 @@
> +; RUN: opt -S -mergefunc< %s | FileCheck %s
> +%Si = type<{ i32 }>
> +
> +define void @sum(%Si* noalias sret %a, i32 %x, i32 %y) {
> + %sum = add i32 %x, %y
> + %sum2 = add i32 %sum, %y
> + %sum3 = add i32 %sum2, %y
> + ret void
> +}
> +
> +define void @add(%Si* noalias sret %a, i32 %x, i32 %y) {
> + %sum = add i32 %x, %y
> + %sum2 = add i32 %sum, %y
> + %sum3 = add i32 %sum2, %y
> + ret void
> +}
> +
> +; Make sure we transfer the parameter attributes to the call site.
> +
> +; CHECK-LABEL: define void @sum(%Si* noalias sret, i32, i32)
> +; CHECK: tail call void @add(%Si* noalias sret %{{.*}}, i32 %{{.*}}, i32 %{{.*}})
> +; CHECK: ret void
>
> Modified: llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll?rev=242558&r1=242557&r2=242558&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll (original)
> +++ llvm/trunk/test/Transforms/MergeFunc/inttoptr-address-space.ll Fri Jul 17 13:59:08 2015
> @@ -21,7 +21,7 @@ define internal i8* @func35(%.qux.2585 a
> bb:
> ; CHECK-LABEL: @func35(
> ; CHECK: %[[V2:.+]] = bitcast %.qux.2585 addrspace(1)* %{{.*}} to %.qux.2496 addrspace(1)*
> -; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* %[[V2]])
> +; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* nocapture %[[V2]])
> ; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*
> %tmp = getelementptr inbounds %.qux.2585, %.qux.2585 addrspace(1)* %this, i32 0, i32 2
> %tmp1 = load i8*, i8* addrspace(1)* %tmp, align 4
>
> Modified: llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll?rev=242558&r1=242557&r2=242558&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll (original)
> +++ llvm/trunk/test/Transforms/MergeFunc/inttoptr.ll Fri Jul 17 13:59:08 2015
> @@ -48,7 +48,7 @@ define internal i8* @func35(%.qux.2585*
> bb:
> ; CHECK-LABEL: @func35(
> ; CHECK: %[[V2:.+]] = bitcast %.qux.2585* %{{.*}} to %.qux.2496*
> -; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* %[[V2]])
> +; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* nocapture %[[V2]])
> ; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8*
> %tmp = getelementptr inbounds %.qux.2585, %.qux.2585* %this, i32 0, i32 2
> %tmp1 = load i8*, i8** %tmp, align 4
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list