[llvm-dev] Error when invoking poolalloc pass with xclang

fee via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 2 12:34:35 PDT 2016


Hi all,

I wrote a hello world pass that uses the legacy pass manager so I can invoke it directly with clang.
I took the pass skeleton from https://github.com/sampsyo/llvm-pass-skeleton and only added the DSA analysis from poolalloc.
However, as soon as I add the analysis and set the pass via clang I get an error:

Pass 'Allocator Identification Analysis (find malloc/free wrappers)' is not initialized.
Verify if there is a pass dependency cycle.
Required Passes:
clang: LegacyPassManager.cpp:641: void llvm::PMTopLevelManager::schedulePass(llvm::Pass *): Assertion `PI && "Expected required passes to be initialized"' failed.

Invoke:

clang -Xclang -load -Xclang llvm-dsa/lib/LLVMDataStructure.so -Xclang -load -Xclang llvm-pass-skeleton/build/skeleton/libSkeletonPass.so test.c

Pass code:


#include "llvm/Pass.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"

#include "dsa/DataStructure.h"

using namespace llvm;

namespace {
struct SkeletonPass : public FunctionPass {
  static char ID;
  SkeletonPass() : FunctionPass(ID) {}

  void getAnalysisUsage(AnalysisUsage &AU) const {
    AU.addRequiredTransitive<EQTDDataStructures>();
  }

  virtual bool runOnFunction(Function &F) {
    errs() << "I saw a function called " << F.getName() << "!\n";
    return false;
  }
};
}

char SkeletonPass::ID = 0;

static void registerDfi(const PassManagerBuilder &, legacy::PassManagerBase &PM) {
  PM.add(new SkeletonPass());
}

static RegisterStandardPasses RegisterMyPass(PassManagerBuilder::EP_EarlyAsPossible, registerDfi);




>From the error I guess I need to initialize the Allocator Identification Analysis.
However, I don't know how to do this.
Can someone help?

Thank you!


-Fredi



More information about the llvm-dev mailing list