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

Fedor Sergeev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 14 16:14:46 PDT 2018


fedor.sergeev added inline comments.


================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1078
+/// attribute predicates stored before.
+bool AttributeInferer::run(const SCCNodeSet &SCCNodes) const {
+  unsigned AttrCount = AttributePredicates.size();
----------------
chandlerc wrote:
> This routine is only going to be run once over an SCC. I think that suggests a much simpler implementation.
> 
> As we process the SCC nodes and the instructions within each, we can use a `remove_if` (or better `erase_if`) pattern so that as predicates fail, we simple remove the struct w/ the callbacks for that attribute.
> 
> Then at the end, we run all the callbacks that remain.
> 
> This should allow you to not have index based walks or the bit vectors.
I can use remove/erase for the purpose of "Valid" attributes tracking.
However I still need a couple of deducible boolean facts separately tracked for each attribute -"ScanHere" and "Ready".
I can try adding those into Predicates structure and clean/set them accordingly.

Lets see how it looks like in implementation suggested by Justin (which, btw, does have an index walk ;) ).


Repository:
  rL LLVM

https://reviews.llvm.org/D44415





More information about the llvm-commits mailing list