[llvm] [NFC] Add reference to the clustering algortihm for switch statements (PR #98239)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 15:59:41 PDT 2024


https://github.com/hiraditya created https://github.com/llvm/llvm-project/pull/98239

Menezes, Evandro, Sebastian Pop, and Aditya Kumar. "Clustering case statements for indirect branch predictors." arXiv preprint arXiv:1910.02351 (2019).

https://arxiv.org/pdf/1910.02351v2

>From 48049f7b008ea89f49b661e42e08ae2d8399153e Mon Sep 17 00:00:00 2001
From: AdityaK <hiraditya at msn.com>
Date: Tue, 9 Jul 2024 15:58:21 -0700
Subject: [PATCH] [NFC] Add reference to the clustering algortihm for switch
 statements

Menezes, Evandro, Sebastian Pop, and Aditya Kumar. "Clustering case statements for indirect branch predictors." arXiv preprint arXiv:1910.02351 (2019).

https://arxiv.org/pdf/1910.02351v2
---
 llvm/lib/CodeGen/SwitchLoweringUtils.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGen/SwitchLoweringUtils.cpp b/llvm/lib/CodeGen/SwitchLoweringUtils.cpp
index 8922fa5898133..e741a0fc49fb3 100644
--- a/llvm/lib/CodeGen/SwitchLoweringUtils.cpp
+++ b/llvm/lib/CodeGen/SwitchLoweringUtils.cpp
@@ -104,7 +104,8 @@ void SwitchCG::SwitchLowering::findJumpTables(CaseClusterVector &Clusters,
   // for the Case Statement'" (1994), but builds the MinPartitions array in
   // reverse order to make it easier to reconstruct the partitions in ascending
   // order. In the choice between two optimal partitionings, it picks the one
-  // which yields more jump tables.
+  // which yields more jump tables. The algorithm is described in
+  // https://arxiv.org/pdf/1910.02351v2
 
   // MinPartitions[i] is the minimum nbr of partitions of Clusters[i..N-1].
   SmallVector<unsigned, 8> MinPartitions(N);
@@ -574,4 +575,4 @@ SwitchCG::SwitchLowering::computeSplitWorkItemInfo(
   assert(FirstRight <= W.LastCluster);
 
   return SplitWorkItemInfo{LastLeft, FirstRight, LeftProb, RightProb};
-}
\ No newline at end of file
+}



More information about the llvm-commits mailing list