File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -358,19 +358,33 @@ is_alloc_candidate(JitCompContext *cc, JitReg reg)
358358static void
359359check_vreg_definition (RegallocContext * rc , JitInsn * insn )
360360{
361- unsigned j ;
362361 JitRegVec regvec = jit_insn_opnd_regs (insn );
363- unsigned first_use = jit_insn_opnd_first_use ( insn ) ;
362+ unsigned i ;
364363 JitReg * regp ;
364+ unsigned first_use = jit_insn_opnd_first_use (insn );
365+ JitReg reg_defined ;
365366
366367 /* check if there is the definition of an vr before its references */
367- JIT_REG_VEC_FOREACH_USE (regvec , j , regp , first_use )
368+ JIT_REG_VEC_FOREACH (regvec , i , regp )
368369 {
369370 VirtualReg * vr = NULL ;
370371
371372 if (!is_alloc_candidate (rc -> cc , * regp ))
372373 continue ;
373374
375+ /*a strong assumption that there is only on defined reg*/
376+ if (i < first_use ) {
377+ reg_defined = * regp ;
378+ continue ;
379+ }
380+
381+ /**
382+ * both definition and references are in one instruction,
383+ * like MOV i3,i3
384+ **/
385+ if (reg_defined == * regp )
386+ continue ;
387+
374388 vr = rc_get_vr (rc , * regp );
375389 bh_assert (vr -> distances );
376390 }
You can’t perform that action at this time.
0 commit comments