[PATCH] D132966: [TTI] Allow passing ArrayRef of context instructions (NFC).

Bill Schmidt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 12:13:02 PDT 2022


wjschmidt added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:2292
     return Impl.getArithmeticInstrCost(Opcode, Ty, CostKind, Opd1Info, Opd2Info,
-                                       Args, CxtI);
+                                       Args, CxtIs);
   }
----------------
When applying this patch series, I see compilation errors like this:

In file included from /localdisk2/schmidtw/llvm-project/llvm/lib/Target/Lanai/LanaiTargetTransformInfo.h:22,
                 from /localdisk2/schmidtw/llvm-project/llvm/lib/Target/Lanai/La
naiTargetMachine.cpp:17:
/localdisk2/schmidtw/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo
.h: In instantiation of ‘llvm::InstructionCost llvm::TargetTransformInfo::Model<
T>::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo:
:TargetCostKind, llvm::TargetTransformInfo::OperandValueInfo, llvm::TargetTransf
ormInfo::OperandValueInfo, llvm::ArrayRef<const llvm::Value*>, llvm::ArrayRef<co
nst llvm::Instruction*>) [with T = llvm::LanaiTTIImpl]’:
/localdisk2/schmidtw/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo
.h:2308:3:   required from here
/localdisk2/schmidtw/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo
.h:2314:46: error: cannot convert ‘llvm::ArrayRef<const llvm::Instruction*>’ to
‘const llvm::Instruction*’
 2314 |                                        Args, CxtIs);
      |                                              ^~~~~
      |                                              |
      |                                              llvm::ArrayRef<const llvm::
Instruction*>
In file included from /localdisk2/schmidtw/llvm-project/llvm/lib/Target/Lanai/La
naiTargetMachine.cpp:17:
/localdisk2/schmidtw/llvm-project/llvm/lib/Target/Lanai/LanaiTargetTransformInfo
.h:98:26: note:   initializing argument 7 of ‘llvm::InstructionCost llvm::LanaiT
TIImpl::getArithmeticInstrCost(unsigned int, llvm::Type*, llvm::TargetTransformI
nfo::TargetCostKind, llvm::TargetTransformInfo::OperandValueInfo, llvm::TargetTr
ansformInfo::OperandValueInfo, llvm::ArrayRef<const llvm::Value*>, const llvm::I
nstruction*)’
   98 |       const Instruction *CxtI = nullptr) {
      |       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

This occurs for Lanai, SystemZ, PowerPC, Hexagon, BPF, and NVPTX.


================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:884
+          Opcode, VTy->getScalarType(), CostKind, Opd1Info, Opd2Info, Args,
+          CxtIs);
       // Return the cost of multiple scalar invocation plus the cost of
----------------
When applying this patch series, I see compilation errors for various targets stemming from this.  Example:

In file included from /localdisk2/schmidtw/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h:23,                                                         from /localdisk2/schmidtw/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp:15:
/localdisk2/schmidtw/llvm-project/llvm/include/llvm/CodeGen/BasicTTIImpl.h: In i
nstantiation of ‘llvm::InstructionCost llvm::BasicTTIImplBase<T>::getArithmeticI
nstrCost(unsigned int, llvm::Type*, llvm::TargetTransformInfo::TargetCostKind, llvm::TargetTransformInfo::OperandValueInfo, llvm::TargetTransformInfo::OperandValueInfo, llvm::ArrayRef<const llvm::Value*>, llvm::ArrayRef<const llvm::Instruct
ion*>) [with T = llvm::WebAssemblyTTIImpl]’:                                    /localdisk2/schmidtw/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetT
ransformInfo.cpp:60:45:   required from here
/localdisk2/schmidtw/llvm-project/llvm/include/llvm/CodeGen/BasicTTIImpl.h:884:1
1: error: cannot convert ‘llvm::ArrayRef<const llvm::Instruction*>’ to ‘const ll
vm::Instruction*’
  884 |           CxtIs);
      |           ^~~~~
      |           |
      |           llvm::ArrayRef<const llvm::Instruction*>
/localdisk2/schmidtw/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetT
ransformInfo.cpp:57:24: note:   initializing argument 7 of ‘llvm::InstructionCos
t llvm::WebAssemblyTTIImpl::getArithmeticInstrCost(unsigned int, llvm::Type*, ll
vm::TargetTransformInfo::TargetCostKind, llvm::TargetTransformInfo::OperandValue
Info, llvm::TargetTransformInfo::OperandValueInfo, llvm::ArrayRef<const llvm::Va
lue*>, const llvm::Instruction*)’
   57 |     const Instruction *CxtI) {
      |     ~~~~~~~~~~~~~~~~~~~^~~~

Appears for WebAssembly, Lanai, SystemZ, Hexagon, NVPTX, PowerPC, BPF, and AMDGPU.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132966



More information about the llvm-commits mailing list