从这个简单的C程序开始:
void nothing(void) {}
int main() {
int i;
for (i = 0; i < 10; ++i) {
nothing();
}
return 0;
}
我的传递输出如下:
注意:IR语句为绿色。
; 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
}
问题: 使用被认为是最高级别优化的O3
,为什么 nothing
函数没有被消除作为死代码?
.obj
文件中没有导出任何内容,因此它无法被消除。 - user4003407