<div dir="ltr">In retrospect, I don't think this is right, since it miscompiles LLVM's own cpuid call in Host.cpp:<div><a href="http://llvm.org/bugs/show_bug.cgi?id=16830">http://llvm.org/bugs/show_bug.cgi?id=16830</a></div>
<div><br></div><div>Chad, can you (or anyone else) elaborate on the conditions under which the frame pointer might not be used to reference the local variable?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Feb 19, 2013 at 3:50 PM, Chad Rosier <span dir="ltr"><<a href="mailto:mcrosier@apple.com" target="_blank">mcrosier@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: mcrosier<br>
Date: Tue Feb 19 17:50:45 2013<br>
New Revision: 175576<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175576&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175576&view=rev</a><br>
Log:<br>
[ms-inline asm] Force the use of a base pointer if the MachineFunction includes<br>
MS-style inline assembly.<br>
<br>
This is a follow-on to r175334. Forcing a FP to be emitted doesn't ensure it<br>
will be used. Therefore, force the base pointer as well. We now treat MS<br>
inline assembly in the same way we treat functions with dynamic stack<br>
realignment and VLAs. This guarantees the BP will be used to reference<br>
parameters and locals.<br>
rdar://13218191<br>
<br>
Modified:<br>
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp<br>
llvm/trunk/test/CodeGen/X86/ms-inline-asm.ll<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=175576&r1=175575&r2=175576&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=175576&r1=175575&r2=175576&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Feb 19 17:50:45 2013<br>
@@ -389,8 +389,10 @@ bool X86RegisterInfo::hasBasePointer(con<br>
return false;<br>
<br>
// When we need stack realignment and there are dynamic allocas, we can't<br>
- // reference off of the stack pointer, so we reserve a base pointer.<br>
- if (needsStackRealignment(MF) && MFI->hasVarSizedObjects())<br>
+ // reference off of the stack pointer, so we reserve a base pointer. This<br>
+ // is also true if the function contain MS-style inline assembly.<br>
+ if ((needsStackRealignment(MF) && MFI->hasVarSizedObjects()) ||<br>
+ MF.hasMSInlineAsm())<br>
return true;<br>
<br>
return false;<br>
<br>
Modified: llvm/trunk/test/CodeGen/X86/ms-inline-asm.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ms-inline-asm.ll?rev=175576&r1=175575&r2=175576&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ms-inline-asm.ll?rev=175576&r1=175575&r2=175576&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/X86/ms-inline-asm.ll (original)<br>
+++ llvm/trunk/test/CodeGen/X86/ms-inline-asm.ll Tue Feb 19 17:50:45 2013<br>
@@ -103,8 +103,8 @@ entry:<br>
; CHECK: {{## InlineAsm End|#NO_APP}}<br>
; CHECK: {{## InlineAsm Start|#APP}}<br>
; CHECK: .intel_syntax<br>
-; CHECK: mov dword ptr [ebp - 8], edi<br>
+; CHECK: mov dword ptr [esi], edi<br>
; CHECK: .att_syntax<br>
; CHECK: {{## InlineAsm End|#NO_APP}}<br>
-; CHECK: movl -8(%ebp), %eax<br>
+; CHECK: movl (%esi), %eax<br>
}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>