[PATCH] D103951: [NFC][Scheduler] Refactor tryCandidate to return boolean

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 11 01:56:41 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineScheduler.cpp:3179
 /// \param Zone describes the scheduled zone that we are extending, or nullptr
 //              if Cand is from a different zone than TryCand.
+bool GenericScheduler::tryCandidate(SchedCandidate &Cand,
----------------
Update the comment to explain what the return value means. Why don't you return true when you set the reason to NodeOrder?


================
Comment at: llvm/lib/Target/PowerPC/PPCMachineScheduler.cpp:54-56
+  if (GenericScheduler::tryCandidate(Cand, TryCand, Zone) ||
+      (TryCand.Reason != NodeOrder && TryCand.Reason != NoCand))
+    return true;
----------------
Couldn't you do this refactoring anyway, even without changing the return type? E.g.
```
GenericScheduler::tryCandidate(Cand, TryCand, Zone);
if (TryCand.Reason != NodeOrder && TryCand.Reason != NoCand)
  return;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103951



More information about the llvm-commits mailing list