[llvm] [llc] Provide `opt` like verifier options (PR #106665)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 31 02:12:03 PDT 2024
https://github.com/paperchalice updated https://github.com/llvm/llvm-project/pull/106665
>From 49e3c1549e7d0df3bb8bba5ea38f9178ef9ce1e2 Mon Sep 17 00:00:00 2001
From: PaperChalice <liujunchang97 at outlook.com>
Date: Fri, 30 Aug 2024 13:20:28 +0800
Subject: [PATCH 1/2] [llc] Provide `opt` like verifier options
---
llvm/test/CodeGen/AArch64/PHIElimination-crash.mir | 2 +-
.../CodeGen/AArch64/PHIElimination-debugloc.mir | 2 +-
llvm/test/CodeGen/AArch64/statepoint-twoaddr.mir | 2 +-
.../AMDGPU/GlobalISel/twoaddr-extract-dyn-v7f64.mir | 2 +-
.../AMDGPU/early-lis-two-address-partial-def.mir | 2 +-
llvm/test/CodeGen/AMDGPU/gfx10-twoaddr-fma.mir | 2 +-
llvm/test/CodeGen/AMDGPU/gfx11-twoaddr-fma.mir | 2 +-
llvm/test/CodeGen/AMDGPU/phi-elimination-end-cf.mir | 2 +-
llvm/test/CodeGen/AMDGPU/split-mbb-lis-subrange.mir | 2 +-
.../AMDGPU/stale-livevar-in-twoaddr-pass.mir | 2 +-
llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir | 2 +-
llvm/test/CodeGen/AMDGPU/twoaddr-fma.mir | 4 ++--
llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir | 2 +-
llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir | 2 +-
llvm/test/CodeGen/Hexagon/two-addr-tied-subregs.mir | 2 +-
llvm/test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir | 2 +-
llvm/test/CodeGen/PowerPC/livevars-crash1.mir | 2 +-
llvm/test/CodeGen/PowerPC/livevars-crash2.mir | 2 +-
llvm/test/CodeGen/X86/distancemap.mir | 2 +-
llvm/test/CodeGen/X86/phielim-undef.mir | 2 +-
llvm/test/CodeGen/X86/twoaddr-mul2.mir | 2 +-
llvm/test/tools/llc/new-pm/pipeline.mir | 2 +-
llvm/test/tools/llc/new-pm/verify.mir | 2 +-
llvm/tools/llc/NewPMDriver.cpp | 13 +++++++++----
llvm/tools/llc/NewPMDriver.h | 4 +++-
llvm/tools/llc/llc.cpp | 11 ++++++++++-
26 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/llvm/test/CodeGen/AArch64/PHIElimination-crash.mir b/llvm/test/CodeGen/AArch64/PHIElimination-crash.mir
index 8f43686429268b..4e09580aeb218a 100644
--- a/llvm/test/CodeGen/AArch64/PHIElimination-crash.mir
+++ b/llvm/test/CodeGen/AArch64/PHIElimination-crash.mir
@@ -1,7 +1,7 @@
# RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -o /dev/null %s \
# RUN: -run-pass=livevars,phi-node-elimination,twoaddressinstruction \
# RUN: -no-phi-elim-live-out-early-exit=1 -phi-elim-split-all-critical-edges=1
-# RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -o /dev/null %s \
+# RUN: llc -mtriple=aarch64-linux-gnu -verify-each -o /dev/null %s \
# RUN: --passes='require<live-vars>,phi-node-elimination,two-address-instruction' \
# RUN: -no-phi-elim-live-out-early-exit=1 -phi-elim-split-all-critical-edges=1
diff --git a/llvm/test/CodeGen/AArch64/PHIElimination-debugloc.mir b/llvm/test/CodeGen/AArch64/PHIElimination-debugloc.mir
index 9b8283352161ac..01c44e3f253bb0 100644
--- a/llvm/test/CodeGen/AArch64/PHIElimination-debugloc.mir
+++ b/llvm/test/CodeGen/AArch64/PHIElimination-debugloc.mir
@@ -2,7 +2,7 @@
# RUN: -run-pass=livevars,phi-node-elimination,twoaddressinstruction \
# RUN: -no-phi-elim-live-out-early-exit=1 -phi-elim-split-all-critical-edges=1 \
# RUN: | FileCheck %s
-# RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -o - %s \
+# RUN: llc -mtriple=aarch64-linux-gnu -verify-each -o - %s \
# RUN: --passes='require<live-vars>,phi-node-elimination,two-address-instruction' \
# RUN: -no-phi-elim-live-out-early-exit=1 -phi-elim-split-all-critical-edges=1 \
# RUN: | FileCheck %s
diff --git a/llvm/test/CodeGen/AArch64/statepoint-twoaddr.mir b/llvm/test/CodeGen/AArch64/statepoint-twoaddr.mir
index c483d669a27584..c1ddc9c14d814b 100644
--- a/llvm/test/CodeGen/AArch64/statepoint-twoaddr.mir
+++ b/llvm/test/CodeGen/AArch64/statepoint-twoaddr.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64-unknown-linux -run-pass=twoaddressinstruction -verify-machineinstrs %s -o - | FileCheck %s
-# RUN: llc -mtriple=aarch64-unknown-linux --passes=two-address-instruction %s -o - | FileCheck %s
+# RUN: llc -mtriple=aarch64-unknown-linux --passes=two-address-instruction -verify-each %s -o - | FileCheck %s
# REQUIRES: aarch64-registered-target
# Verify that the register class is correctly constrained after the twoaddress replacement
diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/twoaddr-extract-dyn-v7f64.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/twoaddr-extract-dyn-v7f64.mir
index e84c51b73ad1e9..75148ecff5377a 100644
--- a/llvm/test/CodeGen/AMDGPU/GlobalISel/twoaddr-extract-dyn-v7f64.mir
+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/twoaddr-extract-dyn-v7f64.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -early-live-intervals -run-pass=liveintervals -run-pass=twoaddressinstruction -verify-machineinstrs -o - %s | FileCheck %s
-# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -passes='require<live-intervals>,two-address-instruction' -o - %s | FileCheck %s
+# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -passes='require<live-intervals>,two-address-instruction' -verify-each -o - %s | FileCheck %s
---
name: dyn_extract_v7f64_v_v
diff --git a/llvm/test/CodeGen/AMDGPU/early-lis-two-address-partial-def.mir b/llvm/test/CodeGen/AMDGPU/early-lis-two-address-partial-def.mir
index bf111d19f2147b..186b171f4e8056 100644
--- a/llvm/test/CodeGen/AMDGPU/early-lis-two-address-partial-def.mir
+++ b/llvm/test/CodeGen/AMDGPU/early-lis-two-address-partial-def.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -run-pass=liveintervals -run-pass=twoaddressinstruction -verify-machineinstrs -o - %s | FileCheck --check-prefix=GFX90A %s
-# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a --passes='require<live-intervals>,two-address-instruction' -o - %s | FileCheck --check-prefix=GFX90A %s
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a --passes='require<live-intervals>,two-address-instruction' -verify-each -o - %s | FileCheck --check-prefix=GFX90A %s
---
name: aligned_partial_vgpr_64
diff --git a/llvm/test/CodeGen/AMDGPU/gfx10-twoaddr-fma.mir b/llvm/test/CodeGen/AMDGPU/gfx10-twoaddr-fma.mir
index 0f20b8a2f1e29f..1768e39d1a06c5 100644
--- a/llvm/test/CodeGen/AMDGPU/gfx10-twoaddr-fma.mir
+++ b/llvm/test/CodeGen/AMDGPU/gfx10-twoaddr-fma.mir
@@ -1,5 +1,5 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GFX10 %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 %s --passes=two-address-instruction -o - | FileCheck --check-prefixes=GFX10 %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 %s --passes=two-address-instruction -verify-each -o - | FileCheck --check-prefixes=GFX10 %s
# GFX10-LABEL: name: test_fmamk_reg_imm_f16
# GFX10: %2:vgpr_32 = IMPLICIT_DEF
diff --git a/llvm/test/CodeGen/AMDGPU/gfx11-twoaddr-fma.mir b/llvm/test/CodeGen/AMDGPU/gfx11-twoaddr-fma.mir
index 91ade8806e4d1a..820b8579bd0a49 100644
--- a/llvm/test/CodeGen/AMDGPU/gfx11-twoaddr-fma.mir
+++ b/llvm/test/CodeGen/AMDGPU/gfx11-twoaddr-fma.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GFX11 %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s --passes=two-address-instruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GFX11 %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s --passes=two-address-instruction -verify-each -o - | FileCheck --check-prefixes=GFX11 %s
---
name: test_fmamk_reg_imm_f16
diff --git a/llvm/test/CodeGen/AMDGPU/phi-elimination-end-cf.mir b/llvm/test/CodeGen/AMDGPU/phi-elimination-end-cf.mir
index 8b009978055ac6..829d01d8e1c365 100644
--- a/llvm/test/CodeGen/AMDGPU/phi-elimination-end-cf.mir
+++ b/llvm/test/CodeGen/AMDGPU/phi-elimination-end-cf.mir
@@ -1,5 +1,5 @@
# RUN: llc -mtriple amdgcn -run-pass livevars -run-pass phi-node-elimination -verify-machineinstrs -o - %s | FileCheck %s
-# RUN: llc -mtriple amdgcn --passes='require<live-vars>,phi-node-elimination' -o - %s | FileCheck %s
+# RUN: llc -mtriple amdgcn --passes='require<live-vars>,phi-node-elimination' -verify-each -o - %s | FileCheck %s
# CHECK-LABEL: phi-cf-test
# CHECK: bb.0:
diff --git a/llvm/test/CodeGen/AMDGPU/split-mbb-lis-subrange.mir b/llvm/test/CodeGen/AMDGPU/split-mbb-lis-subrange.mir
index dfeca8db0b464e..0ee768466509ae 100644
--- a/llvm/test/CodeGen/AMDGPU/split-mbb-lis-subrange.mir
+++ b/llvm/test/CodeGen/AMDGPU/split-mbb-lis-subrange.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass liveintervals,phi-node-elimination -o - %s | FileCheck -check-prefixes=GCN %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 --passes='require<live-intervals>,phi-node-elimination' -o - %s | FileCheck -check-prefixes=GCN %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 --passes='require<live-intervals>,phi-node-elimination' -verify-each -o - %s | FileCheck -check-prefixes=GCN %s
# This checks liveintervals pass verification and phi-node-elimination correctly preserves them.
diff --git a/llvm/test/CodeGen/AMDGPU/stale-livevar-in-twoaddr-pass.mir b/llvm/test/CodeGen/AMDGPU/stale-livevar-in-twoaddr-pass.mir
index 4bb0046c0ee01a..77032ffcf18a91 100644
--- a/llvm/test/CodeGen/AMDGPU/stale-livevar-in-twoaddr-pass.mir
+++ b/llvm/test/CodeGen/AMDGPU/stale-livevar-in-twoaddr-pass.mir
@@ -1,5 +1,5 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=livevars,phi-node-elimination,twoaddressinstruction -verify-machineinstrs -o - %s | FileCheck %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx900 --passes='require<live-vars>,phi-node-elimination,two-address-instruction' -verify-machineinstrs -o - %s | FileCheck %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx900 --passes='require<live-vars>,phi-node-elimination,two-address-instruction' -verify-each -o - %s | FileCheck %s
# This used to fail under ASAN enabled build because we didn't update LiveVariables in SIInstrInfo::convertToThreeAddress()
# CHECK: _amdgpu_ps_main
diff --git a/llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir b/llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir
index ab6d207cd96686..b0a75a526cf2b7 100644
--- a/llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir
+++ b/llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir
@@ -1,5 +1,5 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx90a %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx90a %s --passes=two-address-instruction -o - | FileCheck -check-prefix=GCN %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx90a %s --passes=two-address-instruction -verify-each -o - | FileCheck -check-prefix=GCN %s
# GCN-LABEL: name: test_fmamk_reg_imm_f64
# GCN: V_FMA_F64_e64 0, killed %0, 0, %2, 0, killed %1, 0, 0, implicit $mode, implicit $exec
diff --git a/llvm/test/CodeGen/AMDGPU/twoaddr-fma.mir b/llvm/test/CodeGen/AMDGPU/twoaddr-fma.mir
index daac34bab0fd0e..1c444eca7675ca 100644
--- a/llvm/test/CodeGen/AMDGPU/twoaddr-fma.mir
+++ b/llvm/test/CodeGen/AMDGPU/twoaddr-fma.mir
@@ -1,7 +1,7 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GCN %s
# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GCN %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 %s --passes=two-address-instruction -o - | FileCheck --check-prefixes=GCN %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s --passes=two-address-instruction -o - | FileCheck --check-prefixes=GCN %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 %s --passes=two-address-instruction -verify-each -o - | FileCheck --check-prefixes=GCN %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s --passes=two-address-instruction -verify-each -o - | FileCheck --check-prefixes=GCN %s
# GCN-LABEL: name: test_fmamk_reg_imm_f32
# GCN: %2:vgpr_32 = IMPLICIT_DEF
diff --git a/llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir b/llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir
index 7062878a846097..9b1deb9aa9f730 100644
--- a/llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir
+++ b/llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir
@@ -1,5 +1,5 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx900 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx900 %s --passes=two-address-instruction -o - | FileCheck -check-prefix=GCN %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx900 %s --passes=two-address-instruction -verify-each -o - | FileCheck -check-prefix=GCN %s
# GCN-LABEL: name: test_madmk_reg_imm_f32
# GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec
diff --git a/llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir b/llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir
index 5fbb149548909d..98d2eca213aae1 100644
--- a/llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir
+++ b/llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir
@@ -1,5 +1,5 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
-# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s --passes=two-address-instruction -o - | FileCheck -check-prefix=GCN %s
+# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 %s --passes=two-address-instruction -verify-each -o - | FileCheck -check-prefix=GCN %s
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_f16_twoaddr_w32
# GCN: early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_F16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec
diff --git a/llvm/test/CodeGen/Hexagon/two-addr-tied-subregs.mir b/llvm/test/CodeGen/Hexagon/two-addr-tied-subregs.mir
index c533a5a167ab2f..d5753491dbad1b 100644
--- a/llvm/test/CodeGen/Hexagon/two-addr-tied-subregs.mir
+++ b/llvm/test/CodeGen/Hexagon/two-addr-tied-subregs.mir
@@ -1,5 +1,5 @@
# RUN: llc -march hexagon -run-pass livevars -run-pass twoaddressinstruction -verify-machineinstrs -o - %s | FileCheck %s
-# RUN: llc -march hexagon --passes='require<live-vars>,two-address-instruction' -o - %s | FileCheck %s
+# RUN: llc -march hexagon --passes='require<live-vars>,two-address-instruction' -verify-each -o - %s | FileCheck %s
###############################################################################
diff --git a/llvm/test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir b/llvm/test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir
index 2a669ed6b03a15..8bdf719f4bb5be 100644
--- a/llvm/test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir
+++ b/llvm/test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir
@@ -1,5 +1,5 @@
# RUN: llc -mtriple powerpc64-unknown-linux-gnu -run-pass livevars -run-pass phi-node-elimination -verify-machineinstrs -o - %s | FileCheck %s
-# RUN: llc -mtriple powerpc64-unknown-linux-gnu --passes='require<live-vars>,phi-node-elimination' -o - %s | FileCheck %s
+# RUN: llc -mtriple powerpc64-unknown-linux-gnu --passes='require<live-vars>,phi-node-elimination' -verify-each -o - %s | FileCheck %s
# This test case was originally known as
# test/CodeGen/PowerPC/2013-07-01-PHIElimBug.ll
diff --git a/llvm/test/CodeGen/PowerPC/livevars-crash1.mir b/llvm/test/CodeGen/PowerPC/livevars-crash1.mir
index 68d2e5a627e9d5..ec01a3c326cfa2 100644
--- a/llvm/test/CodeGen/PowerPC/livevars-crash1.mir
+++ b/llvm/test/CodeGen/PowerPC/livevars-crash1.mir
@@ -2,7 +2,7 @@
# RUN: -run-pass=livevars,phi-node-elimination -verify-machineinstrs | \
# RUN: FileCheck %s
# RUN: llc -mtriple powerpc64le-unknown-linux-gnu %s -o - 2>&1 \
-# RUN: --passes='require<live-vars>,phi-node-elimination' | \
+# RUN: --passes='require<live-vars>,phi-node-elimination' -verify-each | \
# RUN: FileCheck %s
--- |
diff --git a/llvm/test/CodeGen/PowerPC/livevars-crash2.mir b/llvm/test/CodeGen/PowerPC/livevars-crash2.mir
index e165c85d5b72a5..deaae3936cefb1 100644
--- a/llvm/test/CodeGen/PowerPC/livevars-crash2.mir
+++ b/llvm/test/CodeGen/PowerPC/livevars-crash2.mir
@@ -2,7 +2,7 @@
# RUN: -run-pass=livevars,phi-node-elimination -verify-machineinstrs | \
# RUN: FileCheck %s
# RUN: llc -mtriple powerpc64le-unknown-linux-gnu %s -o - 2>&1 \
-# RUN: --passes='require<live-vars>,phi-node-elimination' | \
+# RUN: --passes='require<live-vars>,phi-node-elimination' -verify-each | \
# RUN: FileCheck %s
--- |
diff --git a/llvm/test/CodeGen/X86/distancemap.mir b/llvm/test/CodeGen/X86/distancemap.mir
index 0a2f422302bd3a..8b0c4bfe9d000a 100644
--- a/llvm/test/CodeGen/X86/distancemap.mir
+++ b/llvm/test/CodeGen/X86/distancemap.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc %s -o - -mtriple=x86_64-unknown-linux -run-pass=twoaddressinstruction -verify-machineinstrs | FileCheck %s
-# RUN: llc %s -o - -mtriple=x86_64-unknown-linux --passes=two-address-instruction | FileCheck %s
+# RUN: llc %s -o - -mtriple=x86_64-unknown-linux --passes=two-address-instruction -verify-each | FileCheck %s
# In TwoAddressInstructionPass, new instructions should be added to DistanceMap.
# In this case, function convertInstTo3Addr is called on the first ADD
diff --git a/llvm/test/CodeGen/X86/phielim-undef.mir b/llvm/test/CodeGen/X86/phielim-undef.mir
index cebc725537d0ed..1200449b49c785 100644
--- a/llvm/test/CodeGen/X86/phielim-undef.mir
+++ b/llvm/test/CodeGen/X86/phielim-undef.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-- -verify-machineinstrs -o - %s -run-pass=livevars,phi-node-elimination,twoaddressinstruction | FileCheck %s
-# RUN: llc -mtriple=x86_64-- -verify-machineinstrs -o - %s --passes='require<live-vars>,phi-node-elimination,two-address-instruction' | FileCheck %s
+# RUN: llc -mtriple=x86_64-- -verify-machineinstrs -o - %s --passes='require<live-vars>,phi-node-elimination,two-address-instruction' -verify-each | FileCheck %s
--- |
@b114 = external global i16, align 1
diff --git a/llvm/test/CodeGen/X86/twoaddr-mul2.mir b/llvm/test/CodeGen/X86/twoaddr-mul2.mir
index e21005fa92397d..b24c893cc11fc4 100644
--- a/llvm/test/CodeGen/X86/twoaddr-mul2.mir
+++ b/llvm/test/CodeGen/X86/twoaddr-mul2.mir
@@ -1,6 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-unknown -mcpu=haswell -run-pass=twoaddressinstruction -verify-machineinstrs %s -o - | FileCheck %s
-# RUN: llc -mtriple=x86_64-unknown -mcpu=haswell --passes=two-address-instruction -verify-machineinstrs %s -o - | FileCheck %s
+# RUN: llc -mtriple=x86_64-unknown -mcpu=haswell --passes=two-address-instruction -verify-each %s -o - | FileCheck %s
# Check that we don't have any uses of [[COPY]] after it is killed.
---
diff --git a/llvm/test/tools/llc/new-pm/pipeline.mir b/llvm/test/tools/llc/new-pm/pipeline.mir
index ee058f763b7793..761a3a424ee678 100644
--- a/llvm/test/tools/llc/new-pm/pipeline.mir
+++ b/llvm/test/tools/llc/new-pm/pipeline.mir
@@ -1,7 +1,7 @@
# RUN: llc -mtriple=x86_64-pc-linux-gnu -x mir -passes=no-op-machine-function --print-pipeline-passes -filetype=null < %s | FileCheck %s --match-full-lines
# RUN: llc -mtriple=x86_64-pc-linux-gnu -x mir -passes='require<machine-dom-tree>,print<machine-dom-tree>' -print-pipeline-passes < %s | FileCheck --check-prefix=ANALYSIS %s
-# CHECK: function(machine-function(no-op-machine-function)),PrintMIRPreparePass,function(machine-function(print))
+# CHECK: function(machine-function(no-op-machine-function)),PrintMIRPreparePass,function(machine-function(verify,print))
# ANALYSIS: require<machine-dom-tree>,print<machine-dom-tree>
diff --git a/llvm/test/tools/llc/new-pm/verify.mir b/llvm/test/tools/llc/new-pm/verify.mir
index 0cc7fc837e5bed..6aa4362811e041 100644
--- a/llvm/test/tools/llc/new-pm/verify.mir
+++ b/llvm/test/tools/llc/new-pm/verify.mir
@@ -1,4 +1,4 @@
-# RUN: not --crash llc -mtriple=x86_64-pc-linux-gnu -debug-pass-manager -passes='module(function(machine-function(trigger-verifier-error)))' -filetype=null %s 2>&1 | FileCheck %s
+# RUN: not --crash llc -mtriple=x86_64-pc-linux-gnu -debug-pass-manager -passes='module(function(machine-function(trigger-verifier-error)))' -verify-each -filetype=null %s 2>&1 | FileCheck %s
# CHECK: Verifying machine function f
# CHECK: Broken machine function found after pass "TriggerVerifierErrorPass"
diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp
index c8088da49a2784..6fbcf46fc4da08 100644
--- a/llvm/tools/llc/NewPMDriver.cpp
+++ b/llvm/tools/llc/NewPMDriver.cpp
@@ -18,8 +18,10 @@
#include "llvm/CodeGen/CommandFlags.h"
#include "llvm/CodeGen/MIRParser/MIRParser.h"
#include "llvm/CodeGen/MIRPrinter.h"
+#include "llvm/CodeGen/MachineFunctionAnalysis.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachinePassManager.h"
+#include "llvm/CodeGen/MachineVerifier.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
@@ -29,7 +31,6 @@
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IRReader/IRReader.h"
-#include "llvm/Passes/CodeGenPassBuilder.h" // TODO: Include pass headers properly.
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Passes/StandardInstrumentations.h"
#include "llvm/Support/CommandLine.h"
@@ -88,7 +89,7 @@ int llvm::compileModuleWithNewPM(
StringRef Arg0, std::unique_ptr<Module> M, std::unique_ptr<MIRParser> MIR,
std::unique_ptr<TargetMachine> Target, std::unique_ptr<ToolOutputFile> Out,
std::unique_ptr<ToolOutputFile> DwoOut, LLVMContext &Context,
- const TargetLibraryInfoImpl &TLII, bool NoVerify, StringRef PassPipeline,
+ const TargetLibraryInfoImpl &TLII, VerifierKind VK, StringRef PassPipeline,
CodeGenFileType FileType) {
if (!PassPipeline.empty() && TargetPassConfig::hasLimitedCodeGenPipeline()) {
@@ -104,14 +105,16 @@ int llvm::compileModuleWithNewPM(
// Fetch options from TargetPassConfig
CGPassBuilderOption Opt = getCGPassBuilderOption();
- Opt.DisableVerify = NoVerify;
+ Opt.DisableVerify = VK == VerifierKind::NoVerifier;
Opt.DebugPM = DebugPM;
Opt.RegAlloc = RegAlloc;
MachineModuleInfo MMI(&LLVMTM);
PassInstrumentationCallbacks PIC;
- StandardInstrumentations SI(Context, Opt.DebugPM, !NoVerify);
+ StandardInstrumentations SI(Context, Opt.DebugPM,
+ /*VerifyEach=*/VK ==
+ VerifierKind::VerifyEachPass);
registerCodeGenCallback(PIC, LLVMTM);
MachineFunctionAnalysisManager MFAM;
@@ -147,6 +150,8 @@ int llvm::compileModuleWithNewPM(
ExitOnErr(PB.parsePassPipeline(MPM, PassPipeline));
MPM.addPass(PrintMIRPreparePass(*OS));
MachineFunctionPassManager MFPM;
+ if (VK == VerifierKind::VerifyOut)
+ MFPM.addPass(MachineVerifierPass());
MFPM.addPass(PrintMIRPass(*OS));
FPM.addPass(createFunctionToMachineFunctionPassAdaptor(std::move(MFPM)));
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
diff --git a/llvm/tools/llc/NewPMDriver.h b/llvm/tools/llc/NewPMDriver.h
index b0beeaf596c8fd..624141316f77cc 100644
--- a/llvm/tools/llc/NewPMDriver.h
+++ b/llvm/tools/llc/NewPMDriver.h
@@ -32,6 +32,8 @@ class ToolOutputFile;
class LLVMContext;
class MIRParser;
+enum class VerifierKind { NoVerifier, VerifyOut, VerifyEachPass };
+
struct LLCDiagnosticHandler : public DiagnosticHandler {
bool handleDiagnostics(const DiagnosticInfo &DI) override;
};
@@ -42,7 +44,7 @@ int compileModuleWithNewPM(StringRef Arg0, std::unique_ptr<Module> M,
std::unique_ptr<ToolOutputFile> Out,
std::unique_ptr<ToolOutputFile> DwoOut,
LLVMContext &Context,
- const TargetLibraryInfoImpl &TLII, bool NoVerify,
+ const TargetLibraryInfoImpl &TLII, VerifierKind VK,
StringRef PassPipeline, CodeGenFileType FileType);
} // namespace llvm
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 80c84a977c26c6..421a1d180d450e 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -130,6 +130,9 @@ static cl::opt<std::string> SplitDwarfFile(
static cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
cl::desc("Do not verify input module"));
+static cl::opt<bool> VerifyEach("verify-each",
+ cl::desc("Verify after each transform"));
+
static cl::opt<bool>
DisableSimplifyLibCalls("disable-simplify-libcalls",
cl::desc("Disable simplify-libcalls"));
@@ -647,10 +650,16 @@ static int compileModule(char **argv, LLVMContext &Context) {
WithColor::warning(errs(), argv[0])
<< ": warning: ignoring -mc-relax-all because filetype != obj";
+ VerifierKind VK = VerifierKind::VerifyOut;
+ if (NoVerify)
+ VK = VerifierKind::NoVerifier;
+ else if (VerifyEach)
+ VK = VerifierKind::VerifyEachPass;
+
if (EnableNewPassManager || !PassPipeline.empty()) {
return compileModuleWithNewPM(argv[0], std::move(M), std::move(MIR),
std::move(Target), std::move(Out),
- std::move(DwoOut), Context, TLII, NoVerify,
+ std::move(DwoOut), Context, TLII, VK,
PassPipeline, codegen::getFileType());
}
>From 5180130c3c7722e334240d806e5ee1d8e0ce6568 Mon Sep 17 00:00:00 2001
From: PaperChalice <liujunchang97 at outlook.com>
Date: Sat, 31 Aug 2024 16:38:14 +0800
Subject: [PATCH 2/2] Rename VerifierKind and verify output
---
llvm/include/llvm/Passes/CodeGenPassBuilder.h | 3 +++
llvm/tools/llc/NewPMDriver.cpp | 7 +++----
llvm/tools/llc/NewPMDriver.h | 2 +-
llvm/tools/llc/llc.cpp | 6 +++---
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index eb15beb835b535..64d20ae5b20ef5 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -548,6 +548,9 @@ Error CodeGenPassBuilder<Derived, TargetMachineT>::buildPipeline(
if (auto Err = derived().addMachinePasses(addPass))
return std::move(Err);
+ if (!Opt.DisableVerify)
+ addPass(MachineVerifierPass());
+
if (PrintAsm) {
derived().addAsmPrinter(
addPass, [this, &Out, DwoOut, FileType](MCContext &Ctx) {
diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp
index 6fbcf46fc4da08..2a49eaff1d7cbc 100644
--- a/llvm/tools/llc/NewPMDriver.cpp
+++ b/llvm/tools/llc/NewPMDriver.cpp
@@ -105,7 +105,7 @@ int llvm::compileModuleWithNewPM(
// Fetch options from TargetPassConfig
CGPassBuilderOption Opt = getCGPassBuilderOption();
- Opt.DisableVerify = VK == VerifierKind::NoVerifier;
+ Opt.DisableVerify = VK != VerifierKind::InputOutput;
Opt.DebugPM = DebugPM;
Opt.RegAlloc = RegAlloc;
@@ -113,8 +113,7 @@ int llvm::compileModuleWithNewPM(
PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(Context, Opt.DebugPM,
- /*VerifyEach=*/VK ==
- VerifierKind::VerifyEachPass);
+ VK == VerifierKind::EachPass);
registerCodeGenCallback(PIC, LLVMTM);
MachineFunctionAnalysisManager MFAM;
@@ -150,7 +149,7 @@ int llvm::compileModuleWithNewPM(
ExitOnErr(PB.parsePassPipeline(MPM, PassPipeline));
MPM.addPass(PrintMIRPreparePass(*OS));
MachineFunctionPassManager MFPM;
- if (VK == VerifierKind::VerifyOut)
+ if (VK == VerifierKind::InputOutput)
MFPM.addPass(MachineVerifierPass());
MFPM.addPass(PrintMIRPass(*OS));
FPM.addPass(createFunctionToMachineFunctionPassAdaptor(std::move(MFPM)));
diff --git a/llvm/tools/llc/NewPMDriver.h b/llvm/tools/llc/NewPMDriver.h
index 624141316f77cc..c8a60223cb2962 100644
--- a/llvm/tools/llc/NewPMDriver.h
+++ b/llvm/tools/llc/NewPMDriver.h
@@ -32,7 +32,7 @@ class ToolOutputFile;
class LLVMContext;
class MIRParser;
-enum class VerifierKind { NoVerifier, VerifyOut, VerifyEachPass };
+enum class VerifierKind { None, InputOutput, EachPass };
struct LLCDiagnosticHandler : public DiagnosticHandler {
bool handleDiagnostics(const DiagnosticInfo &DI) override;
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 421a1d180d450e..3f27a5fd1a0eb9 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -650,11 +650,11 @@ static int compileModule(char **argv, LLVMContext &Context) {
WithColor::warning(errs(), argv[0])
<< ": warning: ignoring -mc-relax-all because filetype != obj";
- VerifierKind VK = VerifierKind::VerifyOut;
+ VerifierKind VK = VerifierKind::InputOutput;
if (NoVerify)
- VK = VerifierKind::NoVerifier;
+ VK = VerifierKind::None;
else if (VerifyEach)
- VK = VerifierKind::VerifyEachPass;
+ VK = VerifierKind::EachPass;
if (EnableNewPassManager || !PassPipeline.empty()) {
return compileModuleWithNewPM(argv[0], std::move(M), std::move(MIR),
More information about the llvm-commits
mailing list