[PATCH] D86744: [Attributes] Add a method to check if an Attribute has AttrKind None. Use instead of hasAttribute(Attribute::None)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 21:33:31 PDT 2020


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/XRayInstrumentation.cpp:148
   auto InstrAttr = F.getFnAttribute("function-instrument");
-  bool AlwaysInstrument = !InstrAttr.hasAttribute(Attribute::None) &&
-                          InstrAttr.isStringAttribute() &&
----------------
dblaikie wrote:
> I'm guessing this was here (and below) as a fastpath? I assume you're removing it because it's probably premature optimization by your judgment? (I'm OK with that, just checking I understand the motivation)
I don't think it was much of a fastpath before. Neither hasAttribute or isStringAttribute are inline. If the pImpl pointer was non-null, hasAttribute would call hasAttribute on pImpl. I'm not sure that was any faster than calling isStringAttribute on pImpl. Neither method calls anything if pImpl is null.

Using isValid might be slightly faster now since its inlined, but seemed small.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86744



More information about the llvm-commits mailing list