[llvm] AMDGPU/GlobalISel: Fix inst-selection of ballot (PR #109986)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 02:36:34 PDT 2024


================
@@ -1413,50 +1413,101 @@ bool AMDGPUInstructionSelector::selectIntrinsicCmp(MachineInstr &I) const {
   return true;
 }
 
+// Ballot has to zero bits in input lane-mask that are zero in current exec,
+// Done as AND with exec. For inputs that are results of instruction that
+// implicitly use same exec, for example compares in same basic block or SCC to
+// VCC copy, use copy.
+static bool isLaneMaskFromSameBlock(Register Reg, MachineRegisterInfo &MRI,
+                                    MachineBasicBlock *MBB) {
+  MachineInstr *MI = MRI.getVRegDef(Reg);
+  if (MI->getParent() != MBB)
+    return false;
----------------
petar-avramovic wrote:

same MBB check is here. Deleted the loop

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


More information about the llvm-commits mailing list