[PATCH] D58694: LLVM: Optimization Pass: Remove conflicting attribute, if any, before adding new read attribute to an argument
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 13:37:15 PDT 2019
jdoerfert added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:684
+ A->removeAttr(Attribute::ReadNone);
+ --NumReadNoneArg;
+ }
----------------
anhtuyen wrote:
> jdoerfert wrote:
> > Why do you decrement the statistics here?
> I thought we increment the count when we added it, so removing it would require a decrement. Is it not right ?
We usually don't do that (here). I would not recommend it anyway.
================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:685
+ --NumReadNoneArg;
+ }
+ A->addAttr(R);
----------------
anhtuyen wrote:
> jdoerfert wrote:
> > There is no need to check if an attribute is present before removing it.
> Although we can remove the attribute even when the argument does not have it, the check is to make sure we decrement the corresponding counter.
See above.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58694/new/
https://reviews.llvm.org/D58694
More information about the llvm-commits
mailing list