[NFCI][CostModel][AMDGPU] Simplify getUserCost
authorSam Parker <sam.parker@arm.com>
Tue, 2 Jun 2020 11:29:42 +0000 (12:29 +0100)
committerSam Parker <sam.parker@arm.com>
Thu, 4 Jun 2020 07:51:28 +0000 (08:51 +0100)
Casts and intrinsics are now handled by the default implementation
of getUserCost, so remove them from the backends switch statement.

https://reviews.llvm.org/D80994

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp

index 9e738dd..094fb5f 100644 (file)
@@ -993,14 +993,6 @@ GCNTTIImpl::getUserCost(const User *U, ArrayRef<const Value *> Operands,
       Idx = CI->getZExtValue();
     return getVectorInstrCost(I->getOpcode(), I->getType(), Idx);
   }
-  case Instruction::Call: {
-    if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(U)) {
-      IntrinsicCostAttributes CostAttrs(*II);
-      return getIntrinsicInstrCost(CostAttrs, CostKind);
-    } else {
-      return BaseT::getUserCost(U, Operands, CostKind);
-    }
-  }
   case Instruction::ShuffleVector: {
     const ShuffleVectorInst *Shuffle = cast<ShuffleVectorInst>(I);
     auto *Ty = cast<VectorType>(Shuffle->getType());
@@ -1034,22 +1026,6 @@ GCNTTIImpl::getUserCost(const User *U, ArrayRef<const Value *> Operands,
 
     return getShuffleCost(TTI::SK_PermuteTwoSrc, Ty, 0, nullptr);
   }
-  case Instruction::ZExt:
-  case Instruction::SExt:
-  case Instruction::FPToUI:
-  case Instruction::FPToSI:
-  case Instruction::FPExt:
-  case Instruction::PtrToInt:
-  case Instruction::IntToPtr:
-  case Instruction::SIToFP:
-  case Instruction::UIToFP:
-  case Instruction::Trunc:
-  case Instruction::FPTrunc:
-  case Instruction::BitCast:
-  case Instruction::AddrSpaceCast: {
-    return getCastInstrCost(I->getOpcode(), I->getType(),
-                            I->getOperand(0)->getType(), CostKind, I);
-  }
   case Instruction::Add:
   case Instruction::FAdd:
   case Instruction::Sub: