summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Inline
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-12-28 03:13:12 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-12-28 03:13:12 +0000
commit9900d18bab2075ae99884e4faef1243980fa4bce (patch)
tree8ddfd1c79b836b5f18f6c7e39a18e28429c318f0 /llvm/test/Transforms/Inline
parent28ec3460e4320743c5f78b1550b72720007b339a (diff)
downloadbcm5719-llvm-9900d18bab2075ae99884e4faef1243980fa4bce.tar.gz
bcm5719-llvm-9900d18bab2075ae99884e4faef1243980fa4bce.zip
[PM] Teach the inliner's call graph update to handle inserting new edges
when they are call edges at the leaf but may (transitively) be reached via ref edges. It turns out there is a simple rule: insert everything as a ref edge which is a safe conservative default. Then we let the existing update logic handle promoting some of those to call edges. Note that it would be fairly cheap to make these call edges right away if that is desirable by testing whether there is some existing call path from the source to the target. It just seemed like slightly more complexity in this code path that isn't strictly necessary. If anyone feels strongly about handling this differently I'm happy to change it. llvm-svn: 290649
Diffstat (limited to 'llvm/test/Transforms/Inline')
-rw-r--r--llvm/test/Transforms/Inline/cgscc-update.ll39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Inline/cgscc-update.ll b/llvm/test/Transforms/Inline/cgscc-update.ll
index cf1ac4d1203..77666c3bb71 100644
--- a/llvm/test/Transforms/Inline/cgscc-update.ll
+++ b/llvm/test/Transforms/Inline/cgscc-update.ll
@@ -143,3 +143,42 @@ exit:
call void @test3_maybe_unknown(i1 false)
ret void
}
+
+
+; The 'test4_' prefixed functions are designed to trigger forming a new direct
+; call in the inlined body of the function similar to 'test1_'. However, after
+; that we continue to inline another edge of the graph forcing us to do a more
+; interesting call graph update for the new call edge. Eventually, we still
+; form a new SCC and should use that can deduce precise function attrs.
+
+; This function should have had 'readnone' deduced for its SCC.
+; CHECK: Function Attrs: noinline readnone
+; CHECK-NEXT: define void @test4_f1()
+define void @test4_f1() noinline {
+entry:
+ call void @test4_h()
+ ret void
+}
+
+; CHECK-NOT: @test4_f2
+define internal void @test4_f2() {
+entry:
+ call void @test4_f1()
+ ret void
+}
+
+; CHECK-NOT: @test4_g
+define internal void @test4_g(void()* %p) {
+entry:
+ call void %p()
+ ret void
+}
+
+; This function should have had 'readnone' deduced for its SCC.
+; CHECK: Function Attrs: noinline readnone
+; CHECK-NEXT: define void @test4_h()
+define void @test4_h() noinline {
+entry:
+ call void @test4_g(void()* @test4_f2)
+ ret void
+}
OpenPOWER on IntegriCloud