summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-02-13 08:47:51 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-02-13 08:47:51 +0000
commit632d208c78cf7214a0baedd541c133eede30e7df (patch)
tree7c9f035246f3192b6420353e95c652f840c14a5e /llvm/test/Transforms/FunctionAttrs
parentc2cc8706dd70841b7e396c83a4df9491619828b4 (diff)
downloadbcm5719-llvm-632d208c78cf7214a0baedd541c133eede30e7df.tar.gz
bcm5719-llvm-632d208c78cf7214a0baedd541c133eede30e7df.zip
[attrs] Move the norecurse deduction to operate on the node set rather
than the SCC object, and have it scan the instruction stream directly rather than relying on call records. This makes the behavior of this routine consistent between libc routines and LLVM intrinsics for libc routines. We can go and start teaching it about those being norecurse, but we should behave the same for the intrinsic and the libc routine rather than differently. I chatted with James Molloy and the inconsistency doesn't seem intentional and likely is due to intrinsic calls not being modelled in the call graph analyses. This also fixes a bug where we would deduce norecurse on optnone functions, when generally we try to handle optnone functions as-if they were replaceable and thus unanalyzable. llvm-svn: 260813
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/norecurse.ll7
-rw-r--r--llvm/test/Transforms/FunctionAttrs/optnone.ll4
2 files changed, 8 insertions, 3 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/norecurse.ll b/llvm/test/Transforms/FunctionAttrs/norecurse.ll
index d5a2d820840..221b539655a 100644
--- a/llvm/test/Transforms/FunctionAttrs/norecurse.ll
+++ b/llvm/test/Transforms/FunctionAttrs/norecurse.ll
@@ -29,6 +29,13 @@ define i32 @extern() {
}
declare i32 @k() readnone
+; CHECK: define void @intrinsic(i8* nocapture %dest, i8* nocapture readonly %src, i32 %len) {
+define void @intrinsic(i8* %dest, i8* %src, i32 %len) {
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 %len, i32 1, i1 false)
+ ret void
+}
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
+
; CHECK: define internal i32 @called_by_norecurse() #0
define internal i32 @called_by_norecurse() {
%a = call i32 @k()
diff --git a/llvm/test/Transforms/FunctionAttrs/optnone.ll b/llvm/test/Transforms/FunctionAttrs/optnone.ll
index 441ff4da65e..cd08c75d75b 100644
--- a/llvm/test/Transforms/FunctionAttrs/optnone.ll
+++ b/llvm/test/Transforms/FunctionAttrs/optnone.ll
@@ -16,11 +16,9 @@ define void @test_optnone(i8* %p) noinline optnone {
declare i8 @strlen(i8*) noinline optnone
; CHECK-LABEL: @strlen
-; CHECK: (i8*) #2
+; CHECK: (i8*) #1
; CHECK-LABEL: attributes #0
; CHECK: = { norecurse readnone }
; CHECK-LABEL: attributes #1
-; CHECK: = { noinline norecurse optnone }
-; CHECK-LABEL: attributes #2
; CHECK: = { noinline optnone }
OpenPOWER on IntegriCloud