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 10:05:03 +0000 (03:05 -0700)
commit14fa2b2ae7f49dee5e7e7469243e281e48d925b9
tree2f14519647de0267b36051061bb8679b556c2044
parenta295076bee293aa3112c615f9af7a27231816a36
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
This page took 0.164131 seconds and 6 git commands to generate.