[all-commits] [llvm/llvm-project] 1f5ea1: [Analysis] Add FIXME:s related to size_t type checks

Björn Pettersson via All-commits all-commits at lists.llvm.org
Tue Sep 28 06:30:18 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1f5ea14bca71aecad1f5a6017ff20fe50c9da752
      https://github.com/llvm/llvm-project/commit/1f5ea14bca71aecad1f5a6017ff20fe50c9da752
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/lib/Analysis/TargetLibraryInfo.cpp

  Log Message:
  -----------
  [Analysis] Add FIXME:s related to size_t type checks

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


  Commit: 460efc1fb8354295ce1320b5dae62f06cdeda278
      https://github.com/llvm/llvm-project/commit/460efc1fb8354295ce1320b5dae62f06cdeda278
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-09-28 (Tue, 28 Sep 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/TargetLibraryInfo.h
    M llvm/lib/Analysis/TargetLibraryInfo.cpp

  Log Message:
  -----------
  [Analysis] Be defensive when matching size_t in lib call signatures

When TargetLibraryInfoImpl::isValidProtoForLibFunc is checking
function signatures to detect lib calls it may check that a parameter
or return value matches with the "size_t" type. For this to work it
has to derive the IR type matching with "size_t". Depending on if
a DataLayout is provided or not, this has been done in two different
way. Either a more strict check being based on IntPtrType (which is
given by the DataLayout) or a more relaxed check assuming that any
integer type matches with "size_t".

Given that the stricter approach exist it seems like we do not want
to trigger rewrites etc if we aren't sure that a function calls
actually match with the library function. Therefore it was questioned
why we actually have the more relaxed approach when not being able
to derive an IR type for "size_t". This patch will take a more
defensive approach, requiring that a DataLayout is passed to
isValidProtoForLibFunc.

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


Compare: https://github.com/llvm/llvm-project/compare/86bf234d0b70...460efc1fb835


More information about the All-commits mailing list