diff options
author | Richard Biener <rguenther@suse.de> | 2020-08-04 14:10:45 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-08-04 15:29:19 +0200 |
commit | 1af5cdd77985daf76130f527deac425c43df9f49 (patch) | |
tree | b9f60d270eeda2fded7364104ac18674414d3c9b /gcc/tree-ssa-pre.c | |
parent | 7bd72dd5a385dfa6d49cfe640cefc9ed187361d3 (diff) | |
download | gcc-1af5cdd77985daf76130f527deac425c43df9f49.zip gcc-1af5cdd77985daf76130f527deac425c43df9f49.tar.gz gcc-1af5cdd77985daf76130f527deac425c43df9f49.tar.bz2 |
tree-optimization/88240 - stopgap for floating point code-hoisting issues
This adds a stopgap measure to avoid performing code-hoisting
on mixed type loads when the load we'd insert in the hoisting
position would be a floating point one. This is because certain
targets (hello x87) cannot perform floating point loads without
possibly altering the bit representation and thus cannot be used
in place of integral loads.
2020-08-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/88240
* tree-ssa-sccvn.h (vn_reference_s::punned): New flag.
* tree-ssa-sccvn.c (vn_reference_insert): Initialize punned.
(vn_reference_insert_pieces): Likewise.
(visit_reference_op_call): Likewise.
(visit_reference_op_load): Track whether a ref was punned.
* tree-ssa-pre.c (do_hoist_insertion): Refuse to perform hoist
insertion on punned floating point loads.
* gcc.target/i386/pr88240.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 0c1654f..7d67305 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -3571,6 +3571,16 @@ do_hoist_insertion (basic_block block) continue; } + /* If we end up with a punned expression representation and this + happens to be a float typed one give up - we can't know for + sure whether all paths perform the floating-point load we are + about to insert and on some targets this can cause correctness + issues. See PR88240. */ + if (expr->kind == REFERENCE + && PRE_EXPR_REFERENCE (expr)->punned + && FLOAT_TYPE_P (get_expr_type (expr))) + continue; + /* OK, we should hoist this value. Perform the transformation. */ pre_stats.hoist_insert++; if (dump_file && (dump_flags & TDF_DETAILS)) |