[PATCH] D58694: LLVM: Optimization Pass: Function Attribute: Fix error caused by adding incompactible attribute to WriteOnly attribute of pointer argument
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 12:22:39 PDT 2019
jdoerfert added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:730
+ (A->materialized_use_empty())) {
+ A->removeAttr(Attribute::WriteOnly);
+ } else {
----------------
anhtuyen wrote:
> jdoerfert wrote:
> > In general, I dislike specialization for write-only in the first place. If that is voted in, we should make at least the reasoning more explicit: Initializing `R` with readnon above is hard to follow. It should be placed inside this conditional instead.
> Hi @jdoerfert , will you like it better if I move the code to handle **writeonly** (and additionally **readonly**) to inside the function **determinePointerReadAttrs** ?
I prefer replacing all the code, see D59918 and D59980.
For now, I'd argue wherever we have something like
`A->addAttr(R);`
we should remove conflicting arguments.
So make a function, say `addReadAttr(AttrKind R)`,
which (1) removes conflicting attributes, (2) adds the new attribute, and (3) does the bookkeping (statistics).
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