1 Pull in r196986 from upstream llvm trunk (by Reid Kleckner):
3 Revert the backend fatal error from r196939
5 The combination of inline asm, stack realignment, and dynamic allocas
6 turns out to be too common to reject out of hand.
8 ASan inserts empy inline asm fragments and uses aligned allocas.
9 Compiling any trivial function containing a dynamic alloca with ASan is
10 enough to trigger the check.
12 XFAIL the test cases that would be miscompiled and add one that uses the
13 relevant functionality.
15 Introduced here: http://svn.freebsd.org/changeset/base/263312
17 Index: lib/Target/X86/X86RegisterInfo.cpp
18 ===================================================================
19 --- lib/Target/X86/X86RegisterInfo.cpp
20 +++ lib/Target/X86/X86RegisterInfo.cpp
21 @@ -347,12 +347,6 @@ BitVector X86RegisterInfo::getReservedRegs(const M
22 "Stack realignment in presence of dynamic allocas is not supported with"
23 "this calling convention.");
25 - // FIXME: Do a proper analysis of the inline asm to see if it actually
26 - // conflicts with the base register we chose.
27 - if (MF.hasInlineAsm())
28 - report_fatal_error("Stack realignment in presence of dynamic stack "
29 - "adjustments is not supported with inline assembly.");
31 for (MCSubRegIterator I(getBaseRegister(), this, /*IncludeSelf=*/true);
34 Index: test/CodeGen/X86/inline-asm-stack-realign3.ll
35 ===================================================================
36 --- test/CodeGen/X86/inline-asm-stack-realign3.ll
37 +++ test/CodeGen/X86/inline-asm-stack-realign3.ll
39 +; RUN: llc -march=x86 < %s | FileCheck %s
41 +declare void @bar(i32* %junk)
43 +define i32 @foo(i1 %cond) {
45 + %r = alloca i32, align 128
46 + store i32 -1, i32* %r, align 128
47 + br i1 %cond, label %doit, label %skip
50 + call void asm sideeffect "xor %ecx, %ecx\0A\09mov %ecx, $0", "=*m,~{ecx},~{flags}"(i32* %r)
52 + call void @bar(i32* %junk)
56 + %0 = load i32* %r, align 128
62 +; CHECK: andl $-128, %esp
63 +; CHECK: xor %ecx, %ecx
64 +; CHECK-NEXT: mov %ecx, (%esi)
65 +; CHECK: movl (%esi), %eax
68 Index: test/CodeGen/X86/inline-asm-stack-realign.ll
69 ===================================================================
70 --- test/CodeGen/X86/inline-asm-stack-realign.ll
71 +++ test/CodeGen/X86/inline-asm-stack-realign.ll
73 ; RUN: not llc -mtriple=i686-pc-win32 < %s 2>&1 | FileCheck %s
75 -; We don't currently support realigning the stack and adjusting the stack
76 -; pointer in inline asm. This commonly happens in MS inline assembly using
78 +; FIXME: This is miscompiled due to our unconditional use of ESI as the base
82 ; CHECK: Stack realignment in presence of dynamic stack adjustments is not supported with inline assembly
84 Index: test/CodeGen/X86/inline-asm-stack-realign2.ll
85 ===================================================================
86 --- test/CodeGen/X86/inline-asm-stack-realign2.ll
87 +++ test/CodeGen/X86/inline-asm-stack-realign2.ll
89 ; RUN: not llc -mtriple=i686-pc-win32 < %s 2>&1 | FileCheck %s
91 -; We don't currently support realigning the stack and adjusting the stack
92 -; pointer in inline asm. This can even happen in GNU asm.
93 +; FIXME: This is miscompiled due to our unconditional use of ESI as the base
97 ; CHECK: Stack realignment in presence of dynamic stack adjustments is not supported with inline assembly