[PATCH] D108977: [AArch64] Support target specific isSuitableForJumpTable

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 02:21:41 PDT 2021


jaykang10 created this revision.
jaykang10 added reviewers: t.p.northover, evandro, aemerson, dmgreen, sanwou01.
Herald added subscribers: hiraditya, kristof.beyls.
jaykang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

On `TargetLowering::isSuitableForJumpTable`, the minimum size is not checked. This patch checks it on AArch64's `isSuitableForJumpTable`.

We could want to set `setMinimumJumpTableEntries` in order to adjust the minimum size of jump table. At the beginning of `findJumpTables`, it is compared to the number of clusters without considering each cluster which might be optimized for adjacent cases with same destination block. I think it would be better to check the minimum size of jump table on `isSuitableForJumpTable` to consider the each cluster.

As you can see, this patch affects existing tests which are related to jump table on AArch64. If there were certain assumptions of the jump table size on AArch64, please let me know.

I have checked the benchmark scores and the scores are as below.

  spec2017 Ofast	score improvement(%)
  500.perlbench_r	1.120718061
  502.gcc_r	0.21566066
  505.mcf_r	-0.377692164
  520.omnetpp_r	-0.033963362
  523.xalancbmk_r	-0.710515296
  525.x264_r	-0.009670442
  531.deepsjeng_r	-0.151793551
  541.leela_r	0.000412303
  548.exchange2_r	-0.005073052
  557.xz_r	0.14042818
  	
  spec2017 O3 lto	score improvement(%)
  500.perlbench_r	0.499563704
  502.gcc_r	1.243011689
  505.mcf_r	-0.448723782
  520.omnetpp_r	-0.343839249
  523.xalancbmk_r	-0.857326043
  525.x264_r	0.1447399
  531.deepsjeng_r	0.271570876
  541.leela_r	-0.008724735
  548.exchange2_r	-0.004679532
  557.xz_r	-0.131507228
  	
  spec2006 O3 lto	score improvement(%)
  400.perlbench	0.606229456
  401.bzip2	-0.855386753
  403.gcc	0.674752856
  429.mcf	-0.007256516
  445.gobmk	-0.175565964
  456.hmmer	0.225698132
  458.sjeng	0.016811133
  462.libquantum	-0.366765648
  464.h264ref	1.29015527
  471.omnetpp	1.148017212
  473.astar	-0.114839198
  483.xalancbmk	0.1115539
  
  Tests: 778
  Same hash: 313 (filtered out) 
  Remaining: 465
  Metric: exec_time
  
  Program                                        results.org results.mod diff 
   test-suite...128UniformDivisor<__uint128_t>    12.37       12.37       0.0%
   test-suite...emCmp<3, GreaterThanZero, Mid>   2737.85     2737.85      0.0% 
   test-suite...emCmp<4, GreaterThanZero, Mid>   1634.42     1634.42      0.0% 
   test-suite...Cmp<4, GreaterThanZero, First>   1627.17     1627.17      0.0% 
   test-suite...mCmp<4, GreaterThanZero, None>   1633.03     1633.03      0.0% 
   test-suite..._MemCmp<4, LessThanZero, Last>   1504.30     1504.30      0.0% 
   test-suite...M_MemCmp<4, LessThanZero, Mid>   1510.02     1510.02      0.0% 
   test-suite...MemCmp<4, LessThanZero, First>   1503.89     1503.89      0.0% 
   test-suite..._MemCmp<4, LessThanZero, None>   1503.94     1503.94      0.0% 
   test-suite...est:BM_MemCmp<4, EqZero, Last>   953.13      953.13       0.0%
   test-suite...test:BM_MemCmp<4, EqZero, Mid>   994.46      994.46       0.0%
   test-suite...st:BM_MemCmp<4, EqZero, First>   953.40      953.40       0.0%
   test-suite...est:BM_MemCmp<4, EqZero, None>   957.15      957.15       0.0%
   test-suite...mCmp<3, GreaterThanZero, Last>   2883.71     2883.71      0.0% 
   test-suite...Cmp<3, GreaterThanZero, First>   2766.46     2766.46      0.0% 
   Geomean difference                                                     0.0%
           results.org    results.mod   diff 
  count  465.000000     465.000000     465.0
  mean   3433.740927    3433.740927    0.0  
  std    33459.989197   33459.989197   0.0  
  min    0.052810       0.052810       0.0
  25%    25.266975      25.266975      0.0  
  50%    334.556472     334.556472     0.0  
  75%    1036.344130    1036.344130    0.0  
  max    507694.300000  507694.300000  0.0


https://reviews.llvm.org/D108977

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator-switch.ll
  llvm/test/CodeGen/AArch64/arm64-jumptable.ll
  llvm/test/CodeGen/AArch64/bti-branch-relaxation.ll
  llvm/test/CodeGen/AArch64/jump-table-32.ll
  llvm/test/CodeGen/AArch64/jump-table-exynos.ll
  llvm/test/CodeGen/AArch64/jump-table.ll
  llvm/test/CodeGen/AArch64/max-jump-table.ll
  llvm/test/CodeGen/AArch64/min-jump-table.ll
  llvm/test/CodeGen/AArch64/patchable-function-entry-bti.ll
  llvm/test/CodeGen/AArch64/switch-unreachable-default.ll
  llvm/test/CodeGen/AArch64/win64-jumptable.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108977.369652.patch
Type: text/x-patch
Size: 25613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210831/c71425d3/attachment.bin>


More information about the llvm-commits mailing list