[PATCH] D99299: Normalize interaction with boolean attributes
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 24 14:02:21 PDT 2021
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: nikic.
Herald added subscribers: dexonsmith, jdoerfert, laytonio, kerbowa, pengfei, atanasyan, jrtc27, fedor.sergeev, kbarton, hiraditya, nhaehnle, jvesely, nemanjai, sdardis, jyknight, arsenm, jholewinski.
serge-sans-paille requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Such attributes can either be unset, or set to "true" or "false" (as string).
throughout the codebase, this led to inelegant checks ranging from
if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true")
to
if (Fn->hasAttribute("no-jump-tables") && Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true")
Introduce a getValueAsBool that normalize the check, with the following
behavior:
no attributes or attribute set to "false" => return false
attribute set to "true" => return true
https://reviews.llvm.org/D99299
Files:
clang/lib/CodeGen/CodeGenFunction.cpp
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/include/llvm/IR/Attributes.h
llvm/lib/Analysis/IVDescriptors.cpp
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/IR/AttributeImpl.h
llvm/lib/IR/Attributes.cpp
llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
llvm/lib/Target/AMDGPU/AMDGPULowerKernelAttributes.cpp
llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
llvm/lib/Target/ARM/ARMTargetMachine.cpp
llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
llvm/lib/Target/M68k/M68kISelLowering.cpp
llvm/lib/Target/Mips/MipsTargetMachine.cpp
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
llvm/lib/Target/Sparc/SparcTargetMachine.cpp
llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
llvm/lib/Target/TargetMachine.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99299.333118.patch
Type: text/x-patch
Size: 16217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210324/152e1588/attachment-0001.bin>
More information about the llvm-commits
mailing list