[llvm] db54627 - [MachineVerifier] Try harder to verify LiveIntervals
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 09:32:21 PDT 2023
Author: Jay Foad
Date: 2023-05-24T17:32:13+01:00
New Revision: db54627413fdcc96f356897e23db204557c48a80
URL: https://github.com/llvm/llvm-project/commit/db54627413fdcc96f356897e23db204557c48a80
DIFF: https://github.com/llvm/llvm-project/commit/db54627413fdcc96f356897e23db204557c48a80.diff
LOG: [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 https://github.com/llvm/llvm-project/issues/46217
Differential Revision: https://reviews.llvm.org/D129208
Added:
Modified:
llvm/lib/CodeGen/MachineVerifier.cpp
llvm/test/CodeGen/AArch64/regcoal-physreg.mir
llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-def-after-use.mir
llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-loop-phi.mir
llvm/test/CodeGen/AMDGPU/subreg-intervals.mir
llvm/test/CodeGen/X86/statepoint-cmp-sunk-past-statepoint.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 556047feca73d..8c5c7320b5094 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -297,6 +297,7 @@ namespace {
AU.addUsedIfAvailable<LiveStacks>();
AU.addUsedIfAvailable<LiveVariables>();
AU.addUsedIfAvailable<SlotIndexes>();
+ AU.addUsedIfAvailable<LiveIntervals>();
AU.setPreservesAll();
MachineFunctionPass::getAnalysisUsage(AU);
}
diff --git a/llvm/test/CodeGen/AArch64/regcoal-physreg.mir b/llvm/test/CodeGen/AArch64/regcoal-physreg.mir
index 05b66de3d0c34..270abeec822c0 100644
--- a/llvm/test/CodeGen/AArch64/regcoal-physreg.mir
+++ b/llvm/test/CodeGen/AArch64/regcoal-physreg.mir
@@ -1,8 +1,4 @@
-# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing,simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
-
-# FIXME: Second run of the pass is a workaround for a bug in
-# -run-pass. The verifier doesn't detect broken LiveIntervals, see bug
-# 46873
+# RUN: llc -mtriple=aarch64-apple-ios -run-pass=simple-register-coalescing -verify-machineinstrs %s -o - | FileCheck %s
--- |
declare void @f2()
diff --git a/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-def-after-use.mir b/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-def-after-use.mir
index 6658171c31035..61a0d47f060fc 100644
--- a/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-def-after-use.mir
+++ b/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-def-after-use.mir
@@ -1,9 +1,5 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
-# 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
-
-# FIXME: Second run of the pass is a workaround for a bug in
-# -run-pass. The verifier doesn't detect broken LiveIntervals, see bug
-# 46873
+# 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
# %8 is defined at the end, but it will be used in bb.2.
# Make sure we properly extend its liverange to the beginning of the bb.2.
diff --git a/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-loop-phi.mir b/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-loop-phi.mir
index 0093473964f12..84f9871527da0 100644
--- a/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-loop-phi.mir
+++ b/llvm/test/CodeGen/AMDGPU/optimize-exec-mask-pre-ra-loop-phi.mir
@@ -1,9 +1,5 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
-# 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
-
-# FIXME: Second run of the pass is a workaround for a bug in
-# -run-pass. The verifier doesn't detect broken LiveIntervals, see bug
-# 46873
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 -verify-machineinstrs -run-pass=si-optimize-exec-masking-pre-ra -o - %s | FileCheck %s
# Cannot fold this without moving the def of %7 after the and.
diff --git a/llvm/test/CodeGen/AMDGPU/subreg-intervals.mir b/llvm/test/CodeGen/AMDGPU/subreg-intervals.mir
index 54cd304ba01a4..4cda3fe001d00 100644
--- a/llvm/test/CodeGen/AMDGPU/subreg-intervals.mir
+++ b/llvm/test/CodeGen/AMDGPU/subreg-intervals.mir
@@ -1,31 +1,14 @@
# RUN: llc -march=amdgcn -run-pass liveintervals -debug-only=regalloc -verify-machineinstrs -o /dev/null %s 2>&1 | FileCheck %s
# REQUIRES: asserts
-# CHECK: INTERVALS
-# CHECK: %0
-# CHECK-LABEL: Machine code for function test0:
-
# CHECK: INTERVALS
# CHECK: %0
# CHECK-LABEL: Machine code for function test1:
--- |
- define amdgpu_kernel void @test0() { ret void }
define amdgpu_kernel void @test1() { ret void }
...
---
-name: test0
-registers:
- - { id: 0, class: sreg_64 }
-body: |
- bb.0:
- S_NOP 0, implicit-def %0
- S_NOP 0, implicit %0
-
- S_NOP 0, implicit-def undef %0.sub0
- S_NOP 0, implicit %0
-...
----
name: test1
registers:
- { id: 0, class: sreg_64 }
diff --git a/llvm/test/CodeGen/X86/statepoint-cmp-sunk-past-statepoint.ll b/llvm/test/CodeGen/X86/statepoint-cmp-sunk-past-statepoint.ll
index bd09b0388391e..63b2a9d415041 100644
--- a/llvm/test/CodeGen/X86/statepoint-cmp-sunk-past-statepoint.ll
+++ b/llvm/test/CodeGen/X86/statepoint-cmp-sunk-past-statepoint.ll
@@ -62,8 +62,8 @@ zero:
; CHECK: bb.5
; CHECK: %3:gr64 = COPY %10
; CHECK-LV: %4:gr64 = COPY killed %10
-; CHECK-LV: %4:gr64 = nuw ADD64ri32 %4, 8, implicit-def dead $eflags
-; CHECK-LIS: %4:gr64 = LEA64r %10, 1, $noreg, 8, $noreg
+; CHECK-LIS: %4:gr64 = COPY %10
+; CHECK: %4:gr64 = nuw ADD64ri32 %4, 8, implicit-def dead $eflags
; CHECK: TEST64rr killed %1, %1, implicit-def $eflags
; CHECK: JCC_1 %bb.1, 5, implicit killed $eflags
; CHECK: JMP_1 %bb.6
More information about the llvm-commits
mailing list