summaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-03-16 09:03:59 +0100
committerJakub Jelinek <jakub@redhat.com>2020-03-16 09:03:59 +0100
commit6d44c881286762628afce5169d921a388ae6a1ff (patch)
tree376e430f555c8c4be0ded35925345b06deb61266 /gcc/tree-inline.c
parent5ba25b2ef179aec8ba4c47612fbc5c388f41cb36 (diff)
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 debug/94167 * tree-inline.c (insert_init_stmt): Don't gimple_regimplify_operands DEBUG_STMTs. * gcc.dg/pr94167.c: New test.
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 59798ec0454..f095795f06f 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3361,10 +3361,10 @@ insert_init_stmt (copy_body_data *id, basic_block bb, gimple *init_stmt)
gimple_assign_set_rhs1 (init_stmt, rhs);
}
gsi_insert_after (&si, init_stmt, GSI_NEW_STMT);
- gimple_regimplify_operands (init_stmt, &si);
-
if (!is_gimple_debug (init_stmt))
{
+ gimple_regimplify_operands (init_stmt, &si);
+
tree def = gimple_assign_lhs (init_stmt);
insert_init_debug_bind (id, bb, def, def, init_stmt);
}