-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[MCA] Use MCInstrAnalysis to analyse call/return instructions #123882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-systemz @llvm/pr-subscribers-tools-llvm-mca Author: Pengcheng Wang (wangpc-pp) ChangesThe flag set in Full diff: https://github.com/llvm/llvm-project/pull/123882.diff 1 Files Affected:
diff --git a/llvm/lib/MCA/InstrBuilder.cpp b/llvm/lib/MCA/InstrBuilder.cpp
index 933ede71746e06..9304e6c57a3859 100644
--- a/llvm/lib/MCA/InstrBuilder.cpp
+++ b/llvm/lib/MCA/InstrBuilder.cpp
@@ -219,11 +219,10 @@ static void initializeUsedResources(InstrDesc &ID,
});
}
-static void computeMaxLatency(InstrDesc &ID, const MCInstrDesc &MCDesc,
- const MCSchedClassDesc &SCDesc,
- const MCSubtargetInfo &STI,
- unsigned CallLatency) {
- if (MCDesc.isCall()) {
+static void computeMaxLatency(InstrDesc &ID, const MCSchedClassDesc &SCDesc,
+ const MCSubtargetInfo &STI, unsigned CallLatency,
+ bool IsCall) {
+ if (IsCall) {
// We cannot estimate how long this call will take.
// Artificially set an arbitrarily high latency.
ID.MaxLatency = CallLatency;
@@ -599,7 +598,8 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
ID->NumMicroOps = SCDesc.NumMicroOps;
ID->SchedClassID = SchedClassID;
- if (MCDesc.isCall() && FirstCallInst) {
+ bool IsCall = MCIA->isCall(MCI);
+ if (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. "
@@ -607,7 +607,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
FirstCallInst = false;
}
- if (MCDesc.isReturn() && FirstReturnInst) {
+ if (MCIA->isReturn(MCI) && FirstReturnInst) {
WithColor::warning() << "found a return instruction in the input"
<< " assembly sequence.\n";
WithColor::note() << "program counter updates are ignored.\n";
@@ -615,7 +615,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
}
initializeUsedResources(*ID, SCDesc, STI, ProcResourceMasks);
- computeMaxLatency(*ID, MCDesc, SCDesc, STI, CallLatency);
+ computeMaxLatency(*ID, SCDesc, STI, CallLatency, IsCall);
if (Error Err = verifyOperands(MCDesc, MCI))
return std::move(Err);
|
Is this testable? |
03a04f2
to
6c6435d
Compare
Yes, I added a precommit test and you can see the second commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add MCA test for jump instructions.
The flag set in `MCInstrDesc` is not accurate and we should use the result of `MCInstrAnalysis`.
6c6435d
to
e0f9ac8
Compare
The flag set in
MCInstrDesc
is not accurate and we should usethe result of
MCInstrAnalysis
.