compiler.cfg.two-operand: if last instruction in a basic block is an overflowing arithmetic op of the form x = y op x, we now convert it correctly. This fixes compiler regression with benchmark.dawes after recent coalescing changes

db4
Slava Pestov 2009-08-01 23:50:47 -05:00
parent e01fc93812
commit 9bde92220b
2 changed files with 6 additions and 17 deletions
basis/compiler/cfg/two-operand

View File

@ -27,19 +27,12 @@ compiler.cfg.registers cpu.architecture namespaces tools.test ;
[
V{
T{ ##copy f V int-regs 4 V int-regs 2 }
T{ ##sub f V int-regs 4 V int-regs 4 V int-regs 1 }
T{ ##copy f V int-regs 1 V int-regs 4 }
T{ ##copy f V int-regs 4 V int-regs 1 }
T{ ##copy f V int-regs 1 V int-regs 2 }
T{ ##sub f V int-regs 1 V int-regs 1 V int-regs 4 }
}
] [
{
T{ ##sub f V int-regs 1 V int-regs 2 V int-regs 1 }
} (convert-two-operand)
] unit-test
! This should never come up after coalescing
[
V{
T{ ##fixnum-add f V int-regs 2 V int-regs 4 V int-regs 2 }
} (convert-two-operand)
] must-fail

View File

@ -65,15 +65,11 @@ GENERIC: convert-two-operand* ( insn -- )
: case-2? ( insn -- ? ) [ dst>> ] [ src2>> ] bi = ; inline
ERROR: bad-case-2 insn ;
: case-2 ( insn -- )
! This can't work with a ##fixnum-overflow since it branches
dup ##fixnum-overflow? [ bad-case-2 ] when
dup dst>> reg-class>> next-vreg
[ swap src1>> emit-copy ]
[ [ >>src1 ] [ >>dst ] bi , ]
[ [ src2>> ] dip emit-copy ]
[ swap src2>> emit-copy ]
[ drop [ src2>> ] [ src1>> ] bi emit-copy ]
[ >>src2 dup dst>> >>src1 , ]
2tri ; inline
: case-3 ( insn -- )