[PATCH] D58694: LLVM: Optimization Pass: Remove conflicting attribute, if any, before adding new read attribute to an argument

Anh Tuyen Tran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 13:55:13 PDT 2019


anhtuyen marked 2 inline comments as done.
anhtuyen added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:684
+    A->removeAttr(Attribute::ReadNone);
+    --NumReadNoneArg;
+  }
----------------
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 ?


================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:685
+    --NumReadNoneArg;
+  }
+  A->addAttr(R);
----------------
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. 


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