[PATCH] [Inliner] Use whitelist instead of blacklist when checking function attribute compatibility and make the check stricter

Akira Hatanaka ahatanak at gmail.com
Tue Mar 24 11:16:17 PDT 2015


Any thoughts?

On Fri, Mar 13, 2015 at 5:36 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> > On 2015-Mar-10, at 14:59, Akira Hatanaka <ahatanak at gmail.com> wrote:
> >
> > I came up with a patch that addresses the concerns Chandler brought up.
> This is still a WIP patch, so I would like to hear feedback before I go too
> far down this route.
> >
> > The updated patch takes a completely different approach to determining a
> function's inlinability. It uses table-gen to specify the attributes' enums
> along with their inlinability/compatibility information. With this new
> approach, whenever someone defines and uses a new attribute in the IR, the
> compatibility information has to be added too. Currently, there is only one
> field in class Attr in the .td file, which indicates whether the inliner
> should check the attribute's compatibility, but it should be easy to add
> other fields or rules if other passes need more information about the
> attribute. For example, I think most of the code in the verifier that looks
> at attributes in the IR can be auto-generated by table-gen.
> >
> > The patch doesn't add any checks for the target-specific function
> attribute strings, but it can be done in a similar way to
> target-independent enum attributes. Functions are auto-generated by
> table-gen from .td files and are passed to the constructor of
> TargetIRAnalysis to enable checking compatibility of target-specific
> attributes. Also, we should be able to generate code that checks the
> validity of a string attribute added to the IR, which is something we
> currently lack. It would issue a warning or error if a string not
> recognized by the target was used to get an attribute from the attribute
> set.
> >
>
> This direction SGTM.  @Chandler, does this look better to you?
>
> >
> > http://reviews.llvm.org/D7802
> >
> > Files:
> >  include/llvm/Analysis/InlineCost.h
> >  include/llvm/Analysis/TargetTransformInfo.h
> >  include/llvm/IR/Attributes.h
> >  include/llvm/IR/EnumAttributes.td
> >  lib/Analysis/IPA/InlineCost.cpp
> >  lib/Analysis/TargetTransformInfo.cpp
> >  lib/CodeGen/LLVMTargetMachine.cpp
> >  lib/IR/Attributes.cpp
> >  lib/IR/Makefile
> >  lib/Target/AArch64/AArch64TargetMachine.cpp
> >  lib/Target/ARM/ARMTargetMachine.cpp
> >  lib/Target/Mips/MipsTargetMachine.cpp
> >  lib/Target/NVPTX/NVPTXTargetMachine.cpp
> >  lib/Target/PowerPC/PPCTargetMachine.cpp
> >  lib/Target/R600/AMDGPUTargetMachine.cpp
> >  lib/Target/TargetMachine.cpp
> >  lib/Target/X86/X86TargetMachine.cpp
> >  lib/Target/XCore/XCoreTargetMachine.cpp
> >  utils/TableGen/Attribute.cpp
> >  utils/TableGen/TableGen.cpp
> >  utils/TableGen/TableGenBackends.h
> >
> > EMAIL PREFERENCES
> >  http://reviews.llvm.org/settings/panel/emailpreferences/
> > <D7802.21626.patch>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150324/5406d54c/attachment.html>


More information about the llvm-commits mailing list