summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitd89125a5d8827b3f427a14ad5fe7e190b7cee3cd (patch)
tree4abd751001fe27be9bca4261e1988dc82ca0bed5 /llvm/test
parent059e800fdaf414725a3777c4a16fcb71c38bddf7 (diff)
downloadbcm5719-llvm-d89125a5d8827b3f427a14ad5fe7e190b7cee3cd.tar.gz
bcm5719-llvm-d89125a5d8827b3f427a14ad5fe7e190b7cee3cd.zip
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. llvm-svn: 195491
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/X86/isel-optnone.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/isel-optnone.ll b/llvm/test/CodeGen/X86/isel-optnone.ll
new file mode 100644
index 00000000000..d2f062832e0
--- /dev/null
+++ b/llvm/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 }
OpenPOWER on IntegriCloud