OSDN Git Service

AMDGPU: Remove unnecessary check for constant operands
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 10 Jul 2017 19:33:38 +0000 (19:33 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 10 Jul 2017 19:33:38 +0000 (19:33 +0000)
An instruction that has an immediate operand can't reach
this point. This is only called for a freshly shrunk instruction,
which prevously couldn't have had a literal constant operand.
This was also not conservative enough since it woudl also have
had to filter other constant-like inputs like frame indexes.

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

lib/Target/AMDGPU/SIShrinkInstructions.cpp

index 6bff2c5..327e745 100644 (file)
@@ -138,11 +138,6 @@ static void foldImmediates(MachineInstr &MI, const SIInstrInfo *TII,
 
   int Src0Idx = AMDGPU::getNamedOperandIdx(MI.getOpcode(), AMDGPU::OpName::src0);
 
-  // Only one literal constant is allowed per instruction, so if src0 is a
-  // literal constant then we can't do any folding.
-  if (TII->isLiteralConstant(MI, Src0Idx))
-    return;
-
   // Try to fold Src0
   MachineOperand &Src0 = MI.getOperand(Src0Idx);
   if (Src0.isReg() && MRI.hasOneUse(Src0.getReg())) {