<div dir="ltr"><div>Could you tell something more about how could a spilledReg be a physical register?</div><div>This is not very clear for me. If a virtual register is to be spilled, then it will</div><div>always be a virtual register, and will be unspilled when it is used. When it may</div>
<div>become a physical register?</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 9, 2013 at 1:23 PM, Ruiling Song <span dir="ltr"><<a href="mailto:ruiling.song@intel.com" target="_blank">ruiling.song@intel.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We can only spill virtual registers, should skip physical register.<br>
This fix random failure of compiler_box_blur when do spilling.<br>
<br>
Signed-off-by: Ruiling Song <<a href="mailto:ruiling.song@intel.com">ruiling.song@intel.com</a>><br>
---<br>
 backend/src/backend/gen_insn_selection.cpp |    7 +++++--<br>
 1 file changed, 5 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp<br>
index 3610051..5cafa98 100644<br>
--- a/backend/src/backend/gen_insn_selection.cpp<br>
+++ b/backend/src/backend/gen_insn_selection.cpp<br>
@@ -628,12 +628,15 @@ namespace gbe<br>
<br>
     for (auto &block : blockList)<br>
       for (auto &insn : block.insnList) {<br>
+        // spill / unspill insn should be skipped when do spilling<br>
+        if(insn.opcode == SEL_OP_SPILL_REG || insn.opcode == SEL_OP_UNSPILL_REG) continue;<br>
+<br>
         const uint32_t srcNum = insn.srcNum, dstNum = insn.dstNum;<br>
<br>
         for (uint32_t srcID = 0; srcID < srcNum; ++srcID) {<br>
           const GenRegister selReg = insn.src(srcID);<br>
           const ir::Register reg = selReg.reg();<br>
-          if(selReg.file == GEN_GENERAL_REGISTER_FILE && reg == spilledReg) {<br>
+          if(reg == spilledReg && selReg.file == GEN_GENERAL_REGISTER_FILE && selReg.physical == 0) {<br>
             GBE_ASSERT(srcID < 5);<br>
             SelectionInstruction *unspill = this->create(SEL_OP_UNSPILL_REG, 1, 0);<br>
             unspill->state  = GenInstructionState(simdWidth);<br>
@@ -652,7 +655,7 @@ namespace gbe<br>
         for (uint32_t dstID = 0; dstID < dstNum; ++dstID) {<br>
           const GenRegister selReg = insn.dst(dstID);<br>
           const ir::Register reg = selReg.reg();<br>
-          if(selReg.file == GEN_GENERAL_REGISTER_FILE && reg == spilledReg) {<br>
+          if(reg == spilledReg && selReg.file == GEN_GENERAL_REGISTER_FILE && selReg.physical == 0) {<br>
             GBE_ASSERT(dstID < 5);<br>
             SelectionInstruction *spill = this->create(SEL_OP_SPILL_REG, 0, 1);<br>
             spill->state  = GenInstructionState(simdWidth);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.9.5<br>
<br>
_______________________________________________<br>
Beignet mailing list<br>
<a href="mailto:Beignet@lists.freedesktop.org">Beignet@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/beignet" target="_blank">http://lists.freedesktop.org/mailman/listinfo/beignet</a><br>
</font></span></blockquote></div><br></div>