public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111217] New: variant of cond-bool-2.c fails
@ 2023-08-28 19:25 pinskia at gcc dot gnu.org
2023-08-28 19:32 ` [Bug tree-optimization/111217] " cvs-commit at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-28 19:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111217
Bug ID: 111217
Summary: variant of cond-bool-2.c fails
Product: gcc
Version: 14.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:
```
static inline _Bool nand(_Bool a, _Bool b)
{
_Bool t = 0;
if (a) { if (b) t = 1; }
return !t;
// return !(a && b);
}
_Bool f(int a, int b)
{
return nand(nand(b, nand(a, a)), nand(a, nand(b, b)));
}
```
we get at ifcombine:
<bb 2> [local count: 1073741824]:
if (a_3(D) != 0)
goto <bb 3>; [50.00%]
else
goto <bb 4>; [50.00%]
<bb 3> [local count: 536870912]:
if (b_2(D) != 0)
goto <bb 6>; [50.00%]
else
goto <bb 5>; [50.00%]
<bb 4> [local count: 536870912]:
if (b_2(D) != 0)
goto <bb 6>; [50.00%]
else
goto <bb 5>; [50.00%]
<bb 5> [local count: 536870912]:
...
<bb 6> [local count: 536870912]:
# iftmp.0_21 = PHI <1(3), 0(4)>
So we could swap these ifs around slighlty
if (b_2(D) != 0) goto L1; else goto L2;
L1:
if (a_3(D) != 0) goto L3; else goto L4;
L3: goto L4;
L4:
iftmp.0_21 = PHI <1(3), 0(4)>
L1: goto bb5;
And then it will be optimized.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/111217] variant of cond-bool-2.c fails
2023-08-28 19:25 [Bug tree-optimization/111217] New: variant of cond-bool-2.c fails pinskia at gcc dot gnu.org
@ 2023-08-28 19:32 ` cvs-commit at gcc dot gnu.org
2023-09-17 8:53 ` pinskia at gcc dot gnu.org
2023-09-17 8:57 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-28 19:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111217
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:b7f9ee7fb89fc9c48f03970e8e6581c7bae58f5a
commit r14-3529-gb7f9ee7fb89fc9c48f03970e8e6581c7bae58f5a
Author: Andrew Pinski <apinski@marvell.com>
Date: Mon Aug 28 19:27:41 2023 +0000
Fix cond-bool-2.c on powerpc and other targets
This adds `--param logical-op-non-short-circuit=1` to the tescase
so it becomes a target indepdendent testcase now.
I filed PR 111217 as the variant of the testcase which fails indepdendently
of the param.
Committed as obvious after testing to make sure it passes on powerpc now.
gcc/testsuite/ChangeLog:
PR testsuite/111215
* gcc.dg/tree-ssa/cond-bool-2.c: Add
`--param logical-op-non-short-circuit=1` to the options.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/111217] variant of cond-bool-2.c fails
2023-08-28 19:25 [Bug tree-optimization/111217] New: variant of cond-bool-2.c fails pinskia at gcc dot gnu.org
2023-08-28 19:32 ` [Bug tree-optimization/111217] " cvs-commit at gcc dot gnu.org
@ 2023-09-17 8:53 ` pinskia at gcc dot gnu.org
2023-09-17 8:57 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17 8:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111217
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This works on the trunk at -O2 now (after r14-3982-g9ea74d235c7e78). But it
still fails at -O1.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/111217] variant of cond-bool-2.c fails
2023-08-28 19:25 [Bug tree-optimization/111217] New: variant of cond-bool-2.c fails pinskia at gcc dot gnu.org
2023-08-28 19:32 ` [Bug tree-optimization/111217] " cvs-commit at gcc dot gnu.org
2023-09-17 8:53 ` pinskia at gcc dot gnu.org
@ 2023-09-17 8:57 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17 8:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111217
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |14.0
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> This works on the trunk at -O2 now (after r14-3982-g9ea74d235c7e78). But it
> still fails at -O1.
Actually it works at -O1 was looking at GCC 13 code generation ..
So fixed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-17 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 19:25 [Bug tree-optimization/111217] New: variant of cond-bool-2.c fails pinskia at gcc dot gnu.org
2023-08-28 19:32 ` [Bug tree-optimization/111217] " cvs-commit at gcc dot gnu.org
2023-09-17 8:53 ` pinskia at gcc dot gnu.org
2023-09-17 8:57 ` 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).