[LLVMbugs] [Bug 13242] malloc (not alloca) optimization issue

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jul 1 18:07:50 PDT 2012


Nick Lewycky <nicholas at mxc.ca> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |nicholas at mxc.ca
         Resolution|                            |WONTFIX

--- Comment #1 from Nick Lewycky <nicholas at mxc.ca> 2012-07-01 20:07:50 CDT ---
When you use alloca and pass it in as a pointer argument to a function, we are
more likely to inline that function into its caller. That's because "alloca" is
how variables are implemented under the hood ("int x;" becomes "int *x_ptr =
alloca(sizeof int);"). So it looks like someone simply wrote &x.

The difference in performance is that we inlined the call to loop() from main
in the case you used alloca and didn't when you used malloc.

If you have real world code which exhibits bad inlining decisions, please file
a bug on that, but I'm going to close this bug.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list