summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs/optnone.ll
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-08-13 10:49:33 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-08-13 10:49:33 +0000
commit0fb998110abcf3d67495d12f854a1576b182d811 (patch)
tree3ccfebccc918a563962362b35aae2306c0c6f01c /llvm/test/Transforms/FunctionAttrs/optnone.ll
parent1013b6b60c66f1e781b79e402d79718ffb4db5af (diff)
downloadbcm5719-llvm-0fb998110abcf3d67495d12f854a1576b182d811.tar.gz
bcm5719-llvm-0fb998110abcf3d67495d12f854a1576b182d811.zip
[optnone] Make the optnone attribute effective at suppressing function
attribute and function argument attribute synthesizing and propagating. As with the other uses of this attribute, the goal remains a best-effort (no guarantees) attempt to not optimize the function or assume things about the function when optimizing. This is particularly useful for compiler testing, bisecting miscompiles, triaging things, etc. I was hitting specific issues using optnone to isolate test code from a test driver for my fuzz testing, and this is one step of fixing that. llvm-svn: 215538
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs/optnone.ll')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/optnone.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/optnone.ll b/llvm/test/Transforms/FunctionAttrs/optnone.ll
new file mode 100644
index 00000000000..7694bfe13aa
--- /dev/null
+++ b/llvm/test/Transforms/FunctionAttrs/optnone.ll
@@ -0,0 +1,24 @@
+; RUN: opt < %s -functionattrs -S | FileCheck %s
+
+@x = global i32 0
+
+define void @test_opt(i8* %p) {
+; CHECK-LABEL: @test_opt
+; CHECK: (i8* nocapture readnone %p) #0 {
+ ret void
+}
+
+define void @test_optnone(i8* %p) noinline optnone {
+; CHECK-LABEL: @test_optnone
+; CHECK: (i8* %p) #1 {
+ ret void
+}
+
+declare i8 @strlen(i8*) noinline optnone
+; CHECK-LABEL: @strlen
+; CHECK: (i8*) #1
+
+; CHECK-LABEL: attributes #0
+; CHECK: = { readnone }
+; CHECK-LABEL: attributes #1
+; CHECK: = { noinline optnone }
OpenPOWER on IntegriCloud