[all-commits] [llvm/llvm-project] 304378: Reapply "[BuildLibCalls] Introduce getOrInsertLibF...

Jonas Paulsson via All-commits all-commits at lists.llvm.org
Mon May 2 10:39:10 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 304378fd096755950939f2d3dbb4f724bba0d6cb
  Author: Jonas Paulsson <paulsson at linux.vnet.ibm.com>
  Date:   2022-05-02 (Mon, 02 May 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/TargetLibraryInfo.h
    M llvm/include/llvm/IR/Module.h
    M llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
    M llvm/include/llvm/Transforms/Utils/SimplifyLibCalls.h
    M llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
    M llvm/lib/Transforms/Utils/BuildLibCalls.cpp
    M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    M llvm/test/Transforms/InferFunctionAttrs/annotate.ll
    A llvm/test/Transforms/InstCombine/SystemZ/libcall-arg-exts.ll
    M llvm/test/Transforms/InstCombine/double-float-shrink-1.ll
    M llvm/test/Transforms/InstCombine/pr39177.ll
    M llvm/test/Transforms/InstCombine/simplify-libcalls.ll

  Log Message:
  Reapply "[BuildLibCalls] Introduce getOrInsertLibFunc() for use when building
libcalls." (was 0f8c626). This reverts commit 14d9390.

The patch previously failed to recognize cases where user had defined a
function alias with an identical name as that of the library
function. Module::getFunction() would then return nullptr which is what the
sanitizer discovered.

In this updated version a new function isLibFuncEmittable() has as well been
introduced which is now used instead of TLI->has() anytime a library function
is to be emitted . It additionally also makes sure there is e.g. no function
alias with the same name in the module.

Reviewed By: Eli Friedman

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

More information about the All-commits mailing list