[PATCH] D147022: inline global alias
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 00:14:02 PDT 2023
nikic added subscribers: pcc, nikic.
nikic requested changes to this revision.
nikic added a reviewer: pcc.
nikic added a comment.
This revision now requires changes to proceed.
Herald added a subscriber: StephenFan.
Adding @pcc for alias optimizations.
================
Comment at: llvm/include/llvm/IR/InstrTypes.h:1409
/// invocation or the function signature does not match the call signature.
Function *getCalledFunction() const {
+ Value *V = getCalledOperand();
----------------
yaxunl wrote:
> arsenm wrote:
> > tra wrote:
> > > Are we sure that there are no users of these `getCalledFunction` functions that would expect them to return nullptr when we deal with an alias?
> > >
> > > Unless someone familiar with the code says that it's OK to treat aliases as functions here, I would try to keep effect of the change limited to the area where we're making a decision to inline the function or alias.
> > I do think getCalledFunction is a hazardous function where most users do the wrong thing. This will continue to miss constantexpr casts. Could also stripPointerCastsAndAliases. I'm not sure if we want to change this or not
> I checked the references of getCalledFunction. It seems most cases they do not care whether a function is called through alias. However, there are situations where alias may be different from its aliasee.
>
> I could add an optional parameter AllowAlias to getCalledFunction and by default off. Then turn it on where it makes sense.
`getCalledFunction()` is explicitly not supposed to look through bitcasts, let alone aliases. Use `getCalledOperand()->stripPointerCastsAndAliases()` in places where you think stripping aliases is safe.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147022/new/
https://reviews.llvm.org/D147022
More information about the llvm-commits
mailing list