cprop: Fix -fcompare-debug bug in constprop_register [PR100148]
authorJakub Jelinek <jakub@redhat.com>
Wed, 21 Apr 2021 10:31:45 +0000 (12:31 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 21 Apr 2021 10:31:45 +0000 (12:31 +0200)
commit022f6ee3ad67ee30f62c8c2aeeb4156494f3284e
tree72c8a4621724009714cea62bfcdc505f82f1b0b3
parent021607e12cb9c40d0859b78490f44bb3f7da5812
cprop: Fix -fcompare-debug bug in constprop_register [PR100148]

The following testcase shows different behavior between -g and -g0
in constprop_register, if a flags register setter is separated
from a conditional jump using those flags with -g by a DEBUG_INSN.
As it uses just NEXT_INSN, for -g it will look at the DEBUG_INSN which is
not a conditional jump, while otherwise it would look at the conditional
jump and call cprop_jump.

2021-04-21  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/100148
* cprop.c (constprop_register): Use next_nondebug_insn instead of
NEXT_INSN.

* g++.dg/opt/pr100148.C: New test.
gcc/cprop.c
gcc/testsuite/g++.dg/opt/pr100148.C [new file with mode: 0644]