[llvm] r347514 - [llvm-mca] InstrBuilder: warnings for call/ret instructions are only reported once.
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 24 10:40:45 PST 2018
Author: adibiagio
Date: Sat Nov 24 10:40:45 2018
New Revision: 347514
URL: http://llvm.org/viewvc/llvm-project?rev=347514&view=rev
Log:
[llvm-mca] InstrBuilder: warnings for call/ret instructions are only reported once.
Modified:
llvm/trunk/tools/llvm-mca/include/InstrBuilder.h
llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp
Modified: llvm/trunk/tools/llvm-mca/include/InstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/include/InstrBuilder.h?rev=347514&r1=347513&r2=347514&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/include/InstrBuilder.h (original)
+++ llvm/trunk/tools/llvm-mca/include/InstrBuilder.h Sat Nov 24 10:40:45 2018
@@ -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);
};
Modified: llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp?rev=347514&r1=347513&r2=347514&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp (original)
+++ llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp Sat Nov 24 10:40:45 2018
@@ -29,7 +29,8 @@ InstrBuilder::InstrBuilder(const llvm::M
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
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();
More information about the llvm-commits
mailing list