[PATCH] D89077: [AMDGPU] Run hazard recognizer pass later

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 02:17:33 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:1037
+  if (getOptLevel() > CodeGenOpt::None)
+    addPass(&SIInsertHardClausesID);
+
----------------
I am nervous about running PostRAHazardRecognizer after SIInsertHardClauses because you get undefined behaviour if you insert random instructions of the wrong type into the middle of a hard clause. In particular it is illegal to include s_waitcnt inside a clause, and I know the hazard recognizer does insert s_waitcnt_depctr in some cases.

SIInsertHardClauses does bundle the clauses it forms, but the hazard recognizer can still insert instructions inside bundles in some cases. (I think it is wrong to do this, and I have some ideas about fixing it.)

So I'm not sure if this will cause a problem in practice but it makes me nervous. It seems like we have more than one pass that wants to run as late as possible and I'm not sure how to resolve that. I know @nhaehnle has asked about this in the past.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89077/new/

https://reviews.llvm.org/D89077



More information about the llvm-commits mailing list