[llvm] [AMDGPU] Support function attribute to override postRA scheduling direction (PR #147708)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 20:25:15 PDT 2025


================
@@ -1144,6 +1144,23 @@ GCNTargetMachine::createMachineScheduler(MachineSchedContext *C) const {
 
 ScheduleDAGInstrs *
 GCNTargetMachine::createPostMachineScheduler(MachineSchedContext *C) const {
+  Attribute PostRADirectionAttr =
+      C->MF->getFunction().getFnAttribute("misched-postra-direction");
+
+  if (PostRADirectionAttr.isValid()) {
+    StringRef PostRADirectionStr = PostRADirectionAttr.getValueAsString();
+    if (PostRADirectionStr == "topdown")
+      PostRADirection = MISched::TopDown;
+    else if (PostRADirectionStr == "bottomup")
+      PostRADirection = MISched::BottomUp;
+    else if (PostRADirectionStr == "bidirectional")
+      PostRADirection = MISched::Bidirectional;
+    else
+      reportFatalUsageError(
+          Twine("invalid value for 'misched-postra-direction' attribute: ") +
+          PostRADirectionStr);
----------------
arsenm wrote:

Better to emit an LLVMContext warning and ignore the value, plus this needs testing 

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


More information about the llvm-commits mailing list