On 10/10/14, 7:27 PM, Manish Gupta wrote:> Dear All,
>
> I am trying to use an Analysis Pass inside a transformation pass.
> After the transformations, I call the analysis pass again using
> getAvailableAnalysis but it seems to run on the old IR.
>
> *Snippet of my code: *
> MyAnalysis* MP = getAnalysisIfAvailable<MyAnalysis>();
> ... Transformation code ...
> MyAnalysis* NewMP = getAnalysisIfAvailable<MyAnalysis>();
> ... Transformation code ...
>
> MP and NewMP are the same, while I have transformed the code. Please
> let me know if there is something wrong with what I am doing.
It looks like your transformation pass and the analysis pass you're
querying are the same type of pass (either they're both FunctionPass'es
or ModulePass'es). The PassManager isn't rerunning the analysis pass
because your pass is still running; it will not decide on whether to
rerun the analysis pass until your pass is finished. As a result, the
analysis pass's results reflect what it computed *before* your pass ran
and will not reflect any changes that your transform pass has made.
While there are a few exceptions, in the general case, a transform pass
cannot rely on an analysis pass to update itself to reflect changes that
the transform pass has made. The transform pass can only see analysis
results for what the code looked like before transformation started.
Regards,
John Criswell
>
> Thanks!
> Manish
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20141012/1c321bb3/attachment.html>