summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-10-06 17:04:55 +0000
committerDehao Chen <dehao@google.com>2017-10-06 17:04:55 +0000
commit9bd60429e29a9bce6f54f81cdb89f05cc29e6ca9 (patch)
treefb20dd0d7ca90456eed69a43991aa447d148bd84 /llvm/test
parentafe5057b591b0dd062f2ffc8cfcc30befd8bff46 (diff)
downloadbcm5719-llvm-9bd60429e29a9bce6f54f81cdb89f05cc29e6ca9.tar.gz
bcm5719-llvm-9bd60429e29a9bce6f54f81cdb89f05cc29e6ca9.zip
Directly return promoted direct call instead of rely on stripPointerCast.
Summary: stripPointerCast is not reliably returning the value that's being type-casted. Instead it may look further at function attributes to further propagate the value. Instead of relying on stripPOintercast, the more reliable solution is to directly use the pointer to the promoted direct call. Reviewers: tejohnson, davidxl Reviewed By: tejohnson Subscribers: llvm-commits, sanjoy Differential Revision: https://reviews.llvm.org/D38603 llvm-svn: 315077
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof5
-rw-r--r--llvm/test/Transforms/SampleProfile/indirect-call.ll30
2 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof b/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof
index dda7d0585e3..5cbfc0a73bc 100644
--- a/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof
+++ b/llvm/test/Transforms/SampleProfile/Inputs/indirect-call.prof
@@ -24,3 +24,8 @@ test_norecursive_inline:3000:0
test_noinline_bitcast:3000:0
1: foo_direct_i32:3000
1: 3000
+return_arg_caller:3000:0
+ 1: foo_inline1:3000
+ 11: 3000
+ 2: return_arg:3000
+ 1: 3000
diff --git a/llvm/test/Transforms/SampleProfile/indirect-call.ll b/llvm/test/Transforms/SampleProfile/indirect-call.ll
index 02fcb11060a..8c80091c347 100644
--- a/llvm/test/Transforms/SampleProfile/indirect-call.ll
+++ b/llvm/test/Transforms/SampleProfile/indirect-call.ll
@@ -92,6 +92,32 @@ define void @test_norecursive_inline() !dbg !24 {
ret void
}
+define i32* @return_arg(i32* readnone returned) !dbg !29{
+ ret i32* %0
+}
+
+; CHECK-LABEL: @return_arg_caller
+; When the promoted indirect call returns a parameter that was defined by the
+; return value of a previous direct call. Checks both direct call and promoted
+; indirect call are inlined.
+define i32* @return_arg_caller(i32* (i32*)* nocapture) !dbg !30{
+; CHECK-NOT: call i32* @foo_inline1
+; CHECK: if.true.direct_targ:
+; CHECK-NOT: call
+; CHECK: if.false.orig_indirect:
+; CHECK: call
+ %2 = call i32* @foo_inline1(i32* null), !dbg !31
+ %cmp = icmp ne i32* %2, null
+ br i1 %cmp, label %then, label %else
+
+then:
+ %3 = tail call i32* %0(i32* %2), !dbg !32
+ ret i32* %3
+
+else:
+ ret i32* null
+}
+
@x = global i32 0, align 4
@y = global void ()* null, align 8
@@ -176,3 +202,7 @@ define void @test_direct() !dbg !22 {
!26 = distinct !DISubprogram(name: "test_noinline_bitcast", scope: !1, file: !1, line: 12, unit: !0)
!27 = !DILocation(line: 13, scope: !26)
!28 = distinct !DISubprogram(name: "foo_direct_i32", scope: !1, file: !1, line: 11, unit: !0)
+!29 = distinct !DISubprogram(name: "return_arg", scope: !1, file: !1, line: 11, unit: !0)
+!30 = distinct !DISubprogram(name: "return_arg_caller", scope: !1, file: !1, line: 11, unit: !0)
+!31 = !DILocation(line: 12, scope: !30)
+!32 = !DILocation(line: 13, scope: !30)
OpenPOWER on IntegriCloud