diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-03-16 09:02:21 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-03-16 09:02:21 +0100 |
commit | 5ba25b2ef179aec8ba4c47612fbc5c388f41cb36 (patch) | |
tree | 23fdb3f9e13792ab0578b94026f8b77b6c7c5518 /gcc/tree-ssa-reassoc.c | |
parent | e4e9a59105a81cdd6c1328b0a5ed9fe4cc82840e (diff) | |
download | gcc-5ba25b2ef179aec8ba4c47612fbc5c388f41cb36.zip gcc-5ba25b2ef179aec8ba4c47612fbc5c388f41cb36.tar.gz gcc-5ba25b2ef179aec8ba4c47612fbc5c388f41cb36.tar.bz2 |
tree-inline: Fix a -fcompare-debug issue in the inliner [PR94167]
The following testcase fails with -fcompare-debug. The problem is that
bar is marked as address_taken only with -g and not without.
I've tracked it down to insert_init_stmt calling gimple_regimplify_operands
even on DEBUG_STMTs. That function will just insert normal stmts before
the DEBUG_STMT if the DEBUG_STMT operand isn't gimple val or invariant.
While DCE will turn those statements into debug temporaries, it can cause
differences in SSA_NAMEs and more importantly, the ipa references are
generated from those before the DCE happens.
On the testcase, the DEBUG_STMT value is (int)bar.
We could generate DEBUG_STMTs with debug temporaries instead, but I fail to
see the reason to do that, DEBUG_STMTs allow other expressions and all we
want to ensure is that the expressions aren't too large (arbitrarily
complex), but during inlining/function versioning I don't see why something
would queue a DEBUG_STMT with arbitrarily complex expressions in there.
2020-03-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/94166
* tree-ssa-reassoc.c (sort_by_mach_mode): Use SSA_NAME_VERSION
as secondary comparison key.
* gcc.dg/pr94166.c: New test.
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 359ccae..79871a8 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1793,8 +1793,11 @@ sort_by_mach_mode (const void *p_i, const void *p_j) return 1; else if (mode1 < mode2) return -1; - else - return 0; + if (SSA_NAME_VERSION (tr1) < SSA_NAME_VERSION (tr2)) + return -1; + else if (SSA_NAME_VERSION (tr1) > SSA_NAME_VERSION (tr2)) + return 1; + return 0; } /* Cleanup hash map for VECTOR information. */ |