ifcvt: Fix -fcompare-debug bug [PR100852]
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Jun 2021 07:28:27 +0000 (09:28 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 10 Jun 2021 07:28:27 +0000 (09:28 +0200)
commit2d2ed777b23ab6503027039e0adbfe1162f52b2f
tree4831039572de8d0a1592895102be1211694f6315
parentf8b067056ba5dd53f7bc883a1f59833efc26bd3e
ifcvt: Fix -fcompare-debug bug [PR100852]

The following testcase fails -fcompare-debug, because it is ifcvt optimized
into umin only with -g0 and not with -g - the function(s) use
prev_nonnote_insn, which without -g finds a real insn the code is looking
for, while with -g finds a DEBUG_INSN.

2021-06-10  Jakub Jelinek  <jakub@redhat.com>

PR debug/100852
* ifcvt.c (noce_get_alt_condition, noce_try_abs): Use
prev_nonnote_nondebug_insn instead of prev_nonnote_insn.

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