]> git.ipfire.org Git - thirdparty/gcc.git/commit
forwprop: Don't add uses to dce list if debug statement [PR116156]
authorAndrew Pinski <quic_apinski@quicinc.com>
Thu, 1 Aug 2024 17:33:34 +0000 (10:33 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Fri, 2 Aug 2024 09:58:23 +0000 (02:58 -0700)
commit33baa20c5cdcf5ff8164606115f00aa30f559312
tree75e5c28388a860850e10e38e580a6fe1c4530431
parent4b9ba9cee9511930411b7b53e1333e1b6b93078d
forwprop: Don't add uses to dce list if debug statement [PR116156]

The problem here is that when forwprop does a copy prop, into a statement,
we mark the uses of that statement as possibly need to be removed. But it just
happened that statement was a debug statement, there will be a difference when
compiling with debuging info turned on vs off; this is not expected.
So the fix is not to add the old use to dce list to process if it was a debug
statement.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/116156

gcc/ChangeLog:

* tree-ssa-forwprop.cc (pass_forwprop::execute): Don't add
uses if the statement was a debug statement.

gcc/testsuite/ChangeLog:

* c-c++-common/torture/pr116156-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/c-c++-common/torture/pr116156-1.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.cc