diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-09 10:05:49 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-09 10:05:49 +0000 |
commit | 2a8d660dd8949db0a6aeaf121cbe5b31a05e1eea (patch) | |
tree | dfe54048f3cb5947e6b5139fc262812481df1e33 /gcc/tree-ssa-ifcombine.c | |
parent | f693aa3a0990458f45e62b7add08e5449e4cf9ca (diff) | |
download | gcc-2a8d660dd8949db0a6aeaf121cbe5b31a05e1eea.tar.gz |
2008-09-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37387
* tree-ssa-ifcombine.c (ifcombine_iforif): Convert the name
and bits to a common type.
* gcc.c-torture/compile/pr37387.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140142 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ifcombine.c')
-rw-r--r-- | gcc/tree-ssa-ifcombine.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index a4a74ee6be4..eedeb62938d 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -440,6 +440,25 @@ ifcombine_iforif (basic_block inner_cond_bb, basic_block outer_cond_bb) else return false; + /* As we strip non-widening conversions in finding a common + name that is tested make sure to end up with an integral + type for building the bit operations. */ + if (TYPE_PRECISION (TREE_TYPE (bits1)) + >= TYPE_PRECISION (TREE_TYPE (bits2))) + { + bits1 = fold_convert (unsigned_type_for (TREE_TYPE (bits1)), bits1); + name1 = fold_convert (TREE_TYPE (bits1), name1); + bits2 = fold_convert (unsigned_type_for (TREE_TYPE (bits2)), bits2); + bits2 = fold_convert (TREE_TYPE (bits1), bits2); + } + else + { + bits2 = fold_convert (unsigned_type_for (TREE_TYPE (bits2)), bits2); + name1 = fold_convert (TREE_TYPE (bits2), name1); + bits1 = fold_convert (unsigned_type_for (TREE_TYPE (bits1)), bits1); + bits1 = fold_convert (TREE_TYPE (bits2), bits1); + } + /* Do it. */ gsi = gsi_for_stmt (inner_cond); t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), bits1, bits2); |