[cfe-dev] Constant folding in clang

Richard Smith richard at metafoo.co.uk
Tue Mar 5 09:51:21 PST 2013


On 5 Mar 2013 09:26, "Giacomo Tagliabue" <giacomo.tag at gmail.com> wrote:
>
> Hello,
> let's say I have this function:
>
> int main(int argc, char const *argv[])
> {
>   return 10+1;
> }
>
> When I compile it with -emit-llvm -S I expect that clang doesn't fold my
constant, but if I look at the .s file i see
>
> ret i32 11
>
> How do I prevent clang to perform folding, or, in general, any kind of
optimization?

Why do you want this? It's possible you would be better served by examining
the AST, not the IR.

> Thanks
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130305/646e2390/attachment.html>


More information about the cfe-dev mailing list