[LLVMdev] [RFC] NoBuiltin Attribute

Bill Wendling wendling at apple.com
Tue Feb 19 23:36:47 PST 2013


On Feb 19, 2013, at 9:15 PM, Chris Lattner <clattner at apple.com> wrote:

>> There are two (old) bugs related to this: a PR and a radar. They both seem to be of low priority, though.
>> 
>> One thing that might help in this discussion is to note that attributes are *not* part of the function type (signature, whatever). So we cannot have a function declaration with 'nobuiltin' and another declaration without it.
> 
> You mean "So we *can* have a function declaration"...
> 
I'm confused. That's not something that works today. This doesn't assemble:

declare i32 @x() nounwind
declare i32 @x() noinline

define i32 @foo(i32 %a, i32 %b, i32 %c) nounwind {
    %t0 = tail call i32 @x() nounwind
    %t1 = sdiv i32 %a, %b
    ret i32 %t1
}

Do you want this to change?

>> Another thing to note is that during LTO I plan to restrict inlining of functions to those whose attributes match. This is an overly conservative approach, but one which will minimize generating code the user didn't want/expect.
> 
> This is exactly why these should be put on calls in the compiled scope, not on the function bodies being compiled, which I'm pretty sure your patch doesn't do.
> 
Okay. I was confused by the previous discussion then.

>> This can be applied to function definitions, but not to function declarations or to call/invoke instructions, because that kind of granularity doesn't make a lot of sense to me.
> 
> I think we should do it, otherwise inlining is unnecessarily harmed.  Given that attributes are displayed in .ll files with the # syntax, there should be no bloat/unreadability impact.
> 
>> The LibSimplify code will check the function containing the call/invoke for the `NoBuiltin' attribute to see if it is allowed to simplify the builtin.
>> What do you think?
> 
> Sounds ok, but I think the attribute should be on compiled call sites instead of compiled function bodies.  If we're going to do this, might as well do it right.
> 
Alright, then the attribute will be applied to the call/invoke instructions and not the function definitions and declarations.

-bw




More information about the llvm-dev mailing list