[PATCH] D117552: [Attributes] Make attribute addition behavior consistent

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 19 00:14:31 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/IR/Attributes.cpp:1737
   for (unsigned Index = 0; Index < Attribute::NumIntAttrKinds; ++Index)
-    if (!IntAttrs[Index])
+    if (B.IntAttrs[Index])
       IntAttrs[Index] = B.IntAttrs[Index];
----------------
serge-sans-paille wrote:
> It seems to me this could just be `IntAttrs |= B.IntAttrs` which is probably faster. 
I don't think that std::array has an `operator|=` overload, and it probably wouldn't do what we want here (if it just works elementwise): For example, for `dereferenceable(1)` and `deferenceable(2)` we don't want to get back `dereferenceable(3)`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117552/new/

https://reviews.llvm.org/D117552



More information about the llvm-commits mailing list