GBE: don't emit jmpi to next label.
authorZhigang Gong <zhigang.gong@intel.com>
Thu, 27 Mar 2014 05:30:00 +0000 (13:30 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Tue, 8 Apr 2014 08:21:33 +0000 (16:21 +0800)
As the following if will do the same thing, don't need to
add the jmpi instruction.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Reviewed-by: "Song, Ruiling" <ruiling.song@intel.com>
backend/src/backend/gen_insn_selection.cpp

index 560d3dc..a7baf72 100644 (file)
@@ -3045,7 +3045,11 @@ namespace gbe
         sel.pop();
       }
       else {
-        if (sel.ctx.hasJIP(&insn)) {
+        if (sel.ctx.hasJIP(&insn) &&
+            // If jump to next label and the endif offset is -1, then
+            // We don't need to add a jmpi here, as the following IF will do the same
+            // thing if all channels are disabled.
+            (jip != nextLabel || sel.block->endifOffset != -1)) {
           // If it is required, insert a JUMP to bypass the block
           sel.push();
             if (simdWidth == 8)