aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-12-14 20:40:05 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-12-14 20:40:05 +0100
commit53cfcb2e281f62ed8ea272846cf4971f2b0df229 (patch)
tree3a8f07bc391a8e8a2435cdfbce0090522f1158cb /gcc/combine.c
parent474da67ef9ec3658e4da9deb5373353532b2a840 (diff)
downloadgcc-53cfcb2e281f62ed8ea272846cf4971f2b0df229.zip
gcc-53cfcb2e281f62ed8ea272846cf4971f2b0df229.tar.gz
gcc-53cfcb2e281f62ed8ea272846cf4971f2b0df229.tar.bz2
re PR debug/77844 (Compilation of simple C++ example exhaust memory)
PR debug/77844 * valtrack.c: Include rtl-iter.h. (struct rtx_subst_pair): Add insn field. (propagate_for_debug_subst): If pair->to contains at least 2 regs, create a DEBUG_INSN with a debug temp before pair->insn and replace from with the debug temp instead of pair->to. (propagate_for_debug): Initialize p.insn. * combine.c (insn_uid_check): New inline function. (INSN_COST, LOG_LINKS): Use it instead of INSN_UID. (find_single_use, combine_instructions, cant_combine_insn_p, try_combine): Use NONDEBUG_INSN_P instead of INSN_P. * g++.dg/opt/pr77844.C: New test. From-SVN: r243662
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 19851a2..473ffc4 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -327,8 +327,16 @@ struct insn_link {
static struct insn_link **uid_log_links;
-#define INSN_COST(INSN) (uid_insn_cost[INSN_UID (INSN)])
-#define LOG_LINKS(INSN) (uid_log_links[INSN_UID (INSN)])
+static inline int
+insn_uid_check (const_rtx insn)
+{
+ int uid = INSN_UID (insn);
+ gcc_checking_assert (uid <= max_uid_known);
+ return uid;
+}
+
+#define INSN_COST(INSN) (uid_insn_cost[insn_uid_check (INSN)])
+#define LOG_LINKS(INSN) (uid_log_links[insn_uid_check (INSN)])
#define FOR_EACH_LOG_LINK(L, INSN) \
for ((L) = LOG_LINKS (INSN); (L); (L) = (L)->next)
@@ -676,7 +684,7 @@ find_single_use (rtx dest, rtx_insn *insn, rtx_insn **ploc)
for (next = NEXT_INSN (insn);
next && BLOCK_FOR_INSN (next) == bb;
next = NEXT_INSN (next))
- if (INSN_P (next) && dead_or_set_p (next, dest))
+ if (NONDEBUG_INSN_P (next) && dead_or_set_p (next, dest))
{
FOR_EACH_LOG_LINK (link, next)
if (link->insn == insn && link->regno == REGNO (dest))
@@ -1127,7 +1135,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
int new_direct_jump_p = 0;
- for (first = f; first && !INSN_P (first); )
+ for (first = f; first && !NONDEBUG_INSN_P (first); )
first = NEXT_INSN (first);
if (!first)
return 0;
@@ -2275,7 +2283,7 @@ cant_combine_insn_p (rtx_insn *insn)
/* If this isn't really an insn, we can't do anything.
This can occur when flow deletes an insn that it has merged into an
auto-increment address. */
- if (! INSN_P (insn))
+ if (!NONDEBUG_INSN_P (insn))
return 1;
/* Never combine loads and stores involving hard regs that are likely
@@ -4178,7 +4186,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
|| insn != BB_HEAD (this_basic_block->next_bb));
insn = NEXT_INSN (insn))
{
- if (INSN_P (insn) && reg_referenced_p (ni2dest, PATTERN (insn)))
+ if (NONDEBUG_INSN_P (insn)
+ && reg_referenced_p (ni2dest, PATTERN (insn)))
{
FOR_EACH_LOG_LINK (link, insn)
if (link->insn == i3)
@@ -4319,9 +4328,9 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
for (temp_insn = NEXT_INSN (i2);
temp_insn
&& (this_basic_block->next_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
- || BB_HEAD (this_basic_block) != temp_insn);
+ || BB_HEAD (this_basic_block) != temp_insn);
temp_insn = NEXT_INSN (temp_insn))
- if (temp_insn != i3 && INSN_P (temp_insn))
+ if (temp_insn != i3 && NONDEBUG_INSN_P (temp_insn))
FOR_EACH_LOG_LINK (link, temp_insn)
if (link->insn == i2)
link->insn = i3;