[PATCH] D124754: Minimal refactor of TargetTransformInfoImpl.h to avoid Clang Static Analyser's core.CallAndMessage (NFC)

Markus Lavin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 01:47:53 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdd8cf372c54f: [NFC] Minimal refactor of TTI to avoid clangsa complaint (authored by markus).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124754/new/

https://reviews.llvm.org/D124754

Files:
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h


Index: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -986,8 +986,6 @@
     }
 
     Type *Ty = U->getType();
-    Type *OpTy =
-      U->getNumOperands() == 1 ? U->getOperand(0)->getType() : nullptr;
     unsigned Opcode = Operator::getOpcode(U);
     auto *I = dyn_cast<Instruction>(U);
     switch (Opcode) {
@@ -1059,9 +1057,11 @@
     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<StoreInst>(U);
       Type *ValTy = U->getOperand(0)->getType();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124754.426601.patch
Type: text/x-patch
Size: 982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220503/803e6991/attachment.bin>


More information about the llvm-commits mailing list