dead code elimination in cp front end

charfi asma charfiasma@yahoo.fr
Thu Mar 31 10:13:00 GMT 2011


Hello,

I compiled this code with g++  -Os -fipa-cp -S
I expected that in test.s "assign of a" will be removed since value of  "y" did 
not change  and so "a" will not be used. Am I wrong ??

int a,b;
int y,output;

class FSM
{
public : void op ()
{
 if (y==1)
    output=b;
else 
    output=a;
}
};    
    
int main()
{
  
FSM f;
a=50;
b=10;
y=1;
f.op();
return output;
}

thanks

Asma





More information about the Gcc-help mailing list