]> granicus.if.org Git - php/commitdiff
Add more hints for register allocator
authorDmitry Stogov <dmitry@zend.com>
Wed, 7 Oct 2020 17:38:52 +0000 (20:38 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 7 Oct 2020 17:38:52 +0000 (20:38 +0300)
ext/opcache/jit/zend_jit.c
ext/opcache/jit/zend_jit_trace.c

index c522ab8c1413597eb0a906522054247dd4175e76..f5369cd06fd6a8ec32f722ccc91c4a5b1d49d840 100644 (file)
@@ -1367,6 +1367,27 @@ static int zend_jit_compute_liveness(const zend_op_array *op_array, zend_ssa *ss
                                                                zend_jit_add_hint(intervals, i, ssa->ops[line].op2_use);
                                                        }
                                                        break;
+                                               case ZEND_SUB:
+                                               case ZEND_ADD:
+                                               case ZEND_MUL:
+                                               case ZEND_BW_OR:
+                                               case ZEND_BW_AND:
+                                               case ZEND_BW_XOR:
+                                                       if (i == ssa->ops[line].result_def) {
+                                                               if (ssa->ops[line].op1_use >= 0 &&
+                                                                   intervals[ssa->ops[line].op1_use] &&
+                                                                   ssa->ops[line].op1_use_chain < 0 &&
+                                                                   !ssa->vars[ssa->ops[line].op1_use].phi_use_chain) {
+                                                                       zend_jit_add_hint(intervals, i, ssa->ops[line].op1_use);
+                                                               } else if (opline->opcode != ZEND_SUB &&
+                                                                   ssa->ops[line].op2_use >= 0 &&
+                                                                   intervals[ssa->ops[line].op2_use] &&
+                                                                   ssa->ops[line].op2_use_chain < 0 &&
+                                                                   !ssa->vars[ssa->ops[line].op2_use].phi_use_chain) {
+                                                                       zend_jit_add_hint(intervals, i, ssa->ops[line].op2_use);
+                                                               }
+                                                       }
+                                                       break;
                                        }
                                }
                        }
index ae7abf27eccb9f38a7cf4bb6e509ec28efc7a312..394b2b69a42b53b06ff9eb05686536db51ba0073 100644 (file)
@@ -2643,6 +2643,27 @@ static zend_lifetime_interval** zend_jit_trace_allocate_registers(zend_jit_trace
                                                        zend_jit_add_hint(intervals, i, ssa->ops[line].op2_use);
                                                }
                                                break;
+                                       case ZEND_SUB:
+                                       case ZEND_ADD:
+                                       case ZEND_MUL:
+                                       case ZEND_BW_OR:
+                                       case ZEND_BW_AND:
+                                       case ZEND_BW_XOR:
+                                               if (i == ssa->ops[line].result_def) {
+                                                       if (ssa->ops[line].op1_use >= 0 &&
+                                                           intervals[ssa->ops[line].op1_use] &&
+                                                           ssa->ops[line].op1_use_chain < 0 &&
+                                                           !ssa->vars[ssa->ops[line].op1_use].phi_use_chain) {
+                                                               zend_jit_add_hint(intervals, i, ssa->ops[line].op1_use);
+                                                       } else if (opline->opcode != ZEND_SUB &&
+                                                           ssa->ops[line].op2_use >= 0 &&
+                                                           intervals[ssa->ops[line].op2_use] &&
+                                                           ssa->ops[line].op2_use_chain < 0 &&
+                                                           !ssa->vars[ssa->ops[line].op2_use].phi_use_chain) {
+                                                               zend_jit_add_hint(intervals, i, ssa->ops[line].op2_use);
+                                                       }
+                                               }
+                                               break;
                                }
                        }
                }