Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 24, 2025

@llvm/pr-subscribers-pgo
@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-tools-llvm-exegesis

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/141353.diff

2 Files Affected:

  • (modified) llvm/lib/Transforms/IPO/SampleProfile.cpp (+1-3)
  • (modified) llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp (+1-5)
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 616eeae3b1fec..000b3ccbb3cbc 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -897,9 +897,7 @@ updateIDTMetaData(Instruction &Inst,
 
   llvm::sort(NewCallTargets,
              [](const InstrProfValueData &L, const InstrProfValueData &R) {
-               if (L.Count != R.Count)
-                 return L.Count > R.Count;
-               return L.Value > R.Value;
+               return std::tie(L.Count, L.Value) > std::tie(R.Count, R.Value);
              });
 
   uint32_t MaxMDCount =
diff --git a/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp b/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
index 0690c21220f89..d6dfb65bf82e6 100644
--- a/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SchedClassResolution.cpp
@@ -69,11 +69,7 @@ getNonRedundantWriteProcRes(const MCSchedClassDesc &SCDesc,
        [](const ResourceMaskAndEntry &A, const ResourceMaskAndEntry &B) {
          unsigned popcntA = popcount(A.first);
          unsigned popcntB = popcount(B.first);
-         if (popcntA < popcntB)
-           return true;
-         if (popcntA > popcntB)
-           return false;
-         return A.first < B.first;
+         return std::tie(popcntA, A.first) < std::tie(popcntB, B.first);
        });
 
   SmallVector<float, 32> ProcResUnitUsage(NumProcRes);

@kazutakahirata kazutakahirata merged commit 47b9837 into llvm:main May 24, 2025
15 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250524_std_tie_cmp branch May 24, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants