[llvm-commits] [llvm] r151429 - in /llvm/trunk: include/llvm/Transforms/IPO.h include/llvm/Transforms/IPO/InlinerPass.h include/llvm/Transforms/Utils/Cloning.h lib/Transforms/IPO/InlineAlways.cpp lib/Transforms/IPO/InlineSimple.cpp lib/Transforms

Duncan Sands baldrick at free.fr
Sun Feb 26 00:28:32 PST 2012

Hi Rafael,

On 26/02/12 02:53, Rafael EspĂ­ndola wrote:
>> At -O0 the AlwaysInliner pass is run to honor the always_inline attribute.  By default the @llvm.lifetime_start and @llvm.lifetime_end intrinsics were being emitted.  These are compiler hints and at -O0 they're never used and thus should not be emitted.  The particular test case I came across was compiling in 283s at -O0 (fast, huh).  Now it compiles in 1.35s at -O0.  By abuse I mean the developer thinks they're smarted then the compiler, so they mark everything with the always_inline attribute.  I'm not saying this is a common problem, but regardless these intrinsics are useless at -O0.
> Why did you had to change both llvm and clang? Why not just stop
> emitting the hints in clang?

IIRC the inliner inserts them too: suppose foo calls bar and you inline the
call.  Any alloca instructions for bar are added to the entry block of foo.
However since they are only "live" in the inlined bar code, and not for any
other code in foo, lifetime intrinsics for the alloca are inserted before
any after the inlined bar code to delineate where the allocas are actually
in use.

Ciao, Duncan.

More information about the llvm-commits mailing list