[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 10 14:59:23 PDT 2015


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.


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7802.21626.patch
Type: text/x-patch
Size: 25736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150310/4c8b92b7/attachment.bin>


More information about the llvm-commits mailing list