[LLVMdev] [Bug 3756] __attribute__((always_inline)) and __builtin_constant_p

Dan Gohman gohman at apple.com
Mon Mar 23 18:29:05 PDT 2009


On Mar 19, 2009, at 11:57 PM, Nick Lewycky wrote:

> Dan Gohman wrote:
>> On Mar 15, 2009, at 6:16 PM, Nick Lewycky wrote:
>>> Before any optimizations can be applied the function must be  
>>> converted
>>> into LLVM IR. In LLVM IR we have no equivalent for
>>> "builtin_constant_p".
>>> Thus the __builtin_constant_p is evaluated and found false as part  
>>> of
>>> converting the GCC trees into LLVM IR, then the always_inliner is
>>> applied on the IR.
>>
>> Supporting always_inline as a type-safe macro which is always  
>> expanded
>> early is a feature of GCC that people have found useful.  It is a
>> limitation of
>> LLVM that this happens to be complicated to implement there.
>
> Okay. I find it hard to call this a bug in LLVM's always-inliner, as
> there's nothing you can change in the always-inliner to fix it.

It's a missing feature in llvm-gcc, from an end-user perspective.
How it might be implemented is an implementation detail.

Dan




More information about the llvm-dev mailing list