Hi:
I want to do some optimization on MachineLoop.
So I want to get MachineLoopInfo from MachineFunction.
I reference MachineLICM.cpp.
So I try to write a pass in Target/mytarget directory.
I find there is Error.
llvm/include/llvm/PassAnalysisSupport.h:198: AnalysisType& llvm::Pass::getAnalysisID(const llvm::PassInfo*) const [with AnalysisType = llvm::MachineLoopInfo]: Assertion `ResultPass && "getAnalysis*() called on an analysis that was not 'required' by pass!"' failed.
Hi:
I want to do some optimization on MachineLoop.
So I want to get MachineLoopInfo from MachineFunction.
I reference MachineLICM.cpp.
So I try to write a pass in Target/mytarget directory.
I find there is Error.
llvm/include/llvm/PassAnalysisSupport.h:198: AnalysisType& llvm::Pass::getAnalysisID(const llvm::PassInfo*) const [with AnalysisType = llvm::MachineLoopInfo]: Assertion `ResultPass&& "getAnalysis*() called on an analysis that was not 'required' by pass!"' failed.
Did you copy getAnalysisUsage too? The way it works is that you need getAnalysisUsage to declare all the passes you need to exist before your pass starts, then getAnalysis<>() inside your runOnMachineFunction can use them. If you call getAnalysis on a Pass that you didn't request, you'll hit this assertion.