diff options
Diffstat (limited to 'llvm/tools/llvm-mca')
| -rw-r--r-- | llvm/tools/llvm-mca/include/InstrBuilder.h | 9 | ||||
| -rw-r--r-- | llvm/tools/llvm-mca/lib/InstrBuilder.cpp | 9 | 
2 files changed, 14 insertions, 4 deletions
| diff --git a/llvm/tools/llvm-mca/include/InstrBuilder.h b/llvm/tools/llvm-mca/include/InstrBuilder.h index 5f6adead105..1c958c5020e 100644 --- a/llvm/tools/llvm-mca/include/InstrBuilder.h +++ b/llvm/tools/llvm-mca/include/InstrBuilder.h @@ -46,6 +46,9 @@ class InstrBuilder {    DenseMap<unsigned short, std::unique_ptr<const InstrDesc>> Descriptors;    DenseMap<const MCInst *, std::unique_ptr<const InstrDesc>> VariantDescriptors; +  bool FirstCallInst; +  bool FirstReturnInst; +    Expected<const InstrDesc &> createInstrDescImpl(const MCInst &MCI);    Expected<const InstrDesc &> getOrCreateInstrDesc(const MCInst &MCI); @@ -60,7 +63,11 @@ public:    InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,                 const MCRegisterInfo &RI, const MCInstrAnalysis &IA); -  void clear() { VariantDescriptors.shrink_and_clear(); } +  void clear() { +    VariantDescriptors.shrink_and_clear(); +    FirstCallInst = true; +    FirstReturnInst = true; +  }    Expected<std::unique_ptr<Instruction>> createInstruction(const MCInst &MCI);  }; diff --git a/llvm/tools/llvm-mca/lib/InstrBuilder.cpp b/llvm/tools/llvm-mca/lib/InstrBuilder.cpp index b6c6a01d5ed..f691f466640 100644 --- a/llvm/tools/llvm-mca/lib/InstrBuilder.cpp +++ b/llvm/tools/llvm-mca/lib/InstrBuilder.cpp @@ -29,7 +29,8 @@ InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti,                             const llvm::MCInstrInfo &mcii,                             const llvm::MCRegisterInfo &mri,                             const llvm::MCInstrAnalysis &mcia) -    : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) { +    : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia), FirstCallInst(true), +      FirstReturnInst(true) {    computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);  } @@ -455,17 +456,19 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) {    std::unique_ptr<InstrDesc> ID = llvm::make_unique<InstrDesc>();    ID->NumMicroOps = SCDesc.NumMicroOps; -  if (MCDesc.isCall()) { +  if (MCDesc.isCall() && FirstCallInst) {      // We don't correctly model calls.      WithColor::warning() << "found a call in the input assembly sequence.\n";      WithColor::note() << "call instructions are not correctly modeled. "                        << "Assume a latency of 100cy.\n"; +    FirstCallInst = false;    } -  if (MCDesc.isReturn()) { +  if (MCDesc.isReturn() && FirstReturnInst) {      WithColor::warning() << "found a return instruction in the input"                           << " assembly sequence.\n";      WithColor::note() << "program counter updates are ignored.\n"; +    FirstReturnInst = false;    }    ID->MayLoad = MCDesc.mayLoad(); | 

