public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109119] New: missing loading fre with branch comparing two pointers
@ 2023-03-14 4:58 pinskia at gcc dot gnu.org
2023-03-14 8:18 ` [Bug tree-optimization/109119] " rguenth at gcc dot gnu.org
2023-03-20 16:49 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-14 4:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109119
Bug ID: 109119
Summary: missing loading fre with branch comparing two pointers
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
void fun (unsigned *x, unsigned *b) {
asm volatile(""::"r"(*x));
unsigned *a = b;//malloc (*x);
if (a == 0)
return;
if (a != x) // (A)
*a = *x;
*x = *a;
}
```
GCC currently produces:
<bb 2> [local count: 1073741824]:
_1 = *x_6(D);
__asm__ __volatile__("" : : "r" _1);
if (b_7(D) == 0B)
goto <bb 7>; [18.09%]
else
goto <bb 3>; [81.91%]
<bb 3> [local count: 879501929]:
if (x_6(D) != b_7(D))
goto <bb 5>; [70.00%]
else
goto <bb 4>; [30.00%]
<bb 4> [local count: 263850576]:
pretmp_10 = *b_7(D);
goto <bb 6>; [100.00%]
<bb 5> [local count: 615651353]:
*b_7(D) = _1;
<bb 6> [local count: 879501929]:
# prephitmp_11 = PHI <pretmp_10(4), _1(5)>
*x_6(D) = prephitmp_11;
But pretmp_10 should be the same as _1 as at that point b_7 == x_6.
Note I noticed this while looking into PR 96564.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/109119] missing loading fre with branch comparing two pointers
2023-03-14 4:58 [Bug tree-optimization/109119] New: missing loading fre with branch comparing two pointers pinskia at gcc dot gnu.org
@ 2023-03-14 8:18 ` rguenth at gcc dot gnu.org
2023-03-20 16:49 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-14 8:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109119
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-03-14
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. FRE doesn't use conditional equivalences.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/109119] missing loading fre with branch comparing two pointers
2023-03-14 4:58 [Bug tree-optimization/109119] New: missing loading fre with branch comparing two pointers pinskia at gcc dot gnu.org
2023-03-14 8:18 ` [Bug tree-optimization/109119] " rguenth at gcc dot gnu.org
@ 2023-03-20 16:49 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-20 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109119
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-20 16:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 4:58 [Bug tree-optimization/109119] New: missing loading fre with branch comparing two pointers pinskia at gcc dot gnu.org
2023-03-14 8:18 ` [Bug tree-optimization/109119] " rguenth at gcc dot gnu.org
2023-03-20 16:49 ` pinskia 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).