[LLVMbugs] [Bug 1919] New: Problem with ModulePass depending on FunctionPass depending on AA

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 17 07:46:55 PST 2008


http://llvm.org/bugs/show_bug.cgi?id=1919

           Summary: Problem with ModulePass depending on FunctionPass
                    depending on AA
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: wmatyjewicz at fastmail.fm
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1336)
 --> (http://llvm.org/bugs/attachment.cgi?id=1336)
source code for the passes

While trying to run MyPass (shown below) on any input the optimizer hits the
following assertion:
TargetData.h:114: llvm::TargetData::TargetData(): Assertion `0 && "ERROR: Bad
TargetData ctor used.  " "Tool did not specify a TargetData to use?"


The reduced code for the pass and the analysis it uses:
#include "llvm/Pass.h"
#include "llvm/Module.h"
#include "llvm/Analysis/AliasAnalysis.h"
using namespace llvm;

namespace {
  struct MyAnalysis : public FunctionPass {
    static char ID;
    MyAnalysis() : FunctionPass((intptr_t) &ID) {}

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

    virtual bool runOnFunction(Function &F) {
      return false;
    }
  };

  char MyAnalysis::ID = 0;
  RegisterPass<MyAnalysis> A("my-analysis", "My analysis");

  struct MyPass : public ModulePass {
    static char ID;
    MyPass() : ModulePass((intptr_t) &ID) {}

    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
      AU.addRequired<MyAnalysis>();
    }

    virtual bool runOnModule(Module &M) {
      return false;
    }
  };

  char MyPass::ID = 0;
  RegisterPass<MyPass> X("my-pass", "My pass");
}


When I changed MyPass to be a FunctionPass the assertion failure disappeared. 
I suppos, it's some kind of a pass manager bug.

The attachment allows to build the loadable module containing the passes.  It
can be extracted anywhere.  Just run configure script passing --with-llvmsrc
and --with-llvmobj arguments.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list