[PATCH] D129915: [InstCombine] Tighten up known library function signature tests (PR #56463)

Martin Sebor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 12:17:02 PDT 2022


msebor updated this revision to Diff 448697.
msebor added a comment.

I like the idea of defining the signatures using the `TLI_` macros in `TargetLibraryInfo.def`.  It keeps most of the related bits together in the same place.

Revision 3 with the patch with the following changes:

- provide definitions of known library function signatures in `TargetLibraryInfo.def` by means of two new macros: `TLI_DEFINE_SIG` and `TLI_DEFINE_SIG_INTERNAL`, analogous to the function names and the corresponding enumerated constants
- replace a large `switch` statement in `TargetLibraryInfoImpl::isValidProtoForLibFuncmacros` with indexing into the array
- tighten up type checking a bit further to avoid integers smaller than `int` matching it or larger


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129915/new/

https://reviews.llvm.org/D129915

Files:
  llvm/include/llvm/Analysis/TargetLibraryInfo.def
  llvm/lib/Analysis/TargetLibraryInfo.cpp
  llvm/test/CodeGen/AMDGPU/complex-folding.ll
  llvm/test/CodeGen/AMDGPU/fabs.ll
  llvm/test/CodeGen/AMDGPU/floor.ll
  llvm/test/CodeGen/AMDGPU/fneg-fabs.ll
  llvm/test/CodeGen/AMDGPU/r600-infinite-loop-bug-while-reorganizing-vector.ll
  llvm/test/CodeGen/AMDGPU/schedule-if-2.ll
  llvm/test/Transforms/DeadStoreElimination/simple.ll
  llvm/test/Transforms/InferFunctionAttrs/annotate-2.ll
  llvm/test/Transforms/InferFunctionAttrs/annotate.ll
  llvm/test/Transforms/InstCombine/bcopy.ll
  llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
  llvm/test/Transforms/InstCombine/fprintf-1.ll
  llvm/test/Transforms/InstCombine/fwrite-1.ll
  llvm/test/Transforms/InstCombine/mem-deref-bytes-addrspaces.ll
  llvm/test/Transforms/InstCombine/mem-deref-bytes.ll
  llvm/test/Transforms/InstCombine/new-delete-itanium-32.ll
  llvm/test/Transforms/InstCombine/new-delete-itanium.ll
  llvm/test/Transforms/InstCombine/printf-2.ll
  llvm/test/Transforms/InstCombine/simplify-libcalls-i16.ll
  llvm/test/Transforms/InstCombine/simplify-libcalls.ll
  llvm/test/Transforms/InstCombine/sprintf-3.ll
  llvm/test/Transforms/InstCombine/sqrt-nofast.ll
  llvm/test/Transforms/InstCombine/stdiocall-bad-sig.ll
  llvm/test/Transforms/InstCombine/stpcpy-1.ll
  llvm/test/Transforms/InstCombine/stpcpy-2.ll
  llvm/test/Transforms/InstCombine/stpcpy_chk-2.ll
  llvm/test/Transforms/InstCombine/str-int.ll
  llvm/test/Transforms/InstCombine/strcall-bad-sig.ll
  llvm/test/Transforms/InstCombine/strcat-3.ll
  llvm/test/Transforms/InstCombine/strcpy-2.ll
  llvm/test/Transforms/InstCombine/strcpy_chk-2.ll
  llvm/test/Transforms/InstCombine/strncat-3.ll
  llvm/test/Transforms/InstCombine/strncpy-2.ll
  llvm/test/Transforms/InstCombine/strncpy_chk-2.ll
  llvm/test/Transforms/InstCombine/strndup.ll
  llvm/test/Transforms/InstCombine/strpbrk-2.ll
  llvm/test/Transforms/InstCombine/strspn-1.ll
  llvm/test/Transforms/InstCombine/strto-1.ll
  llvm/test/Transforms/InstSimplify/call.ll
  llvm/test/Transforms/LoopUnroll/WebAssembly/basic-unrolling.ll
  llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll
  llvm/unittests/Analysis/TargetLibraryInfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129915.448697.patch
Type: text/x-patch
Size: 210306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220729/68b5c4a3/attachment-0001.bin>


More information about the llvm-commits mailing list