Skip to content

Commit cb5fbd2

Browse files
authored
[CodeLayout] Do not verify after assigning blocks (#111754)
Rather than invariantly running `F->verify()` when asserts are enabled, run machine IR verification in LIT tests only. Swap `CHECK-PERF` and `CHECK-SIZE` in `code_placement_ext_tsp_large.ll`. Remove `={0,1,true,false}` from flags in tests.
1 parent 0348373 commit cb5fbd2

File tree

4 files changed

+23
-28
lines changed

4 files changed

+23
-28
lines changed

llvm/lib/CodeGen/MachineBlockPlacement.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3572,7 +3572,7 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
35723572
if (UseExtTspForPerf || UseExtTspForSize) {
35733573
assert(
35743574
!(UseExtTspForPerf && UseExtTspForSize) &&
3575-
"UseExtTspForPerf and UseExtTspForSize can not be set simultaneosly");
3575+
"UseExtTspForPerf and UseExtTspForSize can not be set simultaneously");
35763576
applyExtTsp(/*OptForSize=*/UseExtTspForSize);
35773577
createCFGChainExtTsp();
35783578
}
@@ -3745,11 +3745,6 @@ void MachineBlockPlacement::assignBlockOrder(
37453745
continue;
37463746
MBB.updateTerminator(FTMBB);
37473747
}
3748-
3749-
#ifndef NDEBUG
3750-
// Make sure we correctly constructed all branches.
3751-
F->verify(this, "After optimized block reordering", &errs());
3752-
#endif
37533748
}
37543749

37553750
void MachineBlockPlacement::createCFGChainExtTsp() {

llvm/test/CodeGen/X86/code_placement_ext_tsp.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
;; See also llvm/unittests/Transforms/Utils/CodeLayoutTest.cpp
2-
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -enable-ext-tsp-block-placement=1 < %s | FileCheck %s
2+
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -enable-ext-tsp-block-placement < %s | FileCheck %s
33

44
define void @func1a() {
55
; Test that the algorithm positions the most likely successor first

llvm/test/CodeGen/X86/code_placement_ext_tsp_large.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; REQUIRES: asserts
2-
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -enable-ext-tsp-block-placement=1 -ext-tsp-chain-split-threshold=128 -debug-only=block-placement < %s 2>&1 | FileCheck %s
3-
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -enable-ext-tsp-block-placement=1 -ext-tsp-chain-split-threshold=1 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK2
4-
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -enable-ext-tsp-block-placement=0 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK3
5-
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -enable-ext-tsp-block-placement=1 -ext-tsp-block-placement-max-blocks=8 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK4
2+
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -enable-ext-tsp-block-placement -ext-tsp-chain-split-threshold=128 -debug-only=block-placement < %s 2>&1 | FileCheck %s
3+
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -enable-ext-tsp-block-placement -ext-tsp-chain-split-threshold=1 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK2
4+
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK3
5+
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -enable-ext-tsp-block-placement -ext-tsp-block-placement-max-blocks=8 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK4
66

77
@yydebug = dso_local global i32 0, align 4
88

llvm/test/CodeGen/X86/code_placement_ext_tsp_size.ll

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -apply-ext-tsp-for-size=true < %s | FileCheck %s -check-prefix=CHECK-PERF
2-
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -apply-ext-tsp-for-size=false < %s | FileCheck %s -check-prefix=CHECK-SIZE
1+
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -apply-ext-tsp-for-size < %s | FileCheck %s -check-prefix=CHECK-SIZE
2+
; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs < %s | FileCheck %s -check-prefix=CHECK-PERF
33

44
define void @func1() minsize {
55
;
@@ -19,15 +19,15 @@ define void @func1() minsize {
1919
; | b2 | <+
2020
; +-----+
2121
;
22-
; CHECK-PERF-LABEL: func1:
23-
; CHECK-PERF: %b0
24-
; CHECK-PERF: %b1
25-
; CHECK-PERF: %b2
26-
;
2722
; CHECK-SIZE-LABEL: func1:
2823
; CHECK-SIZE: %b0
29-
; CHECK-SIZE: %b2
3024
; CHECK-SIZE: %b1
25+
; CHECK-SIZE: %b2
26+
;
27+
; CHECK-PERF-LABEL: func1:
28+
; CHECK-PERF: %b0
29+
; CHECK-PERF: %b2
30+
; CHECK-PERF: %b1
3131

3232
b0:
3333
%call = call zeroext i1 @a()
@@ -75,21 +75,21 @@ define void @func_loop() minsize !prof !9 {
7575
; | end |
7676
; +--------+
7777
;
78-
; CHECK-PERF-LABEL: func_loop:
79-
; CHECK-PERF: %entry
80-
; CHECK-PERF: %header
81-
; CHECK-PERF: %if.then
82-
; CHECK-PERF: %if.else
83-
; CHECK-PERF: %if.end
84-
; CHECK-PERF: %end
85-
;
8678
; CHECK-SIZE-LABEL: func_loop:
8779
; CHECK-SIZE: %entry
8880
; CHECK-SIZE: %header
81+
; CHECK-SIZE: %if.then
8982
; CHECK-SIZE: %if.else
9083
; CHECK-SIZE: %if.end
91-
; CHECK-SIZE: %if.then
9284
; CHECK-SIZE: %end
85+
;
86+
; CHECK-PERF-LABEL: func_loop:
87+
; CHECK-PERF: %entry
88+
; CHECK-PERF: %header
89+
; CHECK-PERF: %if.else
90+
; CHECK-PERF: %if.end
91+
; CHECK-PERF: %if.then
92+
; CHECK-PERF: %end
9393

9494
entry:
9595
br label %header

0 commit comments

Comments
 (0)