diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-03 19:18:09 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-03 19:18:09 +0000 |
commit | 99db618cc7c5938f85c62b2747c9477ecbbcf18a (patch) | |
tree | 0a355e4712ab8548abe7e365aa96c85ecd240ec6 /gcc/tree-ssa-dom.c | |
parent | 1189258f293a57ef9fc58cd9ce19c833ff71b22c (diff) | |
download | gcc-99db618cc7c5938f85c62b2747c9477ecbbcf18a.tar.gz |
PR tree-optimization/56799
* tree-ssa-dom.c (record_equivalences_from_incoming_edge): Bring
back test for widening conversion erroneously dropped in prior
change.
PR tree-optimization/56799
* gcc.c-torture/execute/pr56799.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197453 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r-- | gcc/tree-ssa-dom.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 29d2bb4f3e1..d98a646aa4f 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1151,9 +1151,15 @@ record_equivalences_from_incoming_edge (basic_block bb) { tree old_rhs = gimple_assign_rhs1 (defstmt); - /* If the constant is in the range of the type of OLD_RHS, - then convert the constant and record the equivalence. */ + /* If the conversion widens the original value and + the constant is in the range of the type of OLD_RHS, + then convert the constant and record the equivalence. + + Note that int_fits_type_p does not check the precision + if the upper and lower bounds are OK. */ if (INTEGRAL_TYPE_P (TREE_TYPE (old_rhs)) + && (TYPE_PRECISION (TREE_TYPE (lhs)) + > TYPE_PRECISION (TREE_TYPE (old_rhs))) && int_fits_type_p (rhs, TREE_TYPE (old_rhs))) { tree newval = fold_convert (TREE_TYPE (old_rhs), rhs); |