Skip to content

Commit

Permalink
[llc] Provide opt like verifier options (#106665)
Browse files Browse the repository at this point in the history
- Support `verify-each` option.
- Default behavior is verifying output only.
  • Loading branch information
paperchalice authored Sep 4, 2024
1 parent 0b2550f commit 69657eb
Show file tree
Hide file tree
Showing 27 changed files with 48 additions and 30 deletions.
3 changes: 3 additions & 0 deletions llvm/include/llvm/Passes/CodeGenPassBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AArch64/PHIElimination-crash.mir
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AArch64/PHIElimination-debugloc.mir
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AArch64/statepoint-twoaddr.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/gfx10-twoaddr-fma.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/gfx11-twoaddr-fma.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/phi-elimination-end-cf.mir
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/split-mbb-lis-subrange.mir
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/stale-livevar-in-twoaddr-pass.mir
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/AMDGPU/twoaddr-fma.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/Hexagon/two-addr-tied-subregs.mir
Original file line number Diff line number Diff line change
@@ -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


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/PowerPC/2013-07-01-PHIElimBug.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/PowerPC/livevars-crash1.mir
Original file line number Diff line number Diff line change
Expand Up @@ -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

--- |
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/PowerPC/livevars-crash2.mir
Original file line number Diff line number Diff line change
Expand Up @@ -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

--- |
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/distancemap.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/phielim-undef.mir
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/X86/twoaddr-mul2.mir
Original file line number Diff line number Diff line change
@@ -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.
---
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llc/new-pm/pipeline.mir
Original file line number Diff line number Diff line change
@@ -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>

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llc/new-pm/verify.mir
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
12 changes: 8 additions & 4 deletions llvm/tools/llc/NewPMDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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()) {
Expand All @@ -104,14 +105,15 @@ int llvm::compileModuleWithNewPM(

// Fetch options from TargetPassConfig
CGPassBuilderOption Opt = getCGPassBuilderOption();
Opt.DisableVerify = NoVerify;
Opt.DisableVerify = VK != VerifierKind::InputOutput;
Opt.DebugPM = DebugPM;
Opt.RegAlloc = RegAlloc;

MachineModuleInfo MMI(&LLVMTM);

PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(Context, Opt.DebugPM, !NoVerify);
StandardInstrumentations SI(Context, Opt.DebugPM,
VK == VerifierKind::EachPass);
registerCodeGenCallback(PIC, LLVMTM);

MachineFunctionAnalysisManager MFAM;
Expand Down Expand Up @@ -147,6 +149,8 @@ int llvm::compileModuleWithNewPM(
ExitOnErr(PB.parsePassPipeline(MPM, PassPipeline));
MPM.addPass(PrintMIRPreparePass(*OS));
MachineFunctionPassManager MFPM;
if (VK == VerifierKind::InputOutput)
MFPM.addPass(MachineVerifierPass());
MFPM.addPass(PrintMIRPass(*OS));
FPM.addPass(createFunctionToMachineFunctionPassAdaptor(std::move(MFPM)));
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
Expand Down
4 changes: 3 additions & 1 deletion llvm/tools/llc/NewPMDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ToolOutputFile;
class LLVMContext;
class MIRParser;

enum class VerifierKind { None, InputOutput, EachPass };

struct LLCDiagnosticHandler : public DiagnosticHandler {
bool handleDiagnostics(const DiagnosticInfo &DI) override;
};
Expand All @@ -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

Expand Down
11 changes: 10 additions & 1 deletion llvm/tools/llc/llc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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::InputOutput;
if (NoVerify)
VK = VerifierKind::None;
else if (VerifyEach)
VK = VerifierKind::EachPass;

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());
}

Expand Down

1 comment on commit 69657eb

@tbaederr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this broke LLVM_LINK_LLVM_DYLIB builds:

mold: error: undefined symbol: tools/llc/CMakeFiles/llc.dir/NewPMDriver.cpp.o: llvm::MachineVerifierPass::run(llvm::MachineFunction&, llvm::AnalysisManager<llvm::MachineFunction>&)

Please sign in to comment.