Skip to content

Commit

Permalink
[CodeGen][NewPM] Port MachineVerifier to new pass manager (#98628)
Browse files Browse the repository at this point in the history
- Add `MachineVerifierPass`.
- Use complete `MachineVerifierPass` in `VerifyInstrumentation` if
possible.

`LiveStacksAnalysis` will be added in future, all other analyses are
done.
  • Loading branch information
paperchalice authored Jul 15, 2024
1 parent e025e5e commit c09ed6a
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 20 deletions.
28 changes: 28 additions & 0 deletions llvm/include/llvm/CodeGen/MachineVerifier.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//===- llvm/CodeGen/MachineVerifier.h - Machine Code Verifier ---*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_MACHINEVERIFIER_H
#define LLVM_CODEGEN_MACHINEVERIFIER_H

#include "llvm/CodeGen/MachinePassManager.h"
#include <string>

namespace llvm {
class MachineVerifierPass : public PassInfoMixin<MachineVerifierPass> {
std::string Banner;

public:
MachineVerifierPass(const std::string &Banner = std::string())
: Banner(Banner) {}
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
};

} // namespace llvm

#endif // LLVM_CODEGEN_MACHINEVERIFIER_H
2 changes: 1 addition & 1 deletion llvm/include/llvm/InitializePasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void initializeMachineSinkingPass(PassRegistry&);
void initializeMachineTraceMetricsPass(PassRegistry&);
void initializeMachineUniformityInfoPrinterPassPass(PassRegistry &);
void initializeMachineUniformityAnalysisPassPass(PassRegistry &);
void initializeMachineVerifierPassPass(PassRegistry&);
void initializeMachineVerifierLegacyPassPass(PassRegistry &);
void initializeMemoryDependenceWrapperPassPass(PassRegistry&);
void initializeMemorySSAWrapperPassPass(PassRegistry&);
void initializeMergeICmpsLegacyPassPass(PassRegistry &);
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Passes/MachinePassRegistry.def
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ MACHINE_FUNCTION_PASS("print<slot-indexes>", SlotIndexesPrinterPass(dbgs()))
MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
RequireAllMachineFunctionPropertiesPass())
MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
MACHINE_FUNCTION_PASS("verify", MachineVerifierPass())
#undef MACHINE_FUNCTION_PASS

#ifndef MACHINE_FUNCTION_PASS_WITH_PARAMS
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Passes/StandardInstrumentations.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ class VerifyInstrumentation {

public:
VerifyInstrumentation(bool DebugLogging) : DebugLogging(DebugLogging) {}
void registerCallbacks(PassInstrumentationCallbacks &PIC);
void registerCallbacks(PassInstrumentationCallbacks &PIC,
ModuleAnalysisManager *MAM);
};

/// This class implements --time-trace functionality for new pass manager.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
initializeMachineSinkingPass(Registry);
initializeMachineUniformityAnalysisPassPass(Registry);
initializeMachineUniformityInfoPrinterPassPass(Registry);
initializeMachineVerifierPassPass(Registry);
initializeMachineVerifierLegacyPassPass(Registry);
initializeObjCARCContractLegacyPassPass(Registry);
initializeOptimizePHIsPass(Registry);
initializePEIPass(Registry);
Expand Down
44 changes: 36 additions & 8 deletions llvm/lib/CodeGen/MachineVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// -verify-machineinstrs.
//===----------------------------------------------------------------------===//

