summaryrefslogtreecommitdiff
path: root/test/CodeGen/Generic
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-11-21 07:11:48 +0000
committerBill Wendling <isanbard@gmail.com>2013-11-21 07:11:48 +0000
commit0a0da619eb7a072836cf2c5debee1c5c7c8f5496 (patch)
tree088c7aa8b60d21557faa884108b738ab2306cc4f /test/CodeGen/Generic
parentade90c9f1d01f3401a5db183a33b5a6380476a35 (diff)
downloadllvm-0a0da619eb7a072836cf2c5debee1c5c7c8f5496.tar.gz
llvm-0a0da619eb7a072836cf2c5debee1c5c7c8f5496.tar.bz2
llvm-0a0da619eb7a072836cf2c5debee1c5c7c8f5496.tar.xz
Merging r195317:
------------------------------------------------------------------------ r195317 | probinson | 2013-11-20 22:33:32 -0800 (Wed, 20 Nov 2013) | 4 lines Teach ISel not to optimize 'optnone' functions. Based on work by Andrea Di Biagio. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@195321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Generic')
-rw-r--r--test/CodeGen/Generic/isel-optnone.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/Generic/isel-optnone.ll b/test/CodeGen/Generic/isel-optnone.ll
new file mode 100644
index 0000000000..405a1bc50a
--- /dev/null
+++ b/test/CodeGen/Generic/isel-optnone.ll
@@ -0,0 +1,31 @@
+; RUN: llc -debug < %s -o /dev/null 2>&1 | FileCheck %s
+
+; Verify that the backend correctly overrides the optimization level
+; of optnone functions during instruction selection.
+
+define float @foo(float %x) #0 {
+entry:
+ %add = fadd fast float %x, %x
+ %add1 = fadd fast float %add, %x
+ ret float %add1
+}
+
+; CHECK-NOT: Changing optimization level for Function foo
+; CHECK-NOT: Restoring optimization level for Function foo
+
+; Function Attrs: noinline optnone
+define float @fooWithOptnone(float %x) #1 {
+entry:
+ %add = fadd fast float %x, %x
+ %add1 = fadd fast float %add, %x
+ ret float %add1
+}
+
+; CHECK: Changing optimization level for Function fooWithOptnone
+; CHECK-NEXT: Before: -O2 ; After: -O0
+
+; CHECK: Restoring optimization level for Function fooWithOptnone
+; CHECK-NEXT: Before: -O0 ; After: -O2
+
+attributes #0 = { "unsafe-fp-math"="true" }
+attributes #1 = { noinline optnone "unsafe-fp-math"="true" }