Teach ISel not to optimize 'optnone' functions.
[oota-llvm.git] / test / CodeGen / Generic / isel-optnone.ll
1 ; RUN: llc -debug < %s -o /dev/null 2>&1 | FileCheck %s
2
3 ; Verify that the backend correctly overrides the optimization level
4 ; of optnone functions during instruction selection.
5
6 define float @foo(float %x) #0 {
7 entry:
8   %add = fadd fast float %x, %x
9   %add1 = fadd fast float %add, %x
10   ret float %add1
11 }
12
13 ; CHECK-NOT: Changing optimization level for Function foo
14 ; CHECK-NOT: Restoring optimization level for Function foo
15
16 ; Function Attrs: noinline optnone
17 define float @fooWithOptnone(float %x) #1 {
18 entry:
19   %add = fadd fast float %x, %x
20   %add1 = fadd fast float %add, %x
21   ret float %add1
22 }
23
24 ; CHECK: Changing optimization level for Function fooWithOptnone
25 ; CHECK-NEXT: Before: -O2 ; After: -O0
26
27 ; CHECK: Restoring optimization level for Function fooWithOptnone
28 ; CHECK-NEXT: Before: -O0 ; After: -O2
29
30 attributes #0 = { "unsafe-fp-math"="true" }
31 attributes #1 = { noinline optnone "unsafe-fp-math"="true" }