diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-12-28 17:40:17 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-12-28 17:40:17 +0100 |
commit | 3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4 (patch) | |
tree | 866d5f0b3c7bae8a20a130111b7a98673e4be884 /gcc/fortran/trans-decl.c | |
parent | 78ee8381bf0ebd09a92936bdb9e1b5c9fc85ad88 (diff) | |
download | gcc-3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4.zip gcc-3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4.tar.gz gcc-3c5fd3616f73fbcd241cc3a5e09275c2b0c49bd4.tar.bz2 |
loop-invariant: Fix -fcompare-debug failure [PR103837]
In the following testcase we have a -fcompare-debug failure, because
can_move_invariant_reg doesn't ignore DEBUG_INSNs in its decisions.
In the testcase we have due to uninitialized variable:
loop_header
debug_insn using pseudo84
pseudo84 = invariant
insn using pseudo84
end loop
and with -g decide not to move the pseudo84 = invariant before the
loop header; in this case not resetting the debug insns might be fine.
But, we could have also:
pseudo84 = whatever
loop_header
debug_insn using pseudo84
pseudo84 = invariant
insn using pseudo84
end loop
and in that case not resetting the debug insns would result in wrong-debug.
And, we don't really have generally a good substitution on what pseudo84
contains, it could inherit various values from different paths.
So, the following patch ignores DEBUG_INSNs in the decisions, and if there
are any that previously prevented the optimization, resets them before
return true.
2021-12-28 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/103837
* loop-invariant.c (can_move_invariant_reg): Ignore DEBUG_INSNs in
the decisions whether to return false or continue and right before
returning true reset those debug insns that previously caused
returning false.
* gcc.dg/pr103837.c: New test.
Diffstat (limited to 'gcc/fortran/trans-decl.c')
0 files changed, 0 insertions, 0 deletions