[LLVMdev] Assertion failed in Pass.cpp

Anshu Dasgupta anshuman at cs.rice.edu
Mon Dec 15 16:56:01 PST 2003

Hi all,

I am trying to write a pass for the llc tool.  I register this pass 
with the RegisterLLC template.  However, when I try to run llc and load 
up the pass, I get a failed assertion:

$ /storage/anshuman/llvmCVS/llvm/tools/Debug/llc -load=./libTest.so 
llc: Pass.cpp:327: void 
llvm::RegisterPassBase::unregisterPass(llvm::PassInfo*): Assertion `I 
!= PassInfoMap->end() && "Pass registered but not in map!"' failed.

Any ideas why I'm getting this? I've attached the pass code below.

(I'm using the cvs version of the LLVM code.)


--- Begin pass code ---
#include <iostream>
#include "llvm/Pass.h"
#include "llvm/Function.h"
#include "llvm/PassSupport.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/Passes.h"

namespace llvm {

   class testfn : public MachineFunctionPass {


     virtual bool runOnMachineFunction(MachineFunction &F) {
       std::cout << "Reached a function" << std::endl;
       return false;


   RegisterLLC<testfn> X("testfn", "testfn");


More information about the llvm-dev mailing list