Fix the bug in removeLOADIs function.
authorJunyan He <junyan.he@linux.intel.com>
Wed, 22 Jan 2014 06:02:30 +0000 (14:02 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Sun, 26 Jan 2014 09:03:52 +0000 (17:03 +0800)
The logic for replacing the dst of the instruction
using the src number and getSrc. Fix this problem.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/llvm/llvm_gen_backend.cpp

index 6d61f90..c6948da 100644 (file)
@@ -1355,7 +1355,7 @@ namespace gbe
         // substitutions (if any)
         else {
           const uint32_t srcNum = insn.getSrcNum();
-          const uint32_t dstNum = insn.getSrcNum();
+          const uint32_t dstNum = insn.getDstNum();
           for (uint32_t srcID = 0; srcID < srcNum; ++srcID) {
             const ir::Register src = insn.getSrc(srcID);
             auto it = immTranslate.find(src);
@@ -1363,7 +1363,7 @@ namespace gbe
               insn.setSrc(srcID, it->second);
           }
           for (uint32_t dstID = 0; dstID < dstNum; ++dstID) {
-            const ir::Register dst = insn.getSrc(dstID);
+            const ir::Register dst = insn.getDst(dstID);
             auto it = immTranslate.find(dst);
             if (it != immTranslate.end())
               insn.setDst(dstID, it->second);