[PATCH] D44415: [PM][FunctionAttrs] add NoUnwind attribute inference to PostOrderFunctionAttrs pass

Fedor Sergeev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 13 04:11:51 PDT 2018


fedor.sergeev created this revision.
fedor.sergeev added reviewers: chandlerc, jlebar.
Herald added a subscriber: eraman.

This was motivated by absence of PrunEH functionality in new PM. It was decided that a proper way to do PruneEH is to add NoUnwind inference into PostOrderFunctionAttrs and then perform normal SimplifyCFG on top.

This change generalizes attribute handling implemented for (a removal of) Convergent attribute, by introducing a generic builder-like class

  AttributeInferer

It registers all the attribute inference requests, storing per-attribute predicates into a vector, and then goes through an SCC Node, scanning all the instructions for not breaking attribute assumptions.

The main idea is that as soon all the instructions from all the functions of SCC Node conform to attribute assumptions then we are free to infer the attribute as set for all the functions of SCC Node.

It handles two distinct cases of attributes:

- "derefinable", those that might break due to derefinement of the function code

  for these attributes we are allowed to apply inference only if all the functions are "exact definitions". Example - NoUnwind.
- "non-derefinable", those that do not care about derefinement

  for these attributes we are allowed to apply inference as soon as we see any function definition. Example - removal of Convergent attribute. (Why?)

Also in this commit: * Converted all the FunctionAttrs tests to use FileCheck and added new-PM

  invocations to them

- PruneEH tests were converted to new-PM as well, using function-attrs+simplify-cfg combo as intended

- some of "other" tests were updated since function-attrs now infers 'nounwind' even for old PM pipeline


Repository:
  rL LLVM

https://reviews.llvm.org/D44415

Files:
  lib/Transforms/IPO/FunctionAttrs.cpp
  test/Other/cgscc-devirt-iteration.ll
  test/Transforms/FunctionAttrs/2008-09-03-Mutual.ll
  test/Transforms/FunctionAttrs/2008-09-03-ReadNone.ll
  test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll
  test/Transforms/FunctionAttrs/2008-09-13-VolatileRead.ll
  test/Transforms/FunctionAttrs/2008-12-29-Constant.ll
  test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
  test/Transforms/FunctionAttrs/2010-10-30-volatile.ll
  test/Transforms/FunctionAttrs/assume.ll
  test/Transforms/FunctionAttrs/atomic.ll
  test/Transforms/FunctionAttrs/comdat-ipo.ll
  test/Transforms/FunctionAttrs/convergent.ll
  test/Transforms/FunctionAttrs/int_sideeffect.ll
  test/Transforms/FunctionAttrs/nocapture.ll
  test/Transforms/FunctionAttrs/nonnull-global.ll
  test/Transforms/FunctionAttrs/nonnull.ll
  test/Transforms/FunctionAttrs/norecurse.ll
  test/Transforms/FunctionAttrs/operand-bundles-scc.ll
  test/Transforms/FunctionAttrs/optnone.ll
  test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll
  test/Transforms/FunctionAttrs/readnone.ll
  test/Transforms/FunctionAttrs/returned.ll
  test/Transforms/Inline/cgscc-update.ll
  test/Transforms/PruneEH/2008-06-02-Weak.ll
  test/Transforms/PruneEH/ipo-nounwind.ll
  test/Transforms/PruneEH/operand-bundles.ll
  test/Transforms/PruneEH/pr23971.ll
  test/Transforms/PruneEH/pr26263.ll
  test/Transforms/PruneEH/recursivetest.ll
  test/Transforms/PruneEH/seh-nounwind.ll
  test/Transforms/PruneEH/simpletest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44415.138148.patch
Type: text/x-patch
Size: 34481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180313/aaa4ce63/attachment.bin>


More information about the llvm-commits mailing list