summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Robinson <paul_robinson@playstation.sony.com>2013-11-22 19:11:24 +0000
committerPaul Robinson <paul_robinson@playstation.sony.com>2013-11-22 19:11:24 +0000
commit16c7e0b48cd0a34565aae663caee83e5a641823a (patch)
tree80db529e381349ec5d477ab2757249ba649c64a5 /test
parent09f1b252af316c3edff5ab07de20ca8eeedb648d (diff)
downloadllvm-16c7e0b48cd0a34565aae663caee83e5a641823a.tar.gz
llvm-16c7e0b48cd0a34565aae663caee83e5a641823a.tar.bz2
llvm-16c7e0b48cd0a34565aae663caee83e5a641823a.tar.xz
Teach ISel not to optimize 'optnone' functions (revised).
Improvements over r195317: - Set/restore EnableFastISel flag instead of just running FastISel within SelectAllBasicBlocks; the flag is checked in various places, and FastISel won't run properly if those places don't do the right thing. - Test looks for normal ISel versus FastISel behavior, and not something more subtle that doesn't work everywhere. Based on work by Andrea Di Biagio. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195491 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/isel-optnone.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/CodeGen/X86/isel-optnone.ll b/test/CodeGen/X86/isel-optnone.ll
new file mode 100644
index 0000000000..d2f062832e
--- /dev/null
+++ b/test/CodeGen/X86/isel-optnone.ll
@@ -0,0 +1,42 @@
+; RUN: llc -O2 -march=x86 < %s | FileCheck %s
+
+define i32* @fooOptnone(i32* %p, i32* %q, i32** %z) #0 {
+entry:
+ %r = load i32* %p
+ %s = load i32* %q
+ %y = load i32** %z
+
+ %t0 = add i32 %r, %s
+ %t1 = add i32 %t0, 1
+ %t2 = getelementptr i32* %y, i32 1
+ %t3 = getelementptr i32* %t2, i32 %t1
+
+ ret i32* %t3
+
+; 'optnone' should use fast-isel which will not produce 'lea'.
+; CHECK-LABEL: fooOptnone:
+; CHECK-NOT: lea
+; CHECK: ret
+}
+
+define i32* @fooNormal(i32* %p, i32* %q, i32** %z) #1 {
+entry:
+ %r = load i32* %p
+ %s = load i32* %q
+ %y = load i32** %z
+
+ %t0 = add i32 %r, %s
+ %t1 = add i32 %t0, 1
+ %t2 = getelementptr i32* %y, i32 1
+ %t3 = getelementptr i32* %t2, i32 %t1
+
+ ret i32* %t3
+
+; Normal ISel will produce 'lea'.
+; CHECK-LABEL: fooNormal:
+; CHECK: lea
+; CHECK: ret
+}
+
+attributes #0 = { nounwind optnone noinline }
+attributes #1 = { nounwind }