diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -1130,8 +1130,8 @@ case Instruction::GetElementPtr: { const auto *GEP = cast(U); return TargetTTI->getGEPCost(GEP->getSourceElementType(), - GEP->getPointerOperand(), - Operands.drop_front(), CostKind); + Operands.front(), Operands.drop_front(), + CostKind); } case Instruction::Add: case Instruction::FAdd: @@ -1152,11 +1152,10 @@ case Instruction::Or: case Instruction::Xor: case Instruction::FNeg: { - const TTI::OperandValueInfo Op1Info = TTI::getOperandInfo(U->getOperand(0)); + const TTI::OperandValueInfo Op1Info = TTI::getOperandInfo(Operands[0]); TTI::OperandValueInfo Op2Info; if (Opcode != Instruction::FNeg) - Op2Info = TTI::getOperandInfo(U->getOperand(1)); - SmallVector Operands(U->operand_values()); + Op2Info = TTI::getOperandInfo(Operands[1]); return TargetTTI->getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info, Operands, I); } @@ -1173,14 +1172,14 @@ case Instruction::SExt: case Instruction::ZExt: case Instruction::AddrSpaceCast: { - Type *OpTy = U->getOperand(0)->getType(); + Type *OpTy = Operands[0]->getType(); return TargetTTI->getCastInstrCost( Opcode, Ty, OpTy, TTI::getCastContextHint(I), CostKind, I); } case Instruction::Store: { auto *SI = cast(U); - Type *ValTy = U->getOperand(0)->getType(); - TTI::OperandValueInfo OpInfo = TTI::getOperandInfo(U->getOperand(0)); + Type *ValTy = Operands[0]->getType(); + TTI::OperandValueInfo OpInfo = TTI::getOperandInfo(Operands[0]); return TargetTTI->getMemoryOpCost(Opcode, ValTy, SI->getAlign(), SI->getPointerAddressSpace(), CostKind, OpInfo, I); @@ -1223,14 +1222,14 @@ match(U, m_LogicalOr()) ? Instruction::Or : Instruction::And, Ty, CostKind, Op1Info, Op2Info, Operands, I); } - Type *CondTy = U->getOperand(0)->getType(); + Type *CondTy = Operands[0]->getType(); return TargetTTI->getCmpSelInstrCost(Opcode, U->getType(), CondTy, CmpInst::BAD_ICMP_PREDICATE, CostKind, I); } case Instruction::ICmp: case Instruction::FCmp: { - Type *ValTy = U->getOperand(0)->getType(); + Type *ValTy = Operands[0]->getType(); // TODO: Also handle ICmp/FCmp constant expressions. return TargetTTI->getCmpSelInstrCost(Opcode, ValTy, U->getType(), I ? cast(I)->getPredicate() @@ -1242,7 +1241,7 @@ if (!IE) return TTI::TCC_Basic; // FIXME unsigned Idx = -1; - if (auto *CI = dyn_cast(IE->getOperand(2))) + if (auto *CI = dyn_cast(Operands[2])) if (CI->getValue().getActiveBits() <= 32) Idx = CI->getZExtValue(); return TargetTTI->getVectorInstrCost(*IE, Ty, CostKind, Idx); @@ -1253,7 +1252,7 @@ return TTI::TCC_Basic; // FIXME auto *VecTy = cast(U->getType()); - auto *VecSrcTy = cast(U->getOperand(0)->getType()); + auto *VecSrcTy = cast(Operands[0]->getType()); int NumSubElts, SubIndex; if (Shuffle->changesLength()) { @@ -1337,10 +1336,10 @@ if (!EEI) return TTI::TCC_Basic; // FIXME unsigned Idx = -1; - if (auto *CI = dyn_cast(EEI->getOperand(1))) + if (auto *CI = dyn_cast(Operands[1])) if (CI->getValue().getActiveBits() <= 32) Idx = CI->getZExtValue(); - Type *DstTy = U->getOperand(0)->getType(); + Type *DstTy = Operands[0]->getType(); return TargetTTI->getVectorInstrCost(*EEI, DstTy, CostKind, Idx); } }