public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111459] New: DSE after deleting trivial dead statements sometimes should do a cfgcleanup
@ 2023-09-18 15:09 pinskia at gcc dot gnu.org
2023-09-18 15:09 ` [Bug tree-optimization/111459] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-18 15:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111459
Bug ID: 111459
Summary: DSE after deleting trivial dead statements sometimes
should do a cfgcleanup
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: internal-improvement
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take at -O1:
```
void foo(void);
static int i;
static int *j = &i;
static char l;
static void(a)(char) {}
static short(b)(short c, short d) { return c - d; }
static short(e)(short f, int g) {
return f < 0 || g < 0 || g >= 32 ? f : f >> g;
}
static short(h)(short f, int g) { return g >= 2 ?: f >> g; }
static char k(char m, short n) {
short o;
int *p = &i;
if (!(((m) >= 1) && ((m) <= 1))) {
__builtin_unreachable();
}
o = e(i, i);
if (h(1, o))
;
else {
m = 0;
for (; m >= -20; m = b(m, 9))
if (a(i), n) {
if (*p)
;
else
foo();
;
} else
return l;
}
return i;
}
int main() { k(0 <= 0 > *j, i); }
```
In dse5 we delete trivial dead statements for _30 and _31 below:
_16 = (int) _2;
if (_16 > 1)
goto <bb 7>; [78.67%]
else
goto <bb 6>; [21.33%]
<bb 6> [local count: 536870912]:
_30 = 1 >> _16;
iftmp.7_31 = (short int) _30;
<bb 7> [local count: 1073741829]:
But we should recongize that the bb 6 becomes empty and we should add
TODO_cleanup_cfg to the todos like dse already does for removing trivial dead
phis:
if (removed_phi && gimple_seq_empty_p (phi_nodes (bb)))
todo |= TODO_cleanup_cfg;
I am filing this to record what I found so I can work on it later this week.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/111459] DSE after deleting trivial dead statements sometimes should do a cfgcleanup
2023-09-18 15:09 [Bug tree-optimization/111459] New: DSE after deleting trivial dead statements sometimes should do a cfgcleanup pinskia at gcc dot gnu.org
@ 2023-09-18 15:09 ` pinskia at gcc dot gnu.org
2023-09-18 15:16 ` pinskia at gcc dot gnu.org
2023-09-19 8:50 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-18 15:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111459
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Last reconfirmed| |2023-09-18
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/111459] DSE after deleting trivial dead statements sometimes should do a cfgcleanup
2023-09-18 15:09 [Bug tree-optimization/111459] New: DSE after deleting trivial dead statements sometimes should do a cfgcleanup pinskia at gcc dot gnu.org
2023-09-18 15:09 ` [Bug tree-optimization/111459] " pinskia at gcc dot gnu.org
@ 2023-09-18 15:16 ` pinskia at gcc dot gnu.org
2023-09-19 8:50 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-18 15:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111459
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=111456
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I found this while looking into PR 111456.
sink2 (or fab1) ends up doing the cfgcleanup though.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/111459] DSE after deleting trivial dead statements sometimes should do a cfgcleanup
2023-09-18 15:09 [Bug tree-optimization/111459] New: DSE after deleting trivial dead statements sometimes should do a cfgcleanup pinskia at gcc dot gnu.org
2023-09-18 15:09 ` [Bug tree-optimization/111459] " pinskia at gcc dot gnu.org
2023-09-18 15:16 ` pinskia at gcc dot gnu.org
@ 2023-09-19 8:50 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-19 8:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111459
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, I think we usually never track BBs becoming empty for the purpose of CFG
cleanup (which isn't all that cheap).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-19 8:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18 15:09 [Bug tree-optimization/111459] New: DSE after deleting trivial dead statements sometimes should do a cfgcleanup pinskia at gcc dot gnu.org
2023-09-18 15:09 ` [Bug tree-optimization/111459] " pinskia at gcc dot gnu.org
2023-09-18 15:16 ` pinskia at gcc dot gnu.org
2023-09-19 8:50 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).