Can not require two user defined analysis pass at the same time (Unable to schedule pass)

Dear all:

I am currently writing an analysis pass. I would like to split myPass into three analysis passes A, B, C which makes the original code more structured. Pass A depends on the results of Pass B and C.

But the problem is that when A requires B and C at the same time, the (unable to schedule pass) error happens. But when A only requires one pass B or C, the code works correctly. But both B and C are analysis pass, why can’t they be scheduled when they are required at the same time? The requiring code looks like this.

void getAnalysisUsage(AnalysisUsage &AU) const override {

AU.setPreservesAll();

AU.addRequiredidxAnalysis::IndexAnalysis();

AU.addRequiredargAnalysis::ArgumentAnalysis();

}

Thanks!

Dong

Error massage:

/Users/dongchen/tools/llvm_xcode/Debug/bin/opt -load /Users/dongchen/tools/llvm_xcode/Debug/lib/LLVMSymFP.dylib -symFP <./src_bc/stencil.bc> ./src_bc/stencil.bc.opt

Unable to schedule ‘B’ required by ‘A’

Unable to schedule pass

UNREACHABLE executed at /Users/dongchen/tools/llvm-4.0.0.src/lib/IR/LegacyPassManager.cpp:1243!

0 opt 0x000000010a336bbc llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60

1 opt 0x000000010a337139 PrintStackTraceSignalHandler(void*) + 25

2 opt 0x000000010a333269 llvm::sys::RunSignalHandlers() + 425

3 opt 0x000000010a337802 SignalHandler(int) + 354

4 libsystem_platform.dylib 0x00007fffb90bab3a _sigtramp + 26

5 libsystem_platform.dylib 0x00007fff58221020 _sigtramp + 2669044992

6 libsystem_c.dylib 0x00007fffb8f3f420 abort + 129

7 opt 0x000000010a2e9f70 LLVMInstallFatalErrorHandler + 0

8 opt 0x00000001099e8904 llvm::PMDataManager::addLowerLevelRequiredPass(llvm::Pass*, llvm::Pass*) + 244

9 opt 0x00000001099e73d5 llvm::PMDataManager::add(llvm::Pass*, bool) + 1237

10 opt 0x00000001099ec493 llvm::FunctionPass::assignPassManager(llvm::PMStack&, llvm::PassManagerType) + 627

11 opt 0x00000001099e3a81 llvm::PMTopLevelManager::schedulePass(llvm::Pass*) + 2049

12 opt 0x00000001099ebacf llvm::legacy::PassManagerImpl::add(llvm::Pass*) + 47

13 opt 0x00000001099eba91 llvm::legacy::PassManager::add(llvm::Pass*) + 33

14 opt 0x0000000107a0ee6f addPass(llvm::legacy::PassManagerBase&, llvm::Pass*) + 47

15 opt 0x0000000107a09f9e main + 20094

16 libdyld.dylib 0x00007fffb8eab235 start + 1

17 libdyld.dylib 0x0000000000000004 start + 1192578512

Stack dump:

  1. Program arguments: /Users/dongchen/tools/llvm_xcode/Debug/bin/opt -load /Users/dongchen/tools/llvm_xcode/Debug/lib/LLVMSymFP.dylib -symFP

/bin/sh: line 1: 1198 Abort trap: 6 /Users/dongchen/tools/llvm_xcode/Debug/bin/opt -load /Users/dongchen/tools/llvm_xcode/Debug/lib/LLVMSymFP.dylib -symFP < ./src_bc/stencil.bc > ./src_bc/stencil.bc.opt

make: *** [check] Error 134