→ Lipraxde: Instruction sink 記得是為何可以在有 conditional bra 01/07 22:58
→ Lipraxde: nch 時避免執行到不用的指令,另一個附帶的好處是可以 01/07 22:58
→ Lipraxde: 減少 live range (對 compilation time 有幫助)。只要 01/07 22:58
→ Lipraxde: IR 上還保有 data dependency 應該就還能做。不過...這 01/07 22:58
→ Lipraxde: 是做在 instcombine 裡面的!? 01/07 22:58
在 instcombining.cpp 中,好像是 3730 行那裡有相關實作
https://llvm.org/doxygen/InstructionCombining_8cpp_source.html
但確實我有找到一份純粹是 Sink.cpp 的 source code,
https://llvm.org/doxygen/Sink_8cpp_source.html
不曉得兩者差在哪裡,看起來實作內容有差
其中,sink.cpp 這個 pass 可以透過 opt 去應用
opt -enable-new-pm=0 -sink source_ir.ll -S -o dest_ir.ll
不過在 O3 中,並沒有應用這個 sink pass,
而是整併在 instcombine 裏面
想問 Lipraxde 大,所謂的 “IR 上還保有 data dependency 應該就還能做”
是什麼意思呢?
※ 編輯: shane87123 (220.141.73.237 臺灣), 01/08/2022 11:09:31
※ 編輯: shane87123 (220.141.73.237 臺灣), 01/08/2022 11:10:09
→ Lipraxde: 其實可以用 git blame 的功能 (github 好用) 看看當初 01/08 13:24
→ Lipraxde: 的源頭為什麼會有 sink pass以及為什麼會在 instructio 01/08 13:24
→ Lipraxde: n combine 裡做 sink (我猜是因為 2004 年還沒有 sink 01/08 13:24
→ Lipraxde: pass,作者直接做在 instruction combine 裡圖個方便) 01/08 13:24
→ Lipraxde: ,至於為什麼 sink pass 做到後來沒出現在 o3 pass、為 01/08 13:24
→ Lipraxde: 什麼有了獨立的 pass 大家還是繼續改在 instruction co 01/08 13:24
→ Lipraxde: mbine 裡呢...這就需要更深的考古學功力了,LLVM 可不 01/08 13:24
→ Lipraxde: 止這兩個地方有實作 sink,而且看起來可能也不是同時/ 01/08 13:24
→ Lipraxde: 人做的,都有他們個自的理由,作為一個擁有大量貢獻者 01/08 13:24
→ Lipraxde: 的開源專案來說,採用理想中最好的方案並不是唯一且必 01/08 13:24
→ Lipraxde: 要的考量,因此建議是不必太細究這些。 01/08 13:24
→ Lipraxde: 「IR 上還保有 data dependency 應該就還能做」算是一 01/08 13:35
→ Lipraxde: 個比較簡略的說法,你想想:將某一個 IR 指令搬移,使 01/08 13:35
→ Lipraxde: 「需要用到他的時候」才去執行他。想知道什麼時候需要 01/08 13:35
→ Lipraxde: 用到它自然是需要知道 data dependency 的,總不能不看 01/08 13:35
→ Lipraxde: 就搬XD 01/08 13:35