#include "llvm/CodeGen/MachineVerifier.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
Expand Down Expand Up @@ -93,6 +94,9 @@ using namespace llvm;
namespace {

struct MachineVerifier {
MachineVerifier(MachineFunctionAnalysisManager &MFAM, const char *b)
: MFAM(&MFAM), Banner(b) {}

MachineVerifier(Pass *pass, const char *b) : PASS(pass), Banner(b) {}

MachineVerifier(const char *b, LiveVariables *LiveVars,
Expand All @@ -103,6 +107,7 @@ namespace {

unsigned verify(const MachineFunction &MF);

MachineFunctionAnalysisManager *MFAM = nullptr;
Pass *const PASS = nullptr;
const char *Banner;
const MachineFunction *MF = nullptr;
Expand Down Expand Up @@ -302,15 +307,15 @@ namespace {
void verifyProperties(const MachineFunction &MF);
};

struct MachineVerifierPass : public MachineFunctionPass {
struct MachineVerifierLegacyPass : public MachineFunctionPass {
static char ID; // Pass ID, replacement for typeid

const std::string Banner;

MachineVerifierPass(std::string banner = std::string())
: MachineFunctionPass(ID), Banner(std::move(banner)) {
initializeMachineVerifierPassPass(*PassRegistry::getPassRegistry());
}
MachineVerifierLegacyPass(std::string banner = std::string())
: MachineFunctionPass(ID), Banner(std::move(banner)) {
initializeMachineVerifierLegacyPassPass(*PassRegistry::getPassRegistry());
}

void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addUsedIfAvailable<LiveStacks>();
Expand Down Expand Up @@ -338,13 +343,28 @@ namespace {

} // end anonymous namespace

char MachineVerifierPass::ID = 0;
PreservedAnalyses
MachineVerifierPass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM) {
// Skip functions that have known verification problems.
// FIXME: Remove this mechanism when all problematic passes have been
// fixed.
if (MF.getProperties().hasProperty(
MachineFunctionProperties::Property::FailsVerification))
return PreservedAnalyses::all();
unsigned FoundErrors = MachineVerifier(MFAM, Banner.c_str()).verify(MF);
if (FoundErrors)
report_fatal_error("Found " + Twine(FoundErrors) + " machine code errors.");
return PreservedAnalyses::all();
}

char MachineVerifierLegacyPass::ID = 0;

INITIALIZE_PASS(MachineVerifierPass, "machineverifier",
INITIALIZE_PASS(MachineVerifierLegacyPass, "machineverifier",
"Verify generated machine code", false, false)

FunctionPass *llvm::createMachineVerifierPass(const std::string &Banner) {
return new MachineVerifierPass(Banner);
return new MachineVerifierLegacyPass(Banner);
}

void llvm::verifyMachineFunction(const std::string &Banner,
Expand Down Expand Up @@ -438,6 +458,14 @@ unsigned MachineVerifier::verify(const MachineFunction &MF) {
auto *SIWrapper = PASS->getAnalysisIfAvailable<SlotIndexesWrapperPass>();
Indexes = SIWrapper ? &SIWrapper->getSI() : nullptr;
}
if (MFAM) {
MachineFunction &Func = const_cast<MachineFunction &>(MF);
LiveInts = MFAM->getCachedResult<LiveIntervalsAnalysis>(Func);
if (!LiveInts)
LiveVars = MFAM->getCachedResult<LiveVariablesAnalysis>(Func);
// TODO: LiveStks = MFAM->getCachedResult<LiveStacksAnalysis>(Func);
Indexes = MFAM->getCachedResult<SlotIndexesAnalysis>(Func);
}

verifySlotIndexes();

Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Passes/PassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
#include "llvm/CodeGen/MachinePassManager.h"
#include "llvm/CodeGen/MachinePostDominators.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/MachineVerifier.h"
#include "llvm/CodeGen/PreISelIntrinsicLowering.h"
#include "llvm/CodeGen/RegAllocFast.h"
#include "llvm/CodeGen/SafeStack.h"
Expand Down
25 changes: 17 additions & 8 deletions llvm/lib/Passes/StandardInstrumentations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "llvm/CodeGen/MIRPrinter.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineVerifier.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
Expand Down Expand Up @@ -1451,10 +1452,10 @@ void PreservedCFGCheckerInstrumentation::registerCallbacks(
});
}

void VerifyInstrumentation::registerCallbacks(
PassInstrumentationCallbacks &PIC) {
void VerifyInstrumentation::registerCallbacks(PassInstrumentationCallbacks &PIC,
ModuleAnalysisManager *MAM) {
PIC.registerAfterPassCallback(
[this](StringRef P, Any IR, const PreservedAnalyses &PassPA) {
[this, MAM](StringRef P, Any IR, const PreservedAnalyses &PassPA) {
if (isIgnored(P) || P == "VerifierPass")
return;
const auto *F = unwrapIR<Function>(IR);
Expand Down Expand Up @@ -1488,15 +1489,23 @@ void VerifyInstrumentation::registerCallbacks(
P));
}

// TODO: Use complete MachineVerifierPass.
if (auto *MF = unwrapIR<MachineFunction>(IR)) {
if (DebugLogging)
dbgs() << "Verifying machine function " << MF->getName() << '\n';
verifyMachineFunction(
std::string Banner =
formatv("Broken machine function found after pass "
"\"{0}\", compilation aborted!",
P),
*MF);
P);
if (MAM) {
Module &M = const_cast<Module &>(*MF->getFunction().getParent());
auto &MFAM =
MAM->getResult<MachineFunctionAnalysisManagerModuleProxy>(M)
.getManager();
MachineVerifierPass Verifier(Banner);
Verifier.run(const_cast<MachineFunction &>(*MF), MFAM);
} else {
verifyMachineFunction(Banner, *MF);
}
}
}
});
Expand Down Expand Up @@ -2515,7 +2524,7 @@ void StandardInstrumentations::registerCallbacks(
PrintChangedIR.registerCallbacks(PIC);
PseudoProbeVerification.registerCallbacks(PIC);
if (VerifyEach)
Verify.registerCallbacks(PIC);
Verify.registerCallbacks(PIC, MAM);
PrintChangedDiff.registerCallbacks(PIC);
WebsiteChangeReporter.registerCallbacks(PIC);
ChangeTester.registerCallbacks(PIC);
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verifier-sdwa-cvt.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx940 -run-pass machineverifier -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx940 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" %s

# CHECK: *** Bad machine code: sext, abs and neg are not allowed on this instruction ***
# CHECK: $vgpr0 = V_CVT_F32_FP8_sdwa 1, $vgpr0, 0, 0, 4, implicit $mode, implicit $exec
Expand Down
3 changes: 3 additions & 0 deletions llvm/test/CodeGen/AMDGPU/verify-constant-bus-violations.mir
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -run-pass machineverifier -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" -check-prefix=GFX9-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -run-pass machineverifier -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" -check-prefix=GFX10PLUS-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 -run-pass machineverifier -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" -check-prefix=GFX10PLUS-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" -check-prefix=GFX9-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" -check-prefix=GFX10PLUS-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=-wavefrontsize32,+wavefrontsize64 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -implicit-check-not="Bad machine code" -check-prefix=GFX10PLUS-ERR %s

# GFX9-ERR: *** Bad machine code: VOP* instruction violates constant bus restriction ***
# GFX9-ERR: $vgpr0 = V_CNDMASK_B32_e64 0, $sgpr0, 0, -1, killed $sgpr0_sgpr1, implicit $exec
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-ds-gws-align.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx90a -run-pass=machineverifier -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX90A-ERR %s
# RUN: not --crash llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx90a --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX90A-ERR %s

# GFX90A-ERR: *** Bad machine code: Subtarget requires even aligned vector registers for DS_GWS instructions ***
# GFX90A-ERR: DS_GWS_INIT killed %0.sub1:areg_128_align2, 0, implicit $m0, implicit $exec :: (store (s32) into custom "GWSResource")
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-duplicate-literal.mir
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -run-pass machineverifier -o - %s | FileCheck %s
# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 --passes='machine-function(verify)' -o - %s | FileCheck %s

# Two uses of the same literal only count as one use of the constant bus.

Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-gfx90a-aligned-vgprs.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx90a -run-pass=machineverifier -o /dev/null %s 2>&1 | FileCheck %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx90a --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck %s

# Implicit uses are OK.
---
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-image-vaddr-align.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx90a -run-pass=machineverifier -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX90A-ERR %s
# RUN: not --crash llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx90a --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX90A-ERR %s

# GFX90A-ERR: *** Bad machine code: Subtarget requires even aligned vector registers for vaddr operand of image instructions ***
# GFX90A-ERR: %4:vgpr_32 = IMAGE_SAMPLE_V1_V1_gfx90a %0.sub1:vreg_128_align2
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-image.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1100 -run-pass=machineverifier -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX11-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1100 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX11-ERR %s

---
name: image_verify
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/CodeGen/AMDGPU/verify-scalar-store.mir
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=tonga -run-pass=machineverifier -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX8-ERR %s
# RUN: llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=machineverifier -o - %s 2>&1 | FileCheck -check-prefix=GFX9 %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=tonga --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX8-ERR %s
# RUN: llc -mtriple=amdgcn -mcpu=gfx900 --passes='machine-function(verify)' -o - %s 2>&1 | FileCheck -check-prefix=GFX9 %s

# GFX8-ERR: *** Bad machine code: scalar stores must use m0 as offset register ***
# GFX9: S_STORE_DWORD_SGPR
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-sop.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn -run-pass machineverifier %s -o - 2>&1 | FileCheck %s
# RUN: not --crash llc -mtriple=amdgcn --passes='machine-function(verify)' %s -o - 2>&1 | FileCheck %s

# CHECK: *** Bad machine code: SOP2/SOPC instruction requires too many immediate constants
# CHECK: - instruction: %0:sreg_32_xm0 = S_ADD_I32
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-vimage-vsample.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1200 -run-pass=machineverifier -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX12-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1200 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX12-ERR %s

---
name: vimage_vsample_verify
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-vopd-gfx12.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1200 -mattr=+wavefrontsize32,-wavefrontsize64 -run-pass machineverifier -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX12-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1200 -mattr=+wavefrontsize32,-wavefrontsize64 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX12-ERR %s

# GFX12-ERR: *** Bad machine code: VOP* instruction violates constant bus restriction ***
# GFX12-ERR: $vgpr2, $vgpr3 = V_DUAL_CNDMASK_B32_e32_X_MUL_F32_e32_gfx12 $sgpr0, $vgpr0, $sgpr1, $vgpr1, implicit $exec, implicit $mode, implicit $vcc_lo, implicit $vcc_lo
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/AMDGPU/verify-vopd.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=+wavefrontsize32,-wavefrontsize64 -run-pass machineverifier -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX11-ERR %s
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx1100 -mattr=+wavefrontsize32,-wavefrontsize64 --passes='machine-function(verify)' -o /dev/null %s 2>&1 | FileCheck -check-prefix=GFX11-ERR %s

# GFX11-ERR: *** Bad machine code: VOP* instruction violates constant bus restriction ***
# GFX11-ERR: $vgpr2, $vgpr3 = V_DUAL_CNDMASK_B32_e32_X_MUL_F32_e32_gfx11 $sgpr0, $vgpr0, $sgpr1, $vgpr1, implicit $exec, implicit $mode, implicit $vcc_lo, implicit $vcc_lo
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/MIR/Generic/dbg-value-missing-loc.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -run-pass machineverifier -o - %s 2>&1 | FileCheck %s
# RUN: not --crash llc --passes='machine-function(verify)' -o - %s 2>&1 | FileCheck %s

# CHECK: Bad machine code: Missing DebugLoc for debug instruction
# CHECK: - instruction: DBG_VALUE 1, 2, 3, 4
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/MIR/X86/dbg-value-list.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: llc -march=x86-64 -run-pass machineverifier -o - %s | FileCheck %s
# RUN: llc -march=x86-64 --passes='machine-function(verify)' -o - %s | FileCheck %s
# Simple round-trip test for DBG_VALUE_LIST.
# CHECK: [[VAR_C:![0-9]+]] = !DILocalVariable(name: "c"
# CHECK: DBG_VALUE_LIST [[VAR_C]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/RISCV/verify-instr.mir
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# RUN: not --crash llc -mtriple=riscv32 -run-pass machineverifier %s -o - 2>&1 | FileCheck %s
# RUN: not --crash llc -mtriple=riscv32 --passes='machine-function(verify)' %s -o - 2>&1 | FileCheck %s

# CHECK: *** Bad machine code: Invalid immediate ***
# CHECK: - instruction: $x2 = ADDI $x1, 10000
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llc/NewPMDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ int llvm::compileModuleWithNewPM(

PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(Context, Opt.DebugPM, !NoVerify);
SI.registerCallbacks(PIC);
registerCodeGenCallback(PIC, LLVMTM);

MachineFunctionAnalysisManager MFAM;
Expand All @@ -131,6 +130,7 @@ int llvm::compileModuleWithNewPM(
PB.registerLoopAnalyses(LAM);
PB.registerMachineFunctionAnalyses(MFAM);
PB.crossRegisterProxies(LAM, FAM, CGAM, MAM, &MFAM);
SI.registerCallbacks(PIC, &MAM);

FAM.registerPass([&] { return TargetLibraryAnalysis(TLII); });
MAM.registerPass([&] { return MachineModuleAnalysis(MMI); });
Expand Down

0 comments on commit c09ed6a

Please sign in to comment.