[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 15:32:24 PDT 2020


craig.topper created this revision.
craig.topper added reviewers: efriedma, dblaikie, arsenm, rnk.
Herald added subscribers: kerbowa, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, fedor.sergeev, kbarton, hiraditya, jgravelle-google, sbc100, nhaehnle, jvesely, nemanjai, sdardis, jyknight, dschuff.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
craig.topper requested review of this revision.
Herald added subscribers: MaskRay, aheejin, wdng.

There's a special case in hasAttribute for None when pImpl is null. If pImpl is not null we dispatch to pImpl->hasAttribute which will always return false for Attribute::None.

So if we just want to check for None its sufficient to just check that pImpl is null. Which can even be done inline.

This patch adds a helper for that case which I hope will speed up our getSubtargetImpl implementations.

Alternatively we could extend the special case to only call pImpl->hasAttribute if we're not looking for None. But we couldn't do it inline without splitting hasAttribute into a inline and non-inline part.


https://reviews.llvm.org/D86744

Files:
  llvm/include/llvm/IR/Attributes.h
  llvm/lib/CodeGen/XRayInstrumentation.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
  llvm/lib/Target/Mips/MipsTargetMachine.cpp
  llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
  llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
  llvm/lib/Target/Sparc/SparcTargetMachine.cpp
  llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86744.288469.patch
Type: text/x-patch
Size: 13726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/8b1f9e07/attachment-0001.bin>


More information about the llvm-commits mailing list