This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Too conservative optimization with global variables??
- From: law at redhat dot com
- To: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 16 Feb 2004 16:50:27 -0700
- Subject: Re: [tree-ssa] Too conservative optimization with global variables??
- Reply-to: law at redhat dot com
In message <3EEDA327.2070402@student.tudelft.nl>, Steven Bosscher writes:
>Consider:
>
>extern int c;
>
>void fubar (void)
>{
> int a, b;
>
> a = 1; b = 2; c = 3;
> c = a * b * c;
>}
>
>With -O1 and -O2 this optimizes to (t15.optimized dump):
>
>;; Function fubar (fubar)
>
>fubar()
>{
> int T.1;
> int a;
> int b;
>
> c = 3;
> c = c * 2;
>}
>
>Why can't this just be folded to "c = 6;"?
These days, it does compile to "c = 6" :-)
fubar ()
{
# BLOCK 0
# PRED: ENTRY [100.0%] (fallthru,exec)
# c_8 = VDEF <c_6>;
c = 6;
return;
# SUCC: EXIT [100.0%]
}
jeff