[PATCH] D109483: [APInt] Normalize naming on keep constructors / predicate methods.

Chris Lattner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 22:19:49 PDT 2021


lattner created this revision.
Herald added subscribers: wenzhicui, wrengr, Chia-hungDuan, armkevincheng, foad, jsmolens, eric-k256, dcaballe, cota, mravishankar, teijeong, dexonsmith, rdzhabarov, ecnelises, tatianashp, jdoerfert, msifontes, jurahul, Kayjukh, grosul1, martong, Joonsoo, kerbowa, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, csigg, antiagainst, shauheen, rriddle, mehdi_amini, pengfei, atanasyan, jrtc27, haicheng, kbarton, hiraditya, eraman, nhaehnle, jvesely, nemanjai, arsenm.
Herald added a reviewer: rriddle.
Herald added a reviewer: aartbik.
Herald added a reviewer: sjarus.
lattner requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, LLDB, MLIR, LLVM.

This renames the primary methods for creating a zero value to `getZero`
instead of `getNullValue` and renames predicates like `isAllOnesValue`
to simply `isAllOnes`.  This achieves two things:

1. This starts standardizing predicates across the LLVM codebase, following (in this case) ConstantInt.  The word "Value" doesn't convey anything of merit, and is missing in some of the other things.

2. Calling an integer "null" doesn't make any sense.  The original sin here is mine and I've regretted it for years.  This moves us to calling it "zero" instead, which is correct!

APInt is widely used and I don't think anyone is keen to take massive source
breakage on anything so core, at least not all in one go.  As such, this
doesn't actually delete any entrypoints, it "soft deprecates" them with a
comment.

Included in this patch are changes to a bunch of the codebase, but there are
more.  We should normalize SelectionDAG and other APIs as well, which would
make the API change more mechanical.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109483

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp
  lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
  lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
  lldb/source/Utility/Scalar.cpp
  llvm/include/llvm/ADT/APInt.h
  llvm/include/llvm/ADT/APSInt.h
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
  llvm/include/llvm/CodeGen/SelectionDAG.h
  llvm/include/llvm/IR/Constants.h
  llvm/include/llvm/IR/PatternMatch.h
  llvm/include/llvm/Support/KnownBits.h
  llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
  llvm/lib/Analysis/DemandedBits.cpp
  llvm/lib/Analysis/DependenceAnalysis.cpp
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Analysis/LazyValueInfo.cpp
  llvm/lib/Analysis/MemoryBuiltins.cpp
  llvm/lib/Analysis/StackSafetyAnalysis.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
  llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
  llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/lib/CodeGen/SwitchLoweringUtils.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/CodeGen/TypePromotion.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/ConstantRange.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/Type.cpp
  llvm/lib/MCA/InstrBuilder.cpp
  llvm/lib/Support/APFixedPoint.cpp
  llvm/lib/Support/APFloat.cpp
  llvm/lib/Support/APInt.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/Lanai/LanaiISelLowering.cpp
  llvm/lib/Target/M68k/M68kISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  llvm/lib/Transforms/Scalar/Float2Int.cpp
  llvm/lib/Transforms/Scalar/Reassociate.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/tools/llvm-stress/llvm-stress.cpp
  llvm/unittests/ADT/APIntTest.cpp
  llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
  llvm/unittests/CodeGen/GlobalISel/KnownBitsVectorTest.cpp
  llvm/unittests/IR/ConstantRangeTest.cpp
  llvm/unittests/IR/PatternMatch.cpp
  llvm/unittests/Support/KnownBitsTest.cpp
  mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
  mlir/lib/Dialect/StandardOps/IR/Ops.cpp
  mlir/lib/IR/BuiltinAttributes.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109483.371503.patch
Type: text/x-patch
Size: 142276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210909/36d21179/attachment-0001.bin>


More information about the llvm-commits mailing list