[llvm-commits] [llvm] r47220 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll
Chris Lattner
clattner at apple.com
Sun Feb 17 10:37:59 PST 2008
On Feb 16, 2008, at 6:41 PM, Duncan Sands wrote:
> Hi Chris,
>>> Remove any 'nest' parameter attributes if the function
>>> is not passed as an argument to a trampoline intrinsic.
>>
>> Nice. Out of curiousity, how does nest do to codegen?
>
> 'nest' causes a specific register to be grabbed for the
> parameter in calls. So removing it doesn't do much :)
Ok.
>> Alternatively, maybe ParamAttrsList
>> should have a 'find attribute' function that returns the first
>> argument that has the specified attribute?
>
> I think that would only be useful for attributes that can occur at
> most once, i.e. sret and nest, and since sret is always on the first
> parameter it's not useful for sret. I did consider a
> removeAttrEverywhere method, but again it didn't seem generally
> useful.
Fair enough!
>>> +static void RemoveNestAttribute(Function *F) {
>>> + F->setParamAttrs(StripNest(F->getParamAttrs()));
>>> + for (Value::use_iterator UI = F->use_begin(), E = F->use_end();
>>> UI != E;++UI){
>>> + Instruction *User = cast<Instruction>(*UI);
>>
>>> + if (CallInst *CI = dyn_cast<CallInst>(User)) {
>>
>> Please use CallSite to handle CallInst/Invoke uniformly.
>
> To create a CallSite don't you first need to get your hands on
> either a CI
> or an II? Which means doing the dyn_cast and test anyway, to
> produce the
> CallSite (this is annoying, maybe it should be possible to create
> one from
> an Instruction*).
You can just do:
CallSite User(cast<Instruction>(*UI));
and then handle user generically.
> So I don't see that it gains you much. Also, in
> ChangeCalleesToFastCall a few lines above I see that a certain
> "lattner"
> didn't consider a CallSite useful for the calling convention case :)
Heh, CallSite probably didn't exist when that was written, or my
commit wasn't adequately reviewed by my peers ;-)
-Chris
More information about the llvm-commits
mailing list