summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/frame-base.ll
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-09-19 11:33:53 +0000
committerTim Northover <tnorthover@apple.com>2013-09-19 11:33:53 +0000
commitadadf887cb57f8281ec23f846a946fb59bd0a0d7 (patch)
treef156053463832460ca53c51e9584350751d47afc /test/CodeGen/X86/frame-base.ll
parentabe68f59174c7418ae73de0a87587abe0be1fb03 (diff)
downloadllvm-adadf887cb57f8281ec23f846a946fb59bd0a0d7.tar.gz
llvm-adadf887cb57f8281ec23f846a946fb59bd0a0d7.tar.bz2
llvm-adadf887cb57f8281ec23f846a946fb59bd0a0d7.tar.xz
X86: FrameIndex addressing modes do have a base register.
When selecting the DAG (add (WrapperRIP ...), (FrameIndex ...)), X86 code had spotted the FrameIndex possibility and was working out whether it could fold the WrapperRIP into this. The test for forming a %rip version is notionally whether we already have a base or index register (%rip precludes both), but we were forgetting to account for the register that would be inserted later to access the frame. rdar://problem/15024520 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/frame-base.ll')
-rw-r--r--test/CodeGen/X86/frame-base.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/X86/frame-base.ll b/test/CodeGen/X86/frame-base.ll
new file mode 100644
index 0000000000..a6bd2a51c9
--- /dev/null
+++ b/test/CodeGen/X86/frame-base.ll
@@ -0,0 +1,22 @@
+; RUN: llc -mtriple=x86_64-apple-macosx -o - %s | FileCheck %s
+
+; The issue here was a conflict between forming a %rip-relative lea and a
+; FrameIndex lea. The %rip sanity-checks didn't consider that a base register
+; had been set if we'd already matched a FrameIndex, when it has in reality.
+
+@var = global i32 0
+
+define void @test_frame_rip_conflict() {
+; CHECK-LABEL: test_frame_rip_conflict:
+; CHECK: leaq _var(%rip), [[TMPADDR:%r.*]]
+; CHECK: leaq {{-?[0-9]+}}(%rsp,[[TMPADDR]]),
+ %stackvar = alloca i32
+
+ %stackint = ptrtoint i32* %stackvar to i64
+ %addr = add i64 ptrtoint(i32* @var to i64), %stackint
+
+ call void @eat_i64(i64 %addr)
+ ret void
+}
+
+declare void @eat_i64(i64)