Damien D Neff
2008-Aug-15 14:46 UTC
[LLVMdev] Problems understanding alias analysis validation logic
I have a problem where I add an Andersens AA pass to the pass manager, but it appears to get invalidated by another pass, and never rerun. My understanding from reading the documentation is that when a pass gets invalidated, it should be rerun before any other passes that requires it. Here is a simple example of the problem I am seeing: PassManager passManager; passManager.add(new TargetData(getTargetData())); passManager.add(createAndersensPass()); passManager.add(createIPSCCPPass()); passManager.add(createGVNPass()); <----will use BasicAA not Andersens ... In this case, I would expect that the GVN pass would use the andersen AA results, but it doesn't; it uses the results from a Basic AA pass. Reordering the passes like below fixes the problem, but I still don't understand why the andersens wasn't rerun before the GVN pass in the case above: PassManager passManager; passManager.add(new TargetData(*s_executionEngine->getTargetData())); passManager.add(createIPSCCPPass()); passManager.add(createAndersensPass()); passManager.add(createGVNPass()); <----will correctly use the Andersens ... I am using code from the trunk that is about 2 weeks old. Can anyone explain why the basicaa pass is used in the first case instead of the andersens, and what rule of thumb I need to follow to ensure that I get the AA pass I expect. Thanks, Damien _________________________________________________________________ Get ideas on sharing photos from people like you. Find new ways to share. http://www.windowslive.com/explore/photogallery/posts?ocid=TXT_TAGLM_WL_Photo_Gallery_082008
Matthijs Kooijman
2008-Aug-15 17:31 UTC
[LLVMdev] Problems understanding alias analysis validation logic
Hi Damien, I think the problem is that when the passmanager sees an Alias Analysis available, it will use that, but when none is available, it will always run the default implementation (BasicAA), regardless of any alias analysis's run before. This means you should insert Andersen's before any pass that needs it. I suspect (not sure though) that the passmanager will not rerun Andersen's if it is still available, even when you explicitely add it. Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080815/a045a203/attachment.sig>
Robert Zeh
2008-Aug-15 21:42 UTC
[LLVMdev] Problems understanding alias analysis validation logic
I thought the pass manager was supposed to insulate you from the specifics of which passes invalidated which analysis passes. It is possible to at least add the same analysis instance to avoid multiple allocations from the heap? Robert On Aug 15, 2008, at 12:31 PM, Matthijs Kooijman wrote:> Hi Damien, > > I think the problem is that when the passmanager sees an Alias > Analysis > available, it will use that, but when none is available, it will > always run > the default implementation (BasicAA), regardless of any alias > analysis's run > before. This means you should insert Andersen's before any pass that > needs it. > I suspect (not sure though) that the passmanager will not rerun > Andersen's if > it is still available, even when you explicitely add it. > > Gr. > > Matthijs > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Devang Patel
2008-Aug-15 23:34 UTC
[LLVMdev] Problems understanding alias analysis validation logic
On Aug 15, 2008, at 7:46 AM, Damien D Neff wrote:> > I have a problem where I add an Andersens AA pass to the pass > manager, but it appears to get invalidated by another pass, and > never rerun. My understanding from reading the documentation is > that when a pass gets invalidated, it should be rerun before any > other passes that requires it. Here is a simple example of the > problem I am seeing: > > PassManager passManager; > passManager.add(new TargetData(getTargetData())); > passManager.add(createAndersensPass()); > passManager.add(createIPSCCPPass()); > passManager.add(createGVNPass()); <----will use BasicAA not Andersens > ... > > In this case, I would expect that the GVN pass would use the > andersen AA results, but it doesn't; it uses the results from a > Basic AA pass. Reordering the passes like below fixes the problem, > but I still don't understand why the andersens wasn't rerun before > the GVN pass in the case above:Simple answer, the pass manager is not smart enough. It does not remember that it invalidated one of the specialized analysis pass. It could be extended to handle this. - Devang> > > PassManager passManager; > passManager.add(new TargetData(*s_executionEngine->getTargetData())); > passManager.add(createIPSCCPPass()); > passManager.add(createAndersensPass()); > passManager.add(createGVNPass()); <----will correctly use the > Andersens > ... > > I am using code from the trunk that is about 2 weeks old. Can > anyone explain why the basicaa pass is used in the first case > instead of the andersens, and what rule of thumb I need to follow to > ensure that I get the AA pass I expect. Thanks, > > Damien > _________________________________________________________________ > Get ideas on sharing photos from people like you. Find new ways to > share. > http://www.windowslive.com/explore/photogallery/posts?ocid=TXT_TAGLM_WL_Photo_Gallery_082008 > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev