<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 19, 2015 at 4:32 PM Dan Gohman <<a href="mailto:sunfish@mozilla.com">sunfish@mozilla.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 19, 2015 at 2:38 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
+  // FIXME: If scheduling has moved an ARGUMENT virtual register, move it back,<br>
+  // and recompute liveness. This is a temporary hack.<br>
+  bool SawNonArg = false;<br>
+  bool MovedArg = false;<br>
+  MachineBasicBlock &EntryMBB = MF.front();<br>
+  for (auto MII = EntryMBB.begin(); MII != EntryMBB.end(); ) {<br>
+    MachineInstr *MI = &*MII++;<br>
+    if (MI->getOpcode() == WebAssembly::ARGUMENT_I32 ||<br>
+        MI->getOpcode() == WebAssembly::ARGUMENT_I64 ||<br>
+        MI->getOpcode() == WebAssembly::ARGUMENT_F32 ||<br>
+        MI->getOpcode() == WebAssembly::ARGUMENT_F64) {<br>
+      EntryMBB.insert(EntryMBB.begin(), MI->removeFromParent());<br>
+      if (SawNonArg)<br>
+        MovedArg = true;<br>
+    } else {<br>
+      SawNonArg = true;<br>
+    }<br>
+  }<br>
+  if (MovedArg) {<br>
+    SlotIndexes &Slots = getAnalysis<SlotIndexes>();<br>
+    Liveness->releaseMemory();<br>
+    Slots.releaseMemory();<br>
+    Slots.runOnMachineFunction(MF);<br>
+    Liveness->runOnMachineFunction(MF);<br>
+  }<br><br></blockquote><div><br></div></div></div><div>How temporary is this and do you plan on making the arguments non-schedulable? (Which is arguably what should be happening right? They should be the equivalent to an alloca yes?)</div></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I already wrote code to replace it: <a href="http://reviews.llvm.org/D14750" target="_blank">http://reviews.llvm.org/D14750</a> . If that patch isn't accepted, I'll go back to the drawing board to find some other way to pin the instructions to the top of the block. I don't yet have an idea for doing this, but it would be a high priority to find one.<br></div></div></div></div></blockquote><div><br></div><div>Makes sense. I'm curious on the difference between this and using an alloca to do the same work?</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Dan<br><br></div></div></div></div></blockquote></div></div>