[LLVMdev] Problem getting LoopInfo inside non-LoopPass
John Criswell
criswell at illinois.edu
Thu Nov 10 09:13:32 PST 2011
On 11/10/11 11:06 AM, Ryan Taylor wrote:
> LLVMers,
>
> I am doing a CallGraphPass but would like to get the LoopInfo of
> the functions inside this pass, is this possible? Currently I have a
> function inside the CallGraph struct:
>
> void getAnalysisUsage(AnalysisUsage &AU) const {
> AU.addRequired<LoopInfo>();
> AU.addPreserved<LoopInfo>();
> }
>
> And later inside the pass I am calling:
>
> LoopInfo &LI = getAnalysis<LoopInfo>();
>
> I have also tried to pass the Function pointer to getAnalysis but that
> doesn't work either. With the above code my error is:
1) You may need to pass a Function pointer or reference if your pass is
not a FunctionPass (e.g., if it is a ModulePass).
2) If you have to specify a Function pointer or reference, you need to
make sure that the Function is *not* a declaration:
if (!(F->getDeclaration()))
getAnalysis<LoopInfo>(F);
-- John T.
>
> UNREACHABLE executed!
> 0 opt 0x00000000008edc2f
> 1 opt 0x00000000008edfda
> 2 libpthread.so.0 0x00007f9c8e69bc60
> 3 libc.so.6 0x00007f9c8d986d05 gsignal + 53
> 4 libc.so.6 0x00007f9c8d98aab6 abort + 390
> 5 opt 0x00000000008da974
> llvm::llvm_unreachable_internal(char const*, char const*, unsigned
> int) + 356
> 6 opt 0x000000000087e046
> 7 opt 0x0000000000882b45
> llvm::PMDataManager::add(llvm::Pass*, bool) + 741
> 8 opt 0x000000000087f413
> llvm::PassManager::add(llvm::Pass*) + 259
> 9 opt 0x00000000004ab9be main + 2174
> 10 libc.so.6 0x00007f9c8d971eff __libc_start_main + 255
> 11 opt 0x000000000049f5f9
> Stack dump:
>
>
> Any help would be appreciated, thanks!
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111110/b7543a05/attachment.html>
More information about the llvm-dev
mailing list