Starting with this simple C program:
void nothing(void) {}
int main() {
int i;
for (i = 0; i < 10; ++i) {
nothing();
}
return 0;
}
My passes output as follows:
Note: IR statements are in Green.
; Function Attrs: nounwind readnone ssp uwtable
define void @nothing() #0 {
entry:
ret void
}
; Function Attrs: nounwind readnone ssp uwtable
define i32 @main() #0 {
entry:
ret i32 0
}
Question: Using O3
which considered the highest level optimization, Why did nothing
function hasn't been eliminated as a dead-code?