This fixes
FAIL: gcc.c-torture/execute/20101011-1.c -O2 execution test
FAIL: gcc.c-torture/execute/20101011-1.c -O2 -flto -fno-use-linker-plugin -
flto-partition=none execution test
FAIL: gcc.c-torture/execute/20101011-1.c -O2 -flto -fuse-linker-plugin -fno-
fat-lto-objects execution test
FAIL: gcc.c-torture/execute/20101011-1.c -O3 -g execution test
FAIL: gcc.c-torture/execute/20101011-1.c -Os execution test
on 64-bit SPARC with -mcpu=niagara. There is exactly the same guard a few
lines below for the DIV case.
Tested on SPARC64/Linux and x86-64/Linux, applied on the mainline.
2017-06-14 Eric Botcazou <ebotca...@adacore.com>
* simplify-rtx.c (simplify_binary_operation_1) <UDIV>: Do not simplify
a division of 0 if non-call exceptions are enabled.
--
Eric Botcazou
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c (revision 249091)
+++ simplify-rtx.c (working copy)
@@ -3194,7 +3194,8 @@ simplify_binary_operation_1 (enum rtx_co
case UDIV:
/* 0/x is 0 (or x&0 if x has side-effects). */
- if (trueop0 == CONST0_RTX (mode))
+ if (trueop0 == CONST0_RTX (mode)
+ && !cfun->can_throw_non_call_exceptions)
{
if (side_effects_p (op1))
return simplify_gen_binary (AND, mode, op1, trueop0);