diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-04-11 19:19:56 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-04-11 19:19:56 +0200 |
commit | 8585103f053ef26a5939ec7c3a08ad77f70d2c3c (patch) | |
tree | d8c8096f0932ccc2f3c7ac4ddb1d3230bfa9f602 /gcc/simplify-rtx.c | |
parent | fbc698e0f4c35b3d16127682636bd141fad1d369 (diff) | |
download | gcc-8585103f053ef26a5939ec7c3a08ad77f70d2c3c.zip gcc-8585103f053ef26a5939ec7c3a08ad77f70d2c3c.tar.gz gcc-8585103f053ef26a5939ec7c3a08ad77f70d2c3c.tar.bz2 |
re PR rtl-optimization/80385 (Segfault in commutative_operand_precedence() rtlanal.c:3373)
PR rtl-optimization/80385
* simplify-rtx.c (simplify_unary_operation_1): Don't transform
(not (neg X)) into (plus X -1) for complex or non-integral modes.
* g++.dg/opt/pr80385.C: New test.
From-SVN: r246850
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index cff7e4d..4bbbe23 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -932,8 +932,10 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) && XEXP (op, 1) == constm1_rtx) return simplify_gen_unary (NEG, mode, XEXP (op, 0), mode); - /* Similarly, (not (neg X)) is (plus X -1). */ - if (GET_CODE (op) == NEG) + /* Similarly, (not (neg X)) is (plus X -1). Only do this for + modes that have CONSTM1_RTX, i.e. MODE_INT, MODE_PARTIAL_INT + and MODE_VECTOR_INT. */ + if (GET_CODE (op) == NEG && CONSTM1_RTX (mode)) return simplify_gen_binary (PLUS, mode, XEXP (op, 0), CONSTM1_RTX (mode)); |