On 4/1/07, David Daney <[EMAIL PROTECTED]> wrote:
The issue is that for some things (the java front-end) we need the trapping behavior. I just want to optimize it if the divisor is known to be non-zero. VRP knows, but by the time we generate the code it seems that we have forgotten.
The java front-end as far as I know emits a functon call always for targets that don't trap on divide by zero. And as far as I know that is the x86 back-end which is the only target which traps really on divide by zero. If the Java front-end really exposed this by inling the exception/value, then VRP on the tree level would catch it right away. Also I don't know what you mean by there is no option to disable the target expansion of trap on divide by zero: mcheck-zero-division Target Report Mask(CHECK_ZERO_DIV) Trap on integer divide by zero So you can force -mno-check-zero-division for Java and don't disable use-divide-subroutine really. It seems wrong that the java front-end thinks we don't have to use the divide subroutine for MIPS. Really I think it is wrong that the mips back-end thinks it should enable by default trap on divide by zero. Maybe one of the MIPS maintainers can explain why this option exists in the first place. As far as I can tell this has option has existed before the egcs/gcc split. I still say the back-end should not worry about this and divide by zero should always be declared as undefined. -- Pinski