3 ms·
> C++ again suffers from cross-compilation unit visibility; even if your LTO can detect an inlineable call, its AFAIK not possible at that time to move heap all
by pcwalton 12y ago
> C++ again suffers from cross-compilation unit visibility; even if your LTO can detect an inlineable call, its AFAIK not possible at that time to move heap allocations to the stack.
Sure it is. Why not?
C++ compilers don't usually do this because it doesn't help much—explicit memory management encourages people to not allocate unless necessary in the first place.
- deleted 12y ago[deleted]
- Nitramp 12y ago> Sure it is. Why not? Do you have a reference for that? I'd expect this to be hard, at linking time you no longer have the C++ source, so it's much harder to make such decisions.
- pcwalton 12y agoYou don't need the C++ source, just the IR. LLVM already removes mallocs if they are unused: http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-July/033017.html http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-July/033017....