[all-commits] [llvm/llvm-project] f54917: [funcattrs] Add the maximal set of implied attribu...
Philip Reames via All-commits
all-commits at lists.llvm.org
Fri Apr 16 14:22:37 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f549176ad976caa3e19edd036df9a7e12770af7c
https://github.com/llvm/llvm-project/commit/f549176ad976caa3e19edd036df9a7e12770af7c
Author: Philip Reames <listmail at philipreames.com>
Date: 2021-04-16 (Fri, 16 Apr 2021)
Changed paths:
M clang/test/CodeGenOpenCL/convergent.cl
M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
M llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
M llvm/test/CodeGen/AMDGPU/inline-attr.ll
M llvm/test/Other/cgscc-devirt-iteration.ll
M llvm/test/Other/cgscc-iterate-function-mutation.ll
M llvm/test/Other/cgscc-observe-devirt.ll
M llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll
M llvm/test/Transforms/FunctionAttrs/atomic.ll
M llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
M llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
M llvm/test/Transforms/FunctionAttrs/nofree.ll
M llvm/test/Transforms/FunctionAttrs/nosync.ll
M llvm/test/Transforms/FunctionAttrs/nounwind.ll
M llvm/test/Transforms/FunctionAttrs/optnone.ll
M llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
M llvm/test/Transforms/FunctionAttrs/writeonly.ll
M llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
M llvm/test/Transforms/Inline/cgscc-update.ll
Log Message:
-----------
[funcattrs] Add the maximal set of implied attributes to definitions
Have funcattrs expand all implied attributes into the IR. This expands the infrastructure from D100400, but for definitions not declarations this time.
Somewhat subtly, this mostly isn't semantic. Because the accessors did the inference, any client which used the accessor was already getting the stronger result. Clients that directly checked presence of attributes (there are some), will see a stronger result now.
The old behavior can end up quite confusing for two reasons:
* Without this change, we have situations where function-attrs appears to fail when inferring an attribute (as seen by a human reading IR), but that consuming code will see that it should have been implied. As a human trying to sanity check test results and study IR for optimization possibilities, this is exceeding error prone and confusing. (I'll note that I wasted several hours recently because of this.)
* We can have transforms which trigger without the IR appearing (on inspection) to meet the preconditions. This change doesn't prevent this from happening (as the accessors still involve multiple checks), but it should make it less frequent.
I'd argue in favor of deleting the extra checks out of the accessors after this lands, but I want that in it's own review as a) it's purely stylistic, and b) I already know there's some disagreement.
Once this lands, I'm also going to do a cleanup change which will delete some now redundant duplicate predicates in the inference code, but again, that deserves to be a change of it's own.
Differential Revision: https://reviews.llvm.org/D100226
More information about the All-commits
mailing list