int a(){
int b;
int c;
b=3;
c=b*4;
if(c>10){
c=c-10;
}
return c;
}
A good compiler will reduce this to:
int a(){
return 2;
}
Easily be implemented on SSA form as published by Wegman and Zadeck in 1991.
Do not confuse constant propagation with constant folding, which is implemented in the front-end.
See also: Control flow graph, Compiler optimization
|
Search Encyclopedia
|
Featured Article
|