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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 21:26:36 PDT 2024


Author: AdityaK
Date: 2024-07-09T21:26:32-07:00
New Revision: 3e4adef9467734a3ced62a651ae7f35f5bf45901

URL: https://github.com/llvm/llvm-project/commit/3e4adef9467734a3ced62a651ae7f35f5bf45901
DIFF: https://github.com/llvm/llvm-project/commit/3e4adef9467734a3ced62a651ae7f35f5bf45901.diff

LOG: [NFC] Add reference to the clustering algortihm for switch statements (#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

Added: 
    

Modified: 
    llvm/lib/CodeGen/SwitchLoweringUtils.cpp

Removed: 
    


################################################################################
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