[英]Is O3 a fixed optimization sequence? And how to change frame-pointer value in LLVM IR?
我用下面的命令找出clang O3的順序,
$ opt -enable-new-pm=0 -O3 -debug-pass=Arguments input.ll
我得到了一個很長的優化序列。
所有代碼的順序是否相同? 還是O3可以根據源碼改順序?
而且,我發現如果我使用-O0
標志來生成 IR 文件,屬性可能是這樣的,
attributes #0 = { noinline nounwind uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-pr otector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target- features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
我們可以看到frame-pointer = all
的值,我認為這可能會讓代碼變慢。 (使用O3標志會變成none
)
如何通過opt
命令更改此值?
多謝。
是的,所有輸入的優化序列都相同。 但請注意opt
的 -O3 可能與clang
的 -O3 不同。
至於禁用幀指針,您可以將其刪除
-fomit-frame-pointer
使用clang
生成 LLVM IR 時opt
優化 LLVM IR 時使用-frame-pointer=none
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.