Rob Pieke
2010-Nov-15 16:42 UTC
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
SUCCESS! Sorry, I had removed the addFnAttr() call by accident. Using the basicAA pass and ReadOnly, as you suggested, works like a charm! :)> -----Original Message----- > From: Rob Pieke > Sent: Monday, November 15, 2010 4:40 PM > To: 'Duncan Sands' > Cc: 'llvmdev at cs.uiuc.edu'; 'Dan Gohman' > Subject: RE: [LLVMdev] Optimization of calls to functions without side > effects (from Kaleidoscope example) > > Still no luck after switching to: > > theFPM->add( new llvm::TargetData( *theExecutionEngine- > >getTargetData() ) ); > theFPM->add( llvm::createBasicAliasAnalysisPass() ); > theFPM->add( llvm::createInstructionCombiningPass() ); > theFPM->add( llvm::createReassociatePass() ); > theFPM->add( llvm::createGVNPass() ); > theFPM->add( llvm::createCFGSimplificationPass() ); > > Based on output from "llvm-ld -version" and "clang -v" I'm using: > > llvm version 2.9svn > clang version 2.9 (trunk 118171) > > > > > -----Original Message----- > > From: Duncan Sands [mailto:baldrick at free.fr] > > Sent: Monday, November 15, 2010 4:32 PM > > To: Rob Pieke > > Cc: llvmdev at cs.uiuc.edu; Dan Gohman > > Subject: Re: [LLVMdev] Optimization of calls to functions without > side > > effects (from Kaleidoscope example) > > > > Hi Rob, > > > > > I'm using the gvn pass, not sure about basic-aa. > > > > if you are using LLVM from svn then you need to specify the basic-aa > > analysis, > > otherwise gvn won't unify calls to readonly/readnone functions. This > > is new > > behaviour introduced by Dan; probably the tutorial should be updated. > > > > Ciao, > > > > Duncan.
Arnaud Allard de Grandmaison
2010-Nov-16 09:19 UTC
[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
Hi Dan, The tutorial in r119335 does not build : the basicAA pass creation needs to be declared. This is addressed with the 'missing-include' patch, which updates both source code & documentation. The second point is that beside basicAA, to get the optimizations as shown in the tutorial, (sin(x)*sin(x) -> sin(x)^2), some attributes need to be set on 'sin'. Patch 'set-attribute' address this. Of course, this is probably not the right way to achieve this in real life with a real programming language / environment, but within the scope of the kaleidoscope, this should be sufficient. This patch updates both the source code & documentation. Best regards, -- Arnaud de Grandmaison -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Dan Gohman Sent: Monday, November 15, 2010 7:45 PM To: Rob Pieke Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example) On Nov 15, 2010, at 8:42 AM, Rob Pieke wrote:> SUCCESS! > > Sorry, I had removed the addFnAttr() call by accident. Using the basicAA pass and ReadOnly, as you suggested, works like a charm! > > :)Thanks. I've updated the documentation and examples in r119169. I didn't update the OCaml documentation or examples yet. It looks like the OCaml bindings don't expose basicaa yet, though it should be easy to add for someone familiar with the bindings. Dan _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev CONFIDENTIAL NOTICE: The contents of this message, including any attachments, are confidential and are intended solely for the use of the person or entity to whom the message was addressed. If you are not the intended recipient of this message, please be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. If you received this message in error, please notify the sender. Please also permanently delete all copies of the original message and any attached documentation. Thank you. -------------- next part -------------- A non-text attachment was scrubbed... Name: kaleidoscope-set-attribute.patch Type: application/octet-stream Size: 6570 bytes Desc: kaleidoscope-set-attribute.patch URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101116/03869e1d/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: kaleidoscope-missing-include.patch Type: application/octet-stream Size: 3826 bytes Desc: kaleidoscope-missing-include.patch URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101116/03869e1d/attachment-0001.obj>
Apparently Analagous Threads
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)
- [LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)