aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ifcvt.c4
-rw-r--r--gcc/testsuite/g++.dg/opt/pr100852.C25
2 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 6ee44cb..d086ce8 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -2398,7 +2398,7 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
rtx_insn *prev_insn;
/* First, look to see if we put a constant in a register. */
- prev_insn = prev_nonnote_insn (if_info->cond_earliest);
+ prev_insn = prev_nonnote_nondebug_insn (if_info->cond_earliest);
if (prev_insn
&& BLOCK_FOR_INSN (prev_insn)
== BLOCK_FOR_INSN (if_info->cond_earliest)
@@ -2669,7 +2669,7 @@ noce_try_abs (struct noce_if_info *if_info)
if (REG_P (c))
{
rtx set;
- rtx_insn *insn = prev_nonnote_insn (earliest);
+ rtx_insn *insn = prev_nonnote_nondebug_insn (earliest);
if (insn
&& BLOCK_FOR_INSN (insn) == BLOCK_FOR_INSN (earliest)
&& (set = single_set (insn))
diff --git a/gcc/testsuite/g++.dg/opt/pr100852.C b/gcc/testsuite/g++.dg/opt/pr100852.C
new file mode 100644
index 0000000..9d9a9f0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr100852.C
@@ -0,0 +1,25 @@
+// PR debug/100852
+// { dg-do compile }
+// { dg-options "-Og -fif-conversion -fno-tree-ccp -fno-tree-copy-prop -fcompare-debug" }
+
+static inline int
+min (unsigned a, int b)
+{
+ return a < b ? a : b;
+}
+
+struct S { S (char); };
+
+static inline S
+foo (unsigned x)
+{
+ int h;
+ h += min (x * 4, h);
+ return h;
+}
+
+void
+bar ()
+{
+ foo (0);
+}