diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-13 07:58:05 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-13 07:58:05 +0000 |
commit | 65f73697e58df78e0313f8cd34e9434e5e84432f (patch) | |
tree | f3f3e955cc37835a4a5c65ea164c26f86aee90a4 /gcc/gimple-fold.c | |
parent | e43f6e8c87006538711c1d1e2b88100781b4d252 (diff) | |
download | gcc-65f73697e58df78e0313f8cd34e9434e5e84432f.tar.gz |
2014-10-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/63419
* gimple-fold.h (gimple_convert): New function.
* gimple-fold.c (gimple_convert): Likewise.
* tree-ssa-pre.c (create_expression_by_pieces): Use gimple_convert
to split out required conversions early.
* g++.dg/torture/pr63419.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216138 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 76441c746bc..a0ce0db9766 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -5295,3 +5295,20 @@ rewrite_to_defined_overflow (gimple stmt) return stmts; } + +/* Return OP converted to TYPE by emitting a conversion statement on SEQ + if required using location LOC. Note that OP will be returned + unmodified if GIMPLE does not require an explicit conversion between + its type and TYPE. */ + +tree +gimple_convert (gimple_seq *seq, location_t loc, tree type, tree op) +{ + if (useless_type_conversion_p (type, TREE_TYPE (op))) + return op; + op = fold_convert_loc (loc, type, op); + gimple_seq stmts = NULL; + op = force_gimple_operand (op, &stmts, true, NULL_TREE); + gimple_seq_add_seq_without_update (seq, stmts); + return op; +} |