diff options
author | renlin <renlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-13 08:29:46 +0000 |
---|---|---|
committer | renlin <renlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-13 08:29:46 +0000 |
commit | 1c504cbdad2cfebaf61606a4582d1c2e9c617d5c (patch) | |
tree | 122ee52482e8bebf65203d2169c8eac27aaa1b40 /gcc/simplify-rtx.c | |
parent | 9f82fcbcee9f533f2fcdaff88fe16654ff9ea117 (diff) | |
download | gcc-1c504cbdad2cfebaf61606a4582d1c2e9c617d5c.tar.gz |
[PATCH]Fix PR66556. Don't drop side-effect in
simplify_const_relational_operation function.
gcc/
2015-07-13 Renlin Li <renlin.li@arm.com>
PR rtl/66556
* simplify-rtx.c (simplify_const_relational_operation): Add
side_effects_p checks.
gcc/testsuite/
2015-07-13 Renlin Li <renlin.li@arm.com>
PR rtl/66556
* gcc.c-torture/execute/pr66556.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225729 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index c243080be26..91e4b9ca0ce 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -4925,7 +4925,8 @@ simplify_const_relational_operation (enum rtx_code code, /* Optimize comparisons with upper and lower bounds. */ if (HWI_COMPUTABLE_MODE_P (mode) - && CONST_INT_P (trueop1)) + && CONST_INT_P (trueop1) + && !side_effects_p (trueop0)) { int sign; unsigned HOST_WIDE_INT nonzero = nonzero_bits (trueop0, mode); @@ -5038,7 +5039,7 @@ simplify_const_relational_operation (enum rtx_code code, } /* Optimize integer comparisons with zero. */ - if (trueop1 == const0_rtx) + if (trueop1 == const0_rtx && !side_effects_p (trueop0)) { /* Some addresses are known to be nonzero. We don't know their sign, but equality comparisons are known. */ @@ -5089,7 +5090,7 @@ simplify_const_relational_operation (enum rtx_code code, } /* Optimize comparison of ABS with zero. */ - if (trueop1 == CONST0_RTX (mode) + if (trueop1 == CONST0_RTX (mode) && !side_effects_p (trueop0) && (GET_CODE (trueop0) == ABS || (GET_CODE (trueop0) == FLOAT_EXTEND && GET_CODE (XEXP (trueop0, 0)) == ABS))) |