<a class="GWVZpf f1" id="IloFPc-0" href="mailto:scallanan@apple.com" tabindex="-1">+Sean Callanan</a> <div><br></div><div>I couldn't include you on the Phabricator issue Sean, so I'm CC'ing you directly. PTAL<br><br><div class="gmail_quote">On Tue Jan 06 2015 at 3:45:04 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">MS ABI guard variables end with @4IA, so this patch teaches the interpreter about that. Additionally, there was an issue with TurnGuardLoadIntoZero which was causing some guard uses of a variable to be missed. This fixes that by calling Instruction::<u></u>replaceAllUsesWith() instead of trying to replicate that function.<br>
<br>
This fixes between 8 and 10 tests on Windows, and in particular fixes evaluation of C / C++ local variables.<br>
<br>
<a href="http://reviews.llvm.org/D6859" target="_blank">http://reviews.llvm.org/D6859</a><br>
<br>
Files:<br>
source/Expression/IRForTarget.<u></u>cpp<br>
<br>
Index: source/Expression/IRForTarget.<u></u>cpp<br>
==============================<u></u>==============================<u></u>=======<br>
--- source/Expression/IRForTarget.<u></u>cpp<br>
+++ source/Expression/IRForTarget.<u></u>cpp<br>
@@ -2043,8 +2043,12 @@<br>
<br>
GlobalVariable *GV = dyn_cast<GlobalVariable>(Old);<br>
<br>
- if (!GV || !GV->hasName() || !GV->getName().startswith("_<u></u>ZGV"))<br>
+ if (!GV || !GV->hasName() ||<br>
+ (!GV->getName().startswith("_<u></u>ZGV") && // Itanium ABI guard variable<br>
+ !GV->getName().endswith("@4IA"<u></u>))) // Microsoft ABI guard variable<br>
+ {<br>
return false;<br>
+ }<br>
<br>
return true;<br>
}<br>
@@ -2052,20 +2056,8 @@<br>
void<br>
IRForTarget::<u></u>TurnGuardLoadIntoZero(llvm::<u></u>Instruction* guard_load)<br>
{<br>
- Constant* zero(ConstantInt::get(Type::<u></u>getInt8Ty(m_module-><u></u>getContext()), 0, true));<br>
-<br>
- for (llvm::User *u : guard_load->users())<br>
- {<br>
- if (isa<Constant>(u))<br>
- {<br>
- // do nothing for the moment<br>
- }<br>
- else<br>
- {<br>
- u->replaceUsesOfWith(guard_<u></u>load, zero);<br>
- }<br>
- }<br>
-<br>
+ Constant *zero(Constant::getNullValue(<u></u>guard_load->getType()));<br>
+ guard_load-><u></u>replaceAllUsesWith(zero);<br>
guard_load->eraseFromParent();<br>
}<br>
<br>
EMAIL PREFERENCES<br>
<a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/<u></u>settings/panel/<u></u>emailpreferences/</a><br>
</blockquote></div></div>