AMDGPU: Remove unnecessary check
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 22 Sep 2015 04:17:45 +0000 (04:17 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 22 Sep 2015 04:17:45 +0000 (04:17 +0000)
If the instruction doesn't have enough operands, it
either shouldn't be marked as isCommutable or is malformed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248242 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/SIInstrInfo.cpp

index f013a1e..c7218de 100644 (file)
@@ -784,10 +784,6 @@ bool SIInstrInfo::expandPostRAPseudo(MachineBasicBlock::iterator MI) const {
 
 MachineInstr *SIInstrInfo::commuteInstruction(MachineInstr *MI,
                                               bool NewMI) const {
-
-  if (MI->getNumOperands() < 3)
-    return nullptr;
-
   int CommutedOpcode = commuteOpcode(*MI);
   if (CommutedOpcode == -1)
     return nullptr;