[PATCH] Remove CloneFunction VMap

Tobias Edler von Koch tobias at codeaurora.org
Tue Apr 28 14:23:49 PDT 2015


Hi Pete,

On Tue, 28 Apr 2015 13:21:19 -0700 Pete Cooper <peter_cooper at apple.com>
wrote:

> > I have a downstream pass using this, but it's not a big deal because
> > it's possible to replicate the old behavior by creating a new
> > function yourself and then using CloneFunctionInto, which lets you remap
> > the arguments.
> So it took a look at the callers of CloneFunctionInto and none of them are using this functionality either.  I’d love to remove all of the attribute set hacking at the top of CloneFunctionInto, but that’ll break your out-of-tree code.  Specifically, its this code, and the loop under it:
> 
>   // Copy all attributes other than those stored in the AttributeSet.  We need
>   // to remap the parameter indices of the AttributeSet.
>   AttributeSet NewAttrs = NewFunc->getAttributes();
>   NewFunc->copyAttributesFrom(OldFunc);
>   NewFunc->setAttributes(NewAttrs);
> 
> If this code is particularly useful to you then i’m happy to leave it as is.  Otherwise, if there’s some way I can delete the unused code in CloneFunctionInto then that would be great.

I agree this code shouldn't really be in CloneFunctionInto because it
doesn't clone (what I would consider) 'content' of the function, but
rather 'meta-information'/attributes.

My use case is about substituting constants for function arguments and
as far as I can see that's still possible by putting them into the VMap
before calling CloneFunctionInto, right? The copying of attributes can
be done manually.

I wonder whether there's anything we can do to make sure out-of-tree
stuff doesn't silently and subtly break when you make this change.
Change the function name? Change the argument list?

Just out of curiosity - are you trying to remove dead code across the
code base or what's the motivation for your work?

Thanks,
Tobias

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project.




More information about the llvm-commits mailing list