Skip to content

Commit db54627

Browse files
committed
[MachineVerifier] Try harder to verify LiveIntervals
Verify the LiveIntervals analysis after a pass that claims to preserve it, even if there are no further passes (apart from the verifier itself) that would use the analysis. Fixes llvm#46217 Differential Revision: https://reviews.llvm.org/D129208
1 parent 78bf8a0 commit db54627

File tree

6 files changed

+6
-34
lines changed

6 files changed

+6
-34
lines changed

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ namespace {
297297
AU.addUsedIfAvailable<LiveStacks>();
298298
AU.addUsedIfAvailable<LiveVariables>();
299299
AU.addUsedIfAvailable<SlotIndexes>();
300+
AU.addUsedIfAvailable<LiveIntervals>();
300301
AU.setPreservesAll();
301302
MachineFunctionPass::getAnalysisUsage(AU);
302303
}

llvm/test/CodeGen/AArch64/regcoal-physreg.mir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing,simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
2-
3-
# FIXME: Second run of the pass is a workaround for a bug in
4-
# -run-pass. The verifier doesn't detect broken LiveIntervals, see bug
5-
# 46873
1+
# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
62
--- |
73
declare void @f2()
84

llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-def-after-use.mir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2-
# RUN: llc -mtriple amdgcn-amd-amdhsa -mcpu=gfx1030 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra,si-optimize-exec-masking-pre-ra %s -o - | FileCheck --check-prefix=GCN %s
3-
4-
# FIXME: Second run of the pass is a workaround for a bug in
5-
# -run-pass. The verifier doesn't detect broken LiveIntervals, see bug
6-
# 46873
2+
# RUN: llc -mtriple amdgcn-amd-amdhsa -mcpu=gfx1030 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra %s -o - | FileCheck --check-prefix=GCN %s
73

84
# %8 is defined at the end, but it will be used in bb.2.
95
# Make sure we properly extend its liverange to the beginning of the bb.2.

llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-loop-phi.mir

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2-
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra,si-optimize-exec-masking-pre-ra -o - %s | FileCheck %s
3-
4-
# FIXME: Second run of the pass is a workaround for a bug in
5-
# -run-pass. The verifier doesn't detect broken LiveIntervals, see bug
6-
# 46873
2+
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra -o - %s | FileCheck %s
73

84

95
# Cannot fold this without moving the def of %7 after the and.

llvm/test/CodeGen/AMDGPU/subreg-intervals.mir

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
11
# RUN: llc -march=amdgcn -run-pass liveintervals -debug-only=regalloc -verify-machineinstrs -o /dev/null %s 2>&1 | FileCheck %s
22
# REQUIRES: asserts
33

4-
# CHECK: INTERVALS
5-
# CHECK: %0
6-
# CHECK-LABEL: Machine code for function test0:
7-
84
# CHECK: INTERVALS
95
# CHECK: %0
106
# CHECK-LABEL: Machine code for function test1:
117

128
--- |
13-
define amdgpu_kernel void @test0() { ret void }
149
define amdgpu_kernel void @test1() { ret void }
1510
...
1611
---
17-
name: test0
18-
registers:
19-
- { id: 0, class: sreg_64 }
20-
body: |
21-
bb.0:
22-
S_NOP 0, implicit-def %0
23-
S_NOP 0, implicit %0
24-
25-
S_NOP 0, implicit-def undef %0.sub0
26-
S_NOP 0, implicit %0
27-
...
28-
---
2912
name: test1
3013
registers:
3114
- { id: 0, class: sreg_64 }

llvm/test/CodeGen/X86/statepoint-cmp-sunk-past-statepoint.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ zero:
6262
; CHECK: bb.5
6363
; CHECK: %3:gr64 = COPY %10
6464
; CHECK-LV: %4:gr64 = COPY killed %10
65-
; CHECK-LV: %4:gr64 = nuw ADD64ri32 %4, 8, implicit-def dead $eflags
66-
; CHECK-LIS: %4:gr64 = LEA64r %10, 1, $noreg, 8, $noreg
65+
; CHECK-LIS: %4:gr64 = COPY %10
66+
; CHECK: %4:gr64 = nuw ADD64ri32 %4, 8, implicit-def dead $eflags
6767
; CHECK: TEST64rr killed %1, %1, implicit-def $eflags
6868
; CHECK: JCC_1 %bb.1, 5, implicit killed $eflags
6969
; CHECK: JMP_1 %bb.6

0 commit comments

Comments
 (0)