[PATCH] D70366: Add new 'flatten' LLVM attribute to fix clang's 'flatten' function attribute

LevitatingLion via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 17 16:11:22 PST 2019


LevitatingLion created this revision.
LevitatingLion added reviewers: jdoerfert, pcc, chandlerc.
LevitatingLion added projects: LLVM, clang.
Herald added subscribers: dexonsmith, steven_wu, haicheng, hiraditya, eraman, nhaehnle, jvesely, mehdi_amini, arsenm.

This adds a new 'flatten' attribute, which works like 'always_inline' but applies recursively to inlined call sites. The addition was briefly discussed on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2019-November/136514.html

This patch also contains changes to clang, so that it uses the new LLVM attribute on functions marked with the clang attribute 'flatten'. Previously, clang marked all calls in such functions with 'always_inline'; in effect, only the first level of calls was inlined.

Currently this patch fails the '/llvm/test/Bitcode/highLevelStructure.3.2.ll' test. llvm-dis seems to be unable to correctly decode attributes stored in the bitcode when the new attribute is added, although other attributes don't seem to have required any handling of this problem, see https://reviews.llvm.org/D62766 or https://reviews.llvm.org/D49165. I speculated that's because this is the 65th attribute, so a bitmask indicating all attributes doesn't fit in 64 bit anymore.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70366

Files:
  clang/lib/CodeGen/CGCall.cpp
  llvm/docs/BitCodeFormat.rst
  llvm/docs/LangRef.rst
  llvm/include/llvm/Bitcode/LLVMBitCodes.h
  llvm/include/llvm/IR/Attributes.td
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/LLToken.h
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
  llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
  llvm/lib/Transforms/IPO/AlwaysInliner.cpp
  llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp
  llvm/lib/Transforms/IPO/HotColdSplitting.cpp
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/lib/Transforms/IPO/PartialInlining.cpp
  llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/test/Transforms/Inline/flatten.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70366.229733.patch
Type: text/x-patch
Size: 17672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191118/25127c0f/attachment-0001.bin>


More information about the cfe-commits mailing list