Skip to content

Commit

Permalink
[Debugify] Mark mir-check-debugify change nothing of input
Browse files Browse the repository at this point in the history
Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D119914
  • Loading branch information
KanRobert committed Feb 16, 2022
1 parent 9bde881 commit ce02c79
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions llvm/lib/CodeGen/MachineCheckDebugify.cpp
Expand Up @@ -27,16 +27,16 @@ namespace {

struct CheckDebugMachineModule : public ModulePass {
bool runOnModule(Module &M) override {
MachineModuleInfo &MMI =
getAnalysis<MachineModuleInfoWrapperPass>().getMMI();

NamedMDNode *NMD = M.getNamedMetadata("llvm.mir.debugify");
if (!NMD) {
errs() << "WARNING: Please run mir-debugify to generate "
"llvm.mir.debugify metadata first.\n";
return false;
}

MachineModuleInfo &MMI =
getAnalysis<MachineModuleInfoWrapperPass>().getMMI();

auto getDebugifyOperand = [&](unsigned Idx) -> unsigned {
return mdconst::extract<ConstantInt>(NMD->getOperand(Idx)->getOperand(0))
->getZExtValue();
Expand Down Expand Up @@ -106,8 +106,7 @@ struct CheckDebugMachineModule : public ModulePass {

void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<MachineModuleInfoWrapperPass>();
AU.addPreserved<MachineModuleInfoWrapperPass>();
AU.setPreservesCFG();
AU.setPreservesAll();
}

static char ID; // Pass identification.
Expand Down

0 comments on commit ce02c79

Please sign in to comment.