public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/114693] New: `expand` introduce redundant store facing logic expression
@ 2024-04-11 11:38 absoler at smail dot nju.edu.cn
2024-04-11 11:43 ` [Bug target/114693] " pinskia at gcc dot gnu.org
2024-04-11 11:59 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: absoler at smail dot nju.edu.cn @ 2024-04-11 11:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114693
Bug ID: 114693
Summary: `expand` introduce redundant store facing logic
expression
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: absoler at smail dot nju.edu.cn
Target Milestone: ---
A simple case, regression from gcc-5
```
struct S{
char f0;
int f3;
} s;
int g, f;
void func_1() {
int a = 0;
s.f0 = 1 && ((3 > a) & g);
}
```
compiled with -O2 :
```
func_1():
401340: mov 0x10846(%rip),%eax # 411b8c <g>
401346: mov %al,0x10844(%rip) # 411b90 <s>
40134c: andb $0x1,0x1083d(%rip) # 411b90 <s>
401353: retq
```
it seems "1 && " interfere the compiler, after removing it the compiler
generates:
```
func_1():
401340: movzbl 0x10845(%rip),%eax # 411b8c <g>
401347: and $0x1,%eax
40134a: mov %al,0x10840(%rip) # 411b90 <s>
401350: retq
```
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/114693] `expand` introduce redundant store facing logic expression
2024-04-11 11:38 [Bug rtl-optimization/114693] New: `expand` introduce redundant store facing logic expression absoler at smail dot nju.edu.cn
@ 2024-04-11 11:43 ` pinskia at gcc dot gnu.org
2024-04-11 11:59 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-11 11:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114693
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |x86_64
Component|rtl-optimization |target
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a target specific issue on how x86_64 backend patterns are done IIRC.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/114693] `expand` introduce redundant store facing logic expression
2024-04-11 11:38 [Bug rtl-optimization/114693] New: `expand` introduce redundant store facing logic expression absoler at smail dot nju.edu.cn
2024-04-11 11:43 ` [Bug target/114693] " pinskia at gcc dot gnu.org
@ 2024-04-11 11:59 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-11 11:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114693
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Resolution|--- |FIXED
Keywords| |missed-optimization
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually this is fixed on the trunk.
This is what we got in GCC 13 and before:
g.0_1 = g;
_2 = (_Bool) g.0_1;
_3 = (char) _2;
s.f0 = _3;
But in GCC 14+ we get:
g.0_1 = g;
_2 = g.0_1 & 1;
_3 = (char) _2;
s.f0 = _3;
This was fixed by r14-6420-g85c5efcffed19c .
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-11 11:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11 11:38 [Bug rtl-optimization/114693] New: `expand` introduce redundant store facing logic expression absoler at smail dot nju.edu.cn
2024-04-11 11:43 ` [Bug target/114693] " pinskia at gcc dot gnu.org
2024-04-11 11:59 ` 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).