[LLVMdev] Optimization of calls to functions without side effects (from Kaleidoscope example)

Dan Gohman gohman at apple.com
Tue Nov 16 09:45:12 PST 2010


On Nov 16, 2010, at 1:19 AM, Arnaud Allard de Grandmaison wrote:

> 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.

Applied, thanks.

> 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.

Did the code in the tutorial work at some point? Offhand, I wouldn't expect
any of my recent changes to have affected this. I'm reluctant to fix this
without understanding how the original code was intended to work.

Dan





More information about the llvm-dev mailing list