[Beignet] [PATCH V2 2/3] fix a potential issue of SEL IR optimization when subphysical is true

Guo Yejun yejun.guo at intel.com
Tue Feb 23 20:14:36 UTC 2016


here is an example:
 mov %10, %9.0
 mov %11, %9.1
 ...
 mov %9, %8

both %9.0 and %9.1 are collected into replacement in the ReplaceInfoMap
after the first two insts are scanned. When scan the last inst that %9
is overwritten, we should flag both %9.0 and %9.1 in the map.

Signed-off-by: Guo Yejun <yejun.guo at intel.com>
---
 backend/src/backend/gen_insn_selection_optimize.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/backend/src/backend/gen_insn_selection_optimize.cpp b/backend/src/backend/gen_insn_selection_optimize.cpp
index 6be2468..35da404 100644
--- a/backend/src/backend/gen_insn_selection_optimize.cpp
+++ b/backend/src/backend/gen_insn_selection_optimize.cpp
@@ -141,8 +141,16 @@ namespace gbe
         return;
       }
       if (info->replacement.reg() == var.reg()) {  //replacement is overwritten
+        //there could be more than one replacements (with different physical subnr) overwritten,
+        //so do not break here, need to scann the whole map.
+        //here is an example:
+        // mov %10, %9.0
+        // mov %11, %9.1
+        // ...
+        // mov %9, %8
+        //both %9.0 and %9.1 are collected into replacement in the ReplaceInfoMap after the first two insts are scanned.
+        //when scan the last inst that %9 is overwritten, we should flag both %9.0 and %9.1 in the map.
         info->replacementOverwritten = true;
-        return;
       }
     }
   }
-- 
1.9.1



More information about the Beignet mailing list