diff options
author | Martin Jambor <mjambor@suse.cz> | 2009-10-13 13:31:08 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2009-10-13 13:31:08 +0200 |
commit | c4e5fe4b51a5228f734ddf76e680dd9088d59a55 (patch) | |
tree | c366eb26ee9527581ae826e651347c89c8a66cbd /gcc/ipa-cp.c | |
parent | 3525f49b5a8794cd0b553a53f6d1617cbb6b8c55 (diff) | |
download | gcc-c4e5fe4b51a5228f734ddf76e680dd9088d59a55.zip gcc-c4e5fe4b51a5228f734ddf76e680dd9088d59a55.tar.gz gcc-c4e5fe4b51a5228f734ddf76e680dd9088d59a55.tar.bz2 |
re PR tree-optimization/41661 (ICE due to IPCP trying to create/fold a REAL typed comparision)
2009-10-13 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/41661
* ipa-prop.c (compute_complex_pass_through): Allow only operations
that are tcc_comparisons or do not change the type in any
un-usleless way.
* ipa-cp.c (ipcp_lattice_from_jfunc): Request boolean type when
folding tcc_comparison operations.
* testsuite/gcc.c-torture/compile/pr41661.c: New test.
From-SVN: r152702
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r-- | gcc/ipa-cp.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 59a0519..7e499ca 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -299,9 +299,16 @@ ipcp_lattice_from_jfunc (struct ipa_node_params *info, struct ipcp_lattice *lat, cst = caller_lat->constant; if (jfunc->value.pass_through.operation != NOP_EXPR) - cst = fold_binary (jfunc->value.pass_through.operation, - TREE_TYPE (cst), cst, - jfunc->value.pass_through.operand); + { + tree restype; + if (TREE_CODE_CLASS (jfunc->value.pass_through.operation) + == tcc_comparison) + restype = boolean_type_node; + else + restype = TREE_TYPE (cst); + cst = fold_binary (jfunc->value.pass_through.operation, + restype, cst, jfunc->value.pass_through.operand); + } if (!cst || !is_gimple_ip_invariant (cst)) lat->type = IPA_BOTTOM; lat->constant = cst; |