-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[X86] Avoid repeated hash lookups (NFC) #130710
Merged
kazutakahirata
merged 2 commits into
llvm:main
from
kazutakahirata:cleanup_001_repeated_hash_lookups_llvm_X86
Mar 11, 2025
Merged
[X86] Avoid repeated hash lookups (NFC) #130710
kazutakahirata
merged 2 commits into
llvm:main
from
kazutakahirata:cleanup_001_repeated_hash_lookups_llvm_X86
Mar 11, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-backend-x86 Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/130710.diff 1 Files Affected:
diff --git a/llvm/lib/Target/X86/X86PreTileConfig.cpp b/llvm/lib/Target/X86/X86PreTileConfig.cpp
index f2ec4369a5ca4..ebf6438b25c51 100644
--- a/llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ b/llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -293,29 +293,30 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
SmallVector<MachineBasicBlock *, 8> CfgLiveInBBs;
for (auto &MBB : MF) {
size_t Pos = 0;
+ auto &Info = BBVisitedInfo[&MBB];
for (auto &MI : MBB) {
++Pos;
if (isAMXInstruction(MI)) {
// If there's call before the AMX, we need to reload tile config.
- if (BBVisitedInfo[&MBB].LastCall)
- CfgNeedInsert.insert(BBVisitedInfo[&MBB].LastCall);
+ if (Info.LastCall)
+ CfgNeedInsert.insert(Info.LastCall);
else // Otherwise, we need tile config to live in this BB.
- BBVisitedInfo[&MBB].NeedTileCfgLiveIn = true;
+ Info.NeedTileCfgLiveIn = true;
// Always record the first AMX in case there's shape def after it.
- if (!BBVisitedInfo[&MBB].FirstAMX)
- BBVisitedInfo[&MBB].FirstAMX = MIRef(&MI, &MBB, Pos);
+ if (!Info.FirstAMX)
+ Info.FirstAMX = MIRef(&MI, &MBB, Pos);
} else if (MI.isCall() && isDestructiveCall(MI, AMXRegs)) {
// Record the call only if the callee clobbers all AMX registers.
- BBVisitedInfo[&MBB].LastCall = MIRef(&MI, &MBB, Pos);
+ Info.LastCall = MIRef(&MI, &MBB, Pos);
}
}
- if (BBVisitedInfo[&MBB].NeedTileCfgLiveIn) {
+ if (Info.NeedTileCfgLiveIn) {
if (&MBB == &MF.front())
CfgNeedInsert.insert(MIRef(&MBB));
else
CfgLiveInBBs.push_back(&MBB);
}
- if (BBVisitedInfo[&MBB].FirstAMX || BBVisitedInfo[&MBB].HasAMXRegLiveIn)
+ if (Info.FirstAMX || Info.HasAMXRegLiveIn)
for (auto *Succ : MBB.successors())
if (!isLoopBackEdge(Succ, &MBB))
BBVisitedInfo[Succ].HasAMXRegLiveIn = true;
@@ -344,16 +345,16 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
// Avoid to insert ldtilecfg before any shape defs.
SmallVector<MachineBasicBlock *, 8> WorkList;
for (auto &I : ShapeBBs) {
+ auto &Info = BBVisitedInfo[I.first];
// TODO: We can hoist shapes across BBs here.
- if (BBVisitedInfo[I.first].HasAMXRegLiveIn) {
+ if (Info.HasAMXRegLiveIn) {
// We are not able to config tile registers since the shape to config
// is not defined yet. Emit error message and continue. The function
// would not config tile registers.
emitErrorMsg(MF);
return false;
}
- if (BBVisitedInfo[I.first].FirstAMX &&
- BBVisitedInfo[I.first].FirstAMX < I.second.back() &&
+ if (Info.FirstAMX && Info.FirstAMX < I.second.back() &&
!hoistShapesInBB(I.first, I.second)) {
emitErrorMsg(MF);
return false;
@@ -363,8 +364,9 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
while (!WorkList.empty()) {
MachineBasicBlock *MBB = WorkList.pop_back_val();
for (auto *Pred : MBB->predecessors()) {
- if (!BBVisitedInfo[Pred].TileCfgForbidden && !isLoopBackEdge(MBB, Pred)) {
- BBVisitedInfo[Pred].TileCfgForbidden = true;
+ auto &Info = BBVisitedInfo[Pred];
+ if (!Info.TileCfgForbidden && !isLoopBackEdge(MBB, Pred)) {
+ Info.TileCfgForbidden = true;
WorkList.push_back(Pred);
}
}
|
nikic
reviewed
Mar 11, 2025
nikic
approved these changes
Mar 11, 2025
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/14414 Here is the relevant piece of the build log for the reference
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.