diff options
author | Martin Jambor <mjambor@suse.cz> | 2020-10-19 19:21:10 +0200 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2020-10-19 19:21:10 +0200 |
commit | 619f91eaa8c8a50f1f9d3e7b96ee837037f0e806 (patch) | |
tree | 8c28e2be81ab94d7fd0b751250a9c43d4559fc64 /gcc/tree-complex.c | |
parent | fc77484c4a4feb308c64371233cb65b280333953 (diff) | |
download | gcc-619f91eaa8c8a50f1f9d3e7b96ee837037f0e806.zip gcc-619f91eaa8c8a50f1f9d3e7b96ee837037f0e806.tar.gz gcc-619f91eaa8c8a50f1f9d3e7b96ee837037f0e806.tar.bz2 |
cplxlower: Avoid a transform when looking at a default definition
In PR 97456, IPA-SRA triggers a bug in tree-complex.c where it
converts:
<bb 2>
a$_M_value_21 = COMPLEX_EXPR <ISRA.18_10(D), ISRA.18_10(D)>;
(where ISRA.18 is IPA-SRA created PARM_DECL with DECL_IGNORED_P set,
which is why it only happens with IPA-SRA) into:
<bb 2>
a$_M_value_21 = COMPLEX_EXPR <a$_M_value$real_10(D), a$_M_value$real_10(D)>;
i.e. it replaces two uses of the parameter default-def with two
uninitialized default-defs of a new variable - all in hope to produce
code with better debug info.
This patch fixes it by avoiding the transform when the SSA_NAME to be
replaced is a default definition.
gcc/ChangeLog:
2020-10-19 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/97456
* tree-complex.c (set_component_ssa_name): Do not replace ignored decl
default definitions with new component vars. Reorder if conditions.
gcc/testsuite/ChangeLog:
2020-10-19 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/97456
* gcc.dg/tree-ssa/pr97456.c: New test.
Diffstat (limited to 'gcc/tree-complex.c')
-rw-r--r-- | gcc/tree-complex.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 2e54bbb..f132e0f 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -569,7 +569,8 @@ set_component_ssa_name (tree ssa_name, bool imag_p, tree value) { /* Replace an anonymous base value with the variable from cvc_lookup. This should result in better debug info. */ - if (SSA_NAME_VAR (ssa_name) + if (!SSA_NAME_IS_DEFAULT_DEF (value) + && SSA_NAME_VAR (ssa_name) && (!SSA_NAME_VAR (value) || DECL_IGNORED_P (SSA_NAME_VAR (value))) && !DECL_IGNORED_P (SSA_NAME_VAR (ssa_name))) { |