[llvm] AMDGPU: Fix temporal divergence introduced by machine-sink and performance regression introduced by D155343 (PR #67456)

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 11:38:13 PDT 2023


================
@@ -171,6 +171,48 @@ bool SIInstrInfo::isIgnorableUse(const MachineOperand &MO) const {
          isVALU(*MO.getParent()) && !resultDependsOnExec(*MO.getParent());
 }
 
+bool SIInstrInfo::isSafeToSink(MachineInstr &MI,
+                               MachineBasicBlock *SuccToSinkTo,
+                               MachineCycleInfo *CI) const {
+  CI->clear();
+  CI->compute(*MI.getMF());
----------------
nhaehnle wrote:

Don't recompute this each time. It leads to at least quadratic compile-time. It should be the responsibility of the caller to ensure that the CI is uptodate.

https://github.com/llvm/llvm-project/pull/67456


More information about the llvm-commits mailing list