Dead Store Elimination

Listing: Dead Store Elimination, Before Optimization

void func(int x, int y)
{
 x = y * y;
 otherfunc1(y);
 x = getresult();
 otherfunc2(y);
}
Listing: Dead Store Elimination, After Optimization

void func_optimized(int x, int y)
{
 otherfunc1(y);
 x = getresult();
 otherfunc2(y);
}