From dd8cf372c54fdb654d1a7e7578460eb95e6531f9 Mon Sep 17 00:00:00 2001 From: Markus Lavin Date: Tue, 3 May 2022 10:20:09 +0200 Subject: [PATCH] [NFC] Minimal refactor of TTI to avoid clangsa complaint Differential Revision: https://reviews.llvm.org/D124754 --- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index 9111b74d81ac..df0a2491b6ff 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -986,8 +986,6 @@ public: } Type *Ty = U->getType(); - Type *OpTy = - U->getNumOperands() == 1 ? U->getOperand(0)->getType() : nullptr; unsigned Opcode = Operator::getOpcode(U); auto *I = dyn_cast(U); switch (Opcode) { @@ -1059,9 +1057,11 @@ public: case Instruction::FPExt: case Instruction::SExt: case Instruction::ZExt: - case Instruction::AddrSpaceCast: + case Instruction::AddrSpaceCast: { + Type *OpTy = U->getOperand(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();