[PATCH] D91487: [AMDGPU] Don't require swz operand for non-return Atomics.

Matthew Dawson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 14 17:56:09 PST 2020


MJDSys created this revision.
MJDSys added reviewers: rampitec, foad.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
Herald added a project: LLVM.
MJDSys requested review of this revision.
Herald added a subscriber: wdng.

When legalizing operands for instructions that are not atmoics with
a return, do not assume the swz operand is present.

This avoids an assert in the openmm test suite.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91487

Files:
  llvm/lib/Target/AMDGPU/SIInstrInfo.cpp


Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -5244,7 +5244,10 @@
           MIB.addImm(TFE->getImm());
         }
 
-        MIB.addImm(getNamedImmOperand(MI, AMDGPU::OpName::swz));
+        if (const MachineOperand *SWZ =
+                getNamedOperand(MI, AMDGPU::OpName::swz)) {
+          MIB.addImm(SWZ->getImm());
+        }
 
         MIB.cloneMemRefs(MI);
         Addr64 = MIB;
@@ -5289,6 +5292,7 @@
 
   while (!Worklist.empty()) {
     MachineInstr &Inst = *Worklist.pop_back_val();
+    LLVM_DEBUG(dbgs() << "Moving to VALU " << Inst);
     MachineBasicBlock *MBB = Inst.getParent();
     MachineRegisterInfo &MRI = MBB->getParent()->getRegInfo();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91487.305336.patch
Type: text/x-patch
Size: 822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201115/78739f6b/attachment-0001.bin>


More information about the llvm-commits mailing list