HomePhabricator

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

Authored by lattner on Sep 8 2021, 10:13 PM.

Description

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

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.
  1. 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.

Differential Revision: https://reviews.llvm.org/D109483