public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND
@ 2004-03-31 2:55 kazu at cs dot umass dot edu
2004-03-31 3:34 ` [Bug optimization/14792] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-31 2:55 UTC (permalink / raw)
To: gcc-bugs
Consider:
void bar (void);
void
foo (unsigned int a)
{
int b = a;
if (b & 1)
bar ();
}
I get:
foo (a)
{
int b;
_Bool T.1;
int T.0;
<bb 0>:
b_2 = (int)a_1;
T.0_3 = b_2 & 1;
T.1_4 = (_Bool)T.0_3;
if (T.1_4) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
We could skip "b" like so
T.0_3 = a_1 & 1;
--
Summary: [tree-ssa] cast elimination opportunity involving an AND
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: enhancement
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/14792] [tree-ssa] cast elimination opportunity involving an AND
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
@ 2004-03-31 3:34 ` pinskia at gcc dot gnu dot org
2004-03-31 5:40 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-31 3:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-31 03:34 -------
Confirmed, mine.
Here is a better example which causes there to be a reference to link_error (even in RTL):
void link_error (void);
void
foo (char *a)
{
char b = *a;
long c = b;
if (b & 1)
if (! (c & 1))
link_error();
}
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-03-31 03:34:14
date| |
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/14792] [tree-ssa] cast elimination opportunity involving an AND
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
2004-03-31 3:34 ` [Bug optimization/14792] " pinskia at gcc dot gnu dot org
@ 2004-03-31 5:40 ` pinskia at gcc dot gnu dot org
2004-03-31 5:43 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-31 5:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-31 05:40 -------
On PPC here is why this code is not optimial:
_foo:
lbz r4,0(r3)
extsb r0,r4 <--- extra extends byte
rlwinm r2,r0,0,31,31 <-- as this is just an and 1 (trust me)
cmpwi cr7,r2,0
beqlr- cr7
bnelr- cr7
b _link_error
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/14792] [tree-ssa] cast elimination opportunity involving an AND
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
2004-03-31 3:34 ` [Bug optimization/14792] " pinskia at gcc dot gnu dot org
2004-03-31 5:40 ` pinskia at gcc dot gnu dot org
@ 2004-03-31 5:43 ` pinskia at gcc dot gnu dot org
2004-05-24 18:13 ` [Bug tree-optimization/14792] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-31 5:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-31 05:43 -------
Related to, if I fix that case on PPC, it fixes this problem too.
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |2962
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14792] [tree-ssa] cast elimination opportunity involving an AND
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2004-03-31 5:43 ` pinskia at gcc dot gnu dot org
@ 2004-05-24 18:13 ` pinskia at gcc dot gnu dot org
2004-05-25 14:32 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 18:13 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.5.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14792] [tree-ssa] cast elimination opportunity involving an AND
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
` (3 preceding siblings ...)
2004-05-24 18:13 ` [Bug tree-optimization/14792] " pinskia at gcc dot gnu dot org
@ 2004-05-25 14:32 ` pinskia at gcc dot gnu dot org
2004-06-01 21:01 ` pinskia at gcc dot gnu dot org
2004-08-31 4:11 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-25 14:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-24 16:30 -------
For this to work, we have to fold ((int)b & 1) != 0 into b & 1 != 0. If this is done then the patch for
15459 can do its work.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14792] [tree-ssa] cast elimination opportunity involving an AND
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
` (4 preceding siblings ...)
2004-05-25 14:32 ` pinskia at gcc dot gnu dot org
@ 2004-06-01 21:01 ` pinskia at gcc dot gnu dot org
2004-08-31 4:11 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-01 21:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-01 21:01 -------
I should note that this shows up many times when compiling gcc.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14792] [tree-ssa] cast elimination opportunity involving an AND
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
` (5 preceding siblings ...)
2004-06-01 21:01 ` pinskia at gcc dot gnu dot org
@ 2004-08-31 4:11 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-31 4:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-31 04:11 -------
I am not going to fix the fold problem.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |15459
AssignedTo|pinskia at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14792
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-08-31 4:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-31 2:55 [Bug optimization/14792] New: [tree-ssa] cast elimination opportunity involving an AND kazu at cs dot umass dot edu
2004-03-31 3:34 ` [Bug optimization/14792] " pinskia at gcc dot gnu dot org
2004-03-31 5:40 ` pinskia at gcc dot gnu dot org
2004-03-31 5:43 ` pinskia at gcc dot gnu dot org
2004-05-24 18:13 ` [Bug tree-optimization/14792] " pinskia at gcc dot gnu dot org
2004-05-25 14:32 ` pinskia at gcc dot gnu dot org
2004-06-01 21:01 ` pinskia at gcc dot gnu dot org
2004-08-31 4:11 ` pinskia at gcc dot gnu dot 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).