[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
Thu Aug 27 20:53:19 PDT 2020


dblaikie 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() &&
----------------
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)


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:404-405
   Attribute GPUAttr = F.getFnAttribute("target-cpu");
-  return GPUAttr.hasAttribute(Attribute::None) ?
+  return !GPUAttr.isValid() ?
     getTargetCPU() : GPUAttr.getValueAsString();
 }
----------------
This and below might be more legibly written as:
```
return GPUAttr.isValid() ? GpuAttr.getValueAsString() : getTargetCPU();
```
now?


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