Skip to content

Commit af935cf

Browse files
authored
[CodeLayout] Fix X1_Y_X2 and Y_X2_X1 testing for jumps from Y (llvm#66592)
The CHECK2 test in code_placement_ext_tsp_large.ll now has the same result as the CHECK test: when chain(0,2,3,4,1) is merged with chain(8), the result is now chain(0,2,3,4,8,1). Ideally we should have test coverage for -ext-tsp-chain-split-threshold=1, but it seems challenging to craft one. Perhaps the default value of -ext-tsp-chain-split-threshold can be decreased as the -ext-tsp-enable-chain-split-along-jumps heuristic is now more powerful.
1 parent 345f532 commit af935cf

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

llvm/lib/Transforms/Utils/CodeLayout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ class ExtTSPImpl {
850850

851851
// Attach (a part of) ChainPred after the last node of ChainSucc.
852852
for (JumpT *Jump : ChainSucc->Nodes.back()->OutJumps) {
853-
const NodeT *DstBlock = Jump->Source;
853+
const NodeT *DstBlock = Jump->Target;
854854
if (DstBlock->CurChain != ChainPred)
855855
continue;
856856
size_t Offset = DstBlock->CurIndex;

llvm/test/CodeGen/X86/code_placement_ext_tsp_large.ll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,18 @@ define void @func_large() !prof !0 {
8181
; CHECK: b7
8282
; CHECK: b9
8383
;
84-
; An expected output with chain-split-threshold=1 (disabling splitting) -- the
85-
; increase of the layout score is smaller, ~7%:
84+
; An expected output with chain-split-threshold=1 (disabling split point enumeration)
8685
;
8786
; CHECK2-LABEL: Applying ext-tsp layout
8887
; CHECK2: original layout score: 9171074274.27
89-
; CHECK2: optimized layout score: 9810644873.57
88+
; CHECK2: optimized layout score: 10844307310.87
9089
; CHECK2: b0
9190
; CHECK2: b2
9291
; CHECK2: b3
9392
; CHECK2: b4
9493
; CHECK2: b5
95-
; CHECK2: b1
9694
; CHECK2: b8
95+
; CHECK2: b1
9796
; CHECK2: b6
9897
; CHECK2: b7
9998
; CHECK2: b9

0 commit comments

Comments
 (0)