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

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 12:55:17 PDT 2020


dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.
Herald added a subscriber: danielkiss.


================
Comment at: llvm/lib/CodeGen/XRayInstrumentation.cpp:148
   auto InstrAttr = F.getFnAttribute("function-instrument");
-  bool AlwaysInstrument = !InstrAttr.hasAttribute(Attribute::None) &&
-                          InstrAttr.isStringAttribute() &&
----------------
craig.topper wrote:
> 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.
Ah, yeah, makes sense


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