我有以下LLVM IR方案:LLVM的-globalopt通不優化的全局變量
@test1 = global i32 3, align 4
@test2 = common global i32 0, align 4
; Function Attrs: nounwind uwtable
define i32 @main() #0 {
store i32 4, i32* @test2, align 4
%1 = load i32* @test1, align 4
ret i32 %1
}
當我使用選擇(3.3版)與-globalopt
運行通過位碼保持不變。不過,我預計@test1
被標記爲constant和@test2
淘汰,因爲該程序只存儲到@test2
。
我是否必須在某些分析階段之前運行opt,或者爲什麼該階段未按預期執行?