浏览代码

Simplify 'RV(CNV(val))' to 'val'

jonathanvdc 8 年之前
父节点
当前提交
a1521fa838
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      kernel/modelverse_jit/tree_ir.py

+ 5 - 1
kernel/modelverse_jit/tree_ir.py

@@ -601,7 +601,11 @@ class ReadValueInstruction(StateInstruction):
 
     def simplify(self):
         """Applies basic simplification to this instruction and its children."""
-        return ReadValueInstruction(self.node_id.simplify())
+        simplified_node_id = self.node_id.simplify()
+        if isinstance(simplified_node_id, CreateNodeWithValueInstruction):
+            return simplified_node_id.value
+        else:
+            return ReadValueInstruction(simplified_node_id)
 
     def get_opcode(self):
         """Gets the opcode for this state instruction."""