[llvm] r330807 - [llvm-mca] Remove method Instruction::isZeroLatency(). NFCI
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 25 02:38:58 PDT 2018
Author: adibiagio
Date: Wed Apr 25 02:38:58 2018
New Revision: 330807
URL: http://llvm.org/viewvc/llvm-project?rev=330807&view=rev
Log:
[llvm-mca] Remove method Instruction::isZeroLatency(). NFCI
Modified:
llvm/trunk/tools/llvm-mca/Dispatch.cpp
llvm/trunk/tools/llvm-mca/InstrBuilder.cpp
llvm/trunk/tools/llvm-mca/Instruction.cpp
llvm/trunk/tools/llvm-mca/Instruction.h
llvm/trunk/tools/llvm-mca/Scheduler.cpp
Modified: llvm/trunk/tools/llvm-mca/Dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Dispatch.cpp?rev=330807&r1=330806&r2=330807&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Dispatch.cpp (original)
+++ llvm/trunk/tools/llvm-mca/Dispatch.cpp Wed Apr 25 02:38:58 2018
@@ -406,9 +406,13 @@ void DispatchUnit::dispatch(unsigned IID
AvailableEntries -= NumMicroOps;
}
- // Update RAW dependencies.
- for (std::unique_ptr<ReadState> &RS : NewInst->getUses())
- updateRAWDependencies(*RS, STI);
+ // Update RAW dependencies if this instruction is not a zero-latency
+ // instruction. The assumption is that a zero-latency instruction doesn't
+ // require to be issued to the scheduler for execution. More importantly, it
+ // doesn't have to wait on the register input operands.
+ if (NewInst->getDesc().MaxLatency)
+ for (std::unique_ptr<ReadState> &RS : NewInst->getUses())
+ updateRAWDependencies(*RS, STI);
// Allocate new mappings.
SmallVector<unsigned, 4> RegisterFiles(RAT->getNumRegisterFiles());
Modified: llvm/trunk/tools/llvm-mca/InstrBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/InstrBuilder.cpp?rev=330807&r1=330806&r2=330807&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/InstrBuilder.cpp (original)
+++ llvm/trunk/tools/llvm-mca/InstrBuilder.cpp Wed Apr 25 02:38:58 2018
@@ -139,8 +139,6 @@ static void populateWrites(InstrDesc &ID
const MCInstrDesc &MCDesc,
const MCSchedClassDesc &SCDesc,
const MCSubtargetInfo &STI) {
- computeMaxLatency(ID, MCDesc, SCDesc, STI);
-
// Set if writes through this opcode may update super registers.
// TODO: on x86-64, a 4 byte write of a general purpose register always
// fully updates the super-register.
@@ -410,6 +408,7 @@ void InstrBuilder::createInstrDescImpl(c
ID->HasSideEffects = MCDesc.hasUnmodeledSideEffects();
initializeUsedResources(*ID, SCDesc, STI, ProcResourceMasks);
+ computeMaxLatency(*ID, MCDesc, SCDesc, STI);
populateWrites(*ID, MCI, MCDesc, SCDesc, STI);
populateReads(*ID, MCI, MCDesc, SCDesc, STI);
@@ -431,7 +430,7 @@ InstrBuilder::createInstruction(unsigned
const InstrDesc &D = getOrCreateInstrDesc(MCI);
std::unique_ptr<Instruction> NewIS = llvm::make_unique<Instruction>(D);
- // Populate Reads first.
+ // Initialize Reads first.
for (const ReadDescriptor &RD : D.Reads) {
int RegID = -1;
if (RD.OpIndex != -1) {
@@ -455,7 +454,7 @@ InstrBuilder::createInstruction(unsigned
NewIS->getUses().emplace_back(llvm::make_unique<ReadState>(RD, RegID));
}
- // Now populate writes.
+ // Initialize writes.
for (const WriteDescriptor &WD : D.Writes) {
unsigned RegID =
WD.OpIndex == -1 ? WD.RegisterID : MCI.getOperand(WD.OpIndex).getReg();
Modified: llvm/trunk/tools/llvm-mca/Instruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Instruction.cpp?rev=330807&r1=330806&r2=330807&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Instruction.cpp (original)
+++ llvm/trunk/tools/llvm-mca/Instruction.cpp Wed Apr 25 02:38:58 2018
@@ -116,10 +116,6 @@ void Instruction::execute() {
Stage = IS_EXECUTED;
}
-bool Instruction::isZeroLatency() const {
- return Desc.MaxLatency == 0 && Defs.size() == 0 && Uses.size() == 0;
-}
-
void Instruction::update() {
if (!isDispatched())
return;
Modified: llvm/trunk/tools/llvm-mca/Instruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Instruction.h?rev=330807&r1=330806&r2=330807&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Instruction.h (original)
+++ llvm/trunk/tools/llvm-mca/Instruction.h Wed Apr 25 02:38:58 2018
@@ -313,7 +313,6 @@ public:
bool isReady() const { return Stage == IS_READY; }
bool isExecuting() const { return Stage == IS_EXECUTING; }
bool isExecuted() const { return Stage == IS_EXECUTED; }
- bool isZeroLatency() const;
void retire() {
assert(isExecuted() && "Instruction is in an invalid state!");
Modified: llvm/trunk/tools/llvm-mca/Scheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Scheduler.cpp?rev=330807&r1=330806&r2=330807&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Scheduler.cpp (original)
+++ llvm/trunk/tools/llvm-mca/Scheduler.cpp Wed Apr 25 02:38:58 2018
@@ -263,7 +263,7 @@ void Scheduler::scheduleInstruction(unsi
// issued immediately to the pipeline(s). Any other in-order buffered
// resources (i.e. BufferSize=1) is consumed.
- if (!MCIS.isZeroLatency() && !Resources->mustIssueImmediately(Desc)) {
+ if (Desc.MaxLatency && !Resources->mustIssueImmediately(Desc)) {
DEBUG(dbgs() << "[SCHEDULER] Adding " << Idx << " to the Ready Queue\n");
ReadyQueue[Idx] = &MCIS;
return;
More information about the llvm-commits
mailing list