diff options
| author | Manoj Gupta <manojgupta@google.com> | 2018-07-30 19:33:53 +0000 |
|---|---|---|
| committer | Manoj Gupta <manojgupta@google.com> | 2018-07-30 19:33:53 +0000 |
| commit | 9d83ce90434aaa00e1b71393b7060bfce793fd69 (patch) | |
| tree | 9745d46fdfe8bc41a8b118c70c7ac7abe947bbe0 /llvm/test/Transforms/Inline | |
| parent | 6907ce2f8f7410b179beb6e2db9c8d16a257ce9f (diff) | |
| download | bcm5719-llvm-9d83ce90434aaa00e1b71393b7060bfce793fd69.tar.gz bcm5719-llvm-9d83ce90434aaa00e1b71393b7060bfce793fd69.zip | |
[Inline] Copy "null-pointer-is-valid" attribute in caller.
Summary:
Normally, inling does not happen if caller does not have
"null-pointer-is-valid"="true" attibute but callee has it.
However, alwaysinline may force callee to be inlined.
In this case, if the caller has the "null-pointer-is-valid"="true"
attribute, copy the attribute to caller.
Reviewers: efriedma, a.elovikov, lebedev.ri, jyknight
Reviewed By: efriedma
Subscribers: eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D50000
llvm-svn: 338292
Diffstat (limited to 'llvm/test/Transforms/Inline')
| -rw-r--r-- | llvm/test/Transforms/Inline/attributes.ll | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/test/Transforms/Inline/attributes.ll b/llvm/test/Transforms/Inline/attributes.ll index c2808ba8c03..66a831bf817 100644 --- a/llvm/test/Transforms/Inline/attributes.ll +++ b/llvm/test/Transforms/Inline/attributes.ll @@ -333,9 +333,10 @@ define i32 @test_no-use-jump-tables3(i32 %i) "no-jump-tables"="true" { ; CHECK-NEXT: ret i32 } -; Calle with "null-pointer-is-valid"="true" attribute should not be inlined -; into a caller without this attribute. Exception: alwaysinline callee -; can still be inlined. +; Callee with "null-pointer-is-valid"="true" attribute should not be inlined +; into a caller without this attribute. +; Exception: alwaysinline callee can still be inlined but +; "null-pointer-is-valid"="true" should get copied to caller. define i32 @null-pointer-is-valid_callee0(i32 %i) "null-pointer-is-valid"="true" { ret i32 %i @@ -355,6 +356,7 @@ define i32 @null-pointer-is-valid_callee2(i32 %i) { ; CHECK-NEXT: ret i32 } +; No inlining since caller does not have "null-pointer-is-valid"="true" attribute. define i32 @test_null-pointer-is-valid0(i32 %i) { %1 = call i32 @null-pointer-is-valid_callee0(i32 %i) ret i32 %1 @@ -363,17 +365,22 @@ define i32 @test_null-pointer-is-valid0(i32 %i) { ; CHECK-NEXT: ret i32 } -define i32 @test_null-pointer-is-valid1(i32 %i) { +; alwaysinline should force inlining even when caller does not have +; "null-pointer-is-valid"="true" attribute. However, the attribute should be +; copied to caller. +define i32 @test_null-pointer-is-valid1(i32 %i) "null-pointer-is-valid"="false" { %1 = call i32 @null-pointer-is-valid_callee1(i32 %i) ret i32 %1 -; CHECK: @test_null-pointer-is-valid1( +; CHECK: @test_null-pointer-is-valid1(i32 %i) [[NULLPOINTERISVALID:#[0-9]+]] { ; CHECK-NEXT: ret i32 } +; Can inline since both caller and callee have "null-pointer-is-valid"="true" +; attribute. define i32 @test_null-pointer-is-valid2(i32 %i) "null-pointer-is-valid"="true" { %1 = call i32 @null-pointer-is-valid_callee2(i32 %i) ret i32 %1 -; CHECK: @test_null-pointer-is-valid2( +; CHECK: @test_null-pointer-is-valid2(i32 %i) [[NULLPOINTERISVALID]] { ; CHECK-NEXT: ret i32 } @@ -381,3 +388,4 @@ define i32 @test_null-pointer-is-valid2(i32 %i) "null-pointer-is-valid"="true" { ; CHECK: attributes [[FPMAD_TRUE]] = { "less-precise-fpmad"="true" } ; CHECK: attributes [[NOIMPLICITFLOAT]] = { noimplicitfloat } ; CHECK: attributes [[NOUSEJUMPTABLES]] = { "no-jump-tables"="true" } +; CHECK: attributes [[NULLPOINTERISVALID]] = { "null-pointer-is-valid"="true" } |

