[llvm] AMDGPU/GlobalISel: Fix inst-selection of ballot (PR #109986)
    Matt Arsenault via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Oct 10 04:56:27 PDT 2024
    
    
  
================
@@ -1413,50 +1413,97 @@ 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, use copy.
+bool isBallotCopy(Register Reg, MachineRegisterInfo &MRI,
+                  MachineBasicBlock *MBB) {
+  MachineInstr *MI = MRI.getVRegDef(Reg);
+  // Look through copies, truncs and anyext. TODO: just copies
----------------
arsenm wrote:
What situations are there redundant copies that need to be looked through? I would assume any trivial copies to be optimized out 
https://github.com/llvm/llvm-project/pull/109986
    
    
More information about the llvm-commits
mailing list