From 7bb14f196b2fc332c0fec46cb2ab6ac641efa1e3 Mon Sep 17 00:00:00 2001 From: "Wang, Xin10" Date: Thu, 16 Mar 2023 22:55:08 -0400 Subject: [PATCH] [X86] Remove unreachable code in X86TargetTransformInfo.cpp In Function getVectorInstrCost, situation Opcode == Instruction::ExtractElement and Opcode == Instruction::InsertElement are all handled in the first 2 if-statements, So we have no chance for the code in line 4401. Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D145908 --- llvm/lib/Target/X86/X86TargetTransformInfo.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index fb05dc0..e2678f3 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -4396,11 +4396,6 @@ InstructionCost X86TTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val, return ShuffleCost + IntOrFpCost + RegisterFileMoveCost; } - // Add to the base cost if we know that the extracted element of a vector is - // destined to be moved to and used in the integer register file. - if (Opcode == Instruction::ExtractElement && ScalarType->isPointerTy()) - RegisterFileMoveCost += 1; - return BaseT::getVectorInstrCost(Opcode, Val, CostKind, Index, Op0, Op1) + RegisterFileMoveCost; } -- 2.7.4