summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/compact-unwind.ll
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-05-09 20:10:38 +0000
committerBill Wendling <isanbard@gmail.com>2013-05-09 20:10:38 +0000
commitedfef3bd27d6269d473fbc570e8c2be02b4070df (patch)
tree0b90fc0efb67675975c7790b55e4278c290f2ddd /test/CodeGen/X86/compact-unwind.ll
parent80d81aa8ba923c9f9a953410677ac53c4c2b8318 (diff)
downloadllvm-edfef3bd27d6269d473fbc570e8c2be02b4070df.tar.gz
llvm-edfef3bd27d6269d473fbc570e8c2be02b4070df.tar.bz2
llvm-edfef3bd27d6269d473fbc570e8c2be02b4070df.tar.xz
Generate a compact unwind encoding in the face of a stack alignment push.
We generate a `push' of a random register (%rax) if the stack needs to be aligned by the size of that register. However, this could mess up compact unwind generation. In particular, we want to still generate compact unwind in the presence of this monstrosity. Check if the push of of the %rax/%eax register. If it is and it's marked with the `FrameSetup' flag, then we can generate a compact unwind encoding for the function only if the push is the last FrameSetup instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181540 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/compact-unwind.ll')
-rw-r--r--test/CodeGen/X86/compact-unwind.ll30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CodeGen/X86/compact-unwind.ll b/test/CodeGen/X86/compact-unwind.ll
new file mode 100644
index 0000000000..8c4fa27da5
--- /dev/null
+++ b/test/CodeGen/X86/compact-unwind.ll
@@ -0,0 +1,30 @@
+; RUN: llc < %s -disable-cfi -disable-fp-elim -mtriple x86_64-apple-darwin11 | FileCheck %s
+
+%ty = type { i8* }
+
+@gv = external global i32
+
+; This is aligning the stack with a push of a random register.
+; CHECK: pushq %rax
+
+; Even though we can't encode %rax into the compact unwind, We still want to be
+; able to generate a compact unwind encoding in this particular case.
+;
+; CHECK: __LD,__compact_unwind
+; CHECK: _foo ## Range Start
+; CHECK: 16842753 ## Compact Unwind Encoding: 0x1010001
+
+define i8* @foo(i64 %size) {
+ %addr = alloca i64, align 8
+ %tmp20 = load i32* @gv, align 4
+ %tmp21 = call i32 @bar()
+ %tmp25 = load i64* %addr, align 8
+ %tmp26 = inttoptr i64 %tmp25 to %ty*
+ %tmp29 = getelementptr inbounds %ty* %tmp26, i64 0, i32 0
+ %tmp34 = load i8** %tmp29, align 8
+ %tmp35 = getelementptr inbounds i8* %tmp34, i64 %size
+ store i8* %tmp35, i8** %tmp29, align 8
+ ret i8* null
+}
+
+declare i32 @bar()