[llvm-branch-commits] [llvm] [AMDGPU] Skip non-first termintors when forcing emit zero flag (PR #112116)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Oct 13 21:37:38 PDT 2024


================
@@ -1600,6 +1600,17 @@ static bool callWaitsOnFunctionReturn(const MachineInstr &MI) {
   return true;
 }
 
+/// \returns true if \p MI is not the first terminator of its associated MBB.
+static bool checkIfMBBNonFirstTerminator(const MachineInstr &MI) {
+  const auto &MBB = MI.getParent();
+  if (MBB->getFirstTerminator() == MI)
+    return false;
+  for (const auto &I : MBB->terminators())
+    if (&I == &MI)
+      return true;
----------------
arsenm wrote:

This iterator logic is clumsy (you're effectively using getFirstTerminator twice) 

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


More information about the llvm-branch-commits mailing list