[LLVMdev] Assertion `PI && "Expected required passes to be initialized"' failed for AliasAnalysis.

Dmitry N. Mikushin maemarcus at gmail.com
Tue Dec 6 07:33:02 PST 2011


Hi Alexander,

I had the same error:

sincos: /home/marcusmae/rpmbuild/BUILD/llvm/lib/VMCore/PassManager.cpp:635:
void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI
&& "Expected required passes to be initialized"' failed.

The solution was to add:

		PassRegistry &Registry = *PassRegistry::getPassRegistry();
		initializeCore(Registry);
		initializeScalarOpts(Registry);
		initializeIPO(Registry);
		initializeAnalysis(Registry);
		initializeIPA(Registry);
		initializeTransformUtils(Registry);
		initializeInstCombine(Registry);
		initializeInstrumentation(Registry);
		initializeTarget(Registry);

before creating passes. Maybe it could help you to track down the issue.

- D.

2011/12/6 Alexander Potapenko <glider at google.com>:
> Dear lazydev,
>
> I'm writing an instrumentation pass that depends on AliasAnalysis. My
> getAnalysisUsage() looks as follows:
>
> 2453 void ThreadSanitizer::getAnalysisUsage(AnalysisUsage &AU) const {
> 2454   AU.addRequired<TargetData>();
> 2455   AU.addRequired<AliasAnalysis>();
> 2456 }
>
> and the pass initialization:
>
> 2668 char ThreadSanitizer::ID = 0;
> 2669 INITIALIZE_PASS_BEGIN(ThreadSanitizer, "tsan",
> 2670                       "Compile-time instrumentation for runtime "
> 2671                       "data race detection with ThreadSanitizer",
> 2672                       false, false)
> 2673 INITIALIZE_PASS_DEPENDENCY(TargetData)
> 2674 INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
> 2675 INITIALIZE_PASS_END(ThreadSanitizer, "tsan",
> 2676                     "Compile-time instrumentation for runtime "
> 2677                     "data race detection with ThreadSanitizer",
> 2678                     false, false)
> 2679
>
>
> However when I run Clang with my pass enabled, I get the following error:
> $ clang_build_Linux/Release+Asserts/bin/clang -fthread-sanitizer -c t.c
> CREATE
> clang: /usr/local/google/tsan-llvm/data-race-test/clang_src/lib/VMCore/PassManager.cpp:634:
> void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI
> && "Expected required passes to be initialized"' failed.
> 0  clang           0x0000000001d1757f
> 1  clang           0x0000000001d197f2
> 2  libpthread.so.0 0x00007fe8a157d8f0
> 3  libc.so.6       0x00007fe8a086ca75 gsignal + 53
> 4  libc.so.6       0x00007fe8a08705c0 abort + 384
> 5  libc.so.6       0x00007fe8a0865941 __assert_fail + 241
> 6  clang           0x0000000001cb22a7
> 7  clang           0x0000000001cb4716 llvm::PassManager::add(llvm::Pass*) + 262
> 8  clang           0x00000000011e0ea6
> llvm::PassManagerBuilder::addExtensionsToPM(llvm::PassManagerBuilder::ExtensionPointTy,
> llvm::PassManagerBase&) const + 406
> 9  clang           0x000000000083b5e1
> clang::EmitBackendOutput(clang::DiagnosticsEngine&,
> clang::CodeGenOptions const&, clang::TargetOptions const&,
> clang::LangOptions const&, llvm::Module*, clang::BackendAction,
> llvm::raw_ostream*) + 897
> 10 clang           0x0000000000838f61
> clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) +
> 353
> 11 clang           0x0000000000986caf clang::ParseAST(clang::Sema&, bool) + 511
> 12 clang           0x0000000000837b34 clang::CodeGenAction::ExecuteAction() + 68
> 13 clang           0x00000000006eb6b5
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 373
> 14 clang           0x00000000006d3d59
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1401
> 15 clang           0x00000000006c9fc7 cc1_main(char const**, char
> const**, char const*, void*) + 791
> 16 clang           0x00000000006d2b27 main + 7175
> 17 libc.so.6       0x00007fe8a0857c4d __libc_start_main + 253
> 18 clang           0x00000000006c7bc9
> Stack dump:
> 0.      Program arguments:
> /usr/local/google/tsan-llvm/data-race-test/clang_build_Linux/Release+Asserts/bin/clang
> -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all
> -disable-free -main-file-name t.c -mrelocation-model static
> -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
> -target-cpu x86-64 -target-linker-version 2.20.1
> -momit-leaf-frame-pointer -coverage-file t.o -resource-dir
> /usr/local/google/tsan-llvm/data-race-test/clang_build_Linux/Release+Asserts/bin/../lib/clang/3.1
> -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
> /usr/local/include -internal-isystem
> /usr/local/google/tsan-llvm/data-race-test/clang_build_Linux/Release+Asserts/bin/../lib/clang/3.1/include
> -internal-externc-isystem /usr/include/x86_64-linux-gnu
> -internal-externc-isystem /include -internal-externc-isystem
> /usr/include -fdebug-compilation-dir
> /usr/local/google/tsan-llvm/data-race-test -ferror-limit 19
> -fmessage-length 150 -fthread-sanitizer -fgnu-runtime
> -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
> -fdiagnostics-show-option -fcolor-diagnostics -o t.o -x c t.c
>
>
> Do I need something besides INITIALIZE_AG_DEPENDENCY in order to
> initialize AliasAnalysis? (I've verified that removing TargetData does
> not fix the problem)
>
> TIA,
> Alexander Potapenko
> Software Engineer
> Google Moscow
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list