[AMDGPU] Fix for the address sanitizer failure caused by the ifollowing commit:
authorAlexander Timofeev <Alexander.Timofeev@amd.com>
Mon, 27 May 2019 15:03:29 +0000 (15:03 +0000)
committerAlexander Timofeev <Alexander.Timofeev@amd.com>
Mon, 27 May 2019 15:03:29 +0000 (15:03 +0000)
    1a8b2ea611cf4ca7cb09562e0238cfefa27c05b5  Divergence driven ISel. Assign register class for cross block values according to the divergence.

llvm-svn: 361770

llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp

index 8ad7a52..4fd28fc 100644 (file)
@@ -595,7 +595,9 @@ bool SIFixSGPRCopies::runOnMachineFunction(MachineFunction &MF) {
 
             unsigned OpNo = UseMI->getOperandNo(&Use);
             const MCInstrDesc &Desc = TII->get(UseMI->getOpcode());
-            if (Desc.OpInfo && Desc.OpInfo[OpNo].RegClass != -1) {
+            if (!Desc.isPseudo() && Desc.OpInfo &&
+                OpNo <= Desc.getNumOperands() &&
+                Desc.OpInfo[OpNo].RegClass != -1) {
               const TargetRegisterClass *OpRC =
                   TRI->getRegClass(Desc.OpInfo[OpNo].RegClass);
               if (!TRI->isSGPRClass(OpRC) && OpRC != &AMDGPU::VS_32RegClass &&