[llvm] [AMDGPU] Allow hoisting of V_CMP feeding into SI_IF and SI_IF_BREAK (PR #71401)

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 03:39:16 PST 2023


================
@@ -156,14 +156,21 @@ static bool resultDependsOnExec(const MachineInstr &MI) {
     Register DstReg = MI.getOperand(0).getReg();
     if (!DstReg.isVirtual())
       return true;
-    for (MachineInstr &Use : MRI.use_nodbg_instructions(DstReg)) {
-      switch (Use.getOpcode()) {
+    for (MachineOperand &Use : MRI.use_nodbg_operands(DstReg)) {
+      MachineInstr &User = *Use.getParent();
+      switch (User.getOpcode()) {
       case AMDGPU::S_AND_SAVEEXEC_B32:
       case AMDGPU::S_AND_SAVEEXEC_B64:
         break;
+      case AMDGPU::SI_IF:
+      case AMDGPU::SI_IF_BREAK:
+        if (Use.getOperandNo() != 1)
----------------
perlfu wrote:

Presumably this branch is specific to SI_IF_BREAK?
Could you add extra comment to explain what operand 1 is.

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


More information about the llvm-commits mailing list