History log of /llvm-project-15.0.7/llvm/lib/Transforms/Utils/BuildLibCalls.cpp (Results 1 – 25 of 186)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init
# bd6aa67e 20-Jul-2022 Augie Fackler <[email protected]>

BuildLibCalls: move inference of freeing memory later

This probably should have been part of D123089, but the effects of it
don't show up until we start removing functions from the table in
D130107.

BuildLibCalls: move inference of freeing memory later

This probably should have been part of D123089, but the effects of it
don't show up until we start removing functions from the table in
D130107. Oops.

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

show more ...


# 0d68ff87 01-Jul-2022 Martin Sebor <[email protected]>

[InstCombine] Transform strrchr to memrchr for constant strings

Add an emitter for the memrchr common extension and simplify the strrchr
call handler to use it. This enables transforming calls with

[InstCombine] Transform strrchr to memrchr for constant strings

Add an emitter for the memrchr common extension and simplify the strrchr
call handler to use it. This enables transforming calls with the empty
string to the test C ? S : 0.

Reviewed By: nikic

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

show more ...


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1
# 73f66460 29-Mar-2022 Augie Fackler <[email protected]>

BuildLibCalls: infer allockind attributes on relevant functions

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


# c167c0a4 10-May-2022 Nick Desaulniers <[email protected]>

[BuildLibCalls] infer inreg param attrs from NumRegisterParameters

We're having a hard time booting the ARCH=i386 Linux kernel with clang
after removing -ffreestanding because instcombine was droppi

[BuildLibCalls] infer inreg param attrs from NumRegisterParameters

We're having a hard time booting the ARCH=i386 Linux kernel with clang
after removing -ffreestanding because instcombine was dropping inreg
from callers during libcall simplification, but not the callees defined
in different translation units. This led the callers and callees to have
wildly different calling conventions, which (predictably) blew up at
runtime.

Infer the inreg param attrs on function declarations from the module
metadata "NumRegisterParameters." This allows us to boot the ARCH=i386
Linux kernel (w/ -ffreestanding removed).

Fixes: https://github.com/llvm/llvm-project/issues/53645

Reviewed By: efriedma

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

show more ...


# 1deea714 03-May-2022 Augie Fackler <[email protected]>

BuildLibCalls: simplify switch statement slightly

Per feedback on D123086 after submit.

Also added a test for vec_malloc et al attribute inference to show it's
doing the right thing.

The new tests

BuildLibCalls: simplify switch statement slightly

Per feedback on D123086 after submit.

Also added a test for vec_malloc et al attribute inference to show it's
doing the right thing.

The new tests exposed a defect, corrected by adding vec_free to the list of
free functions in MemoryBuiltins.cpp, which had been overlooked all the
way back in D94710, over a year ago.

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

show more ...


# 304378fd 20-Apr-2022 Jonas Paulsson <[email protected]>

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 def

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

show more ...


# c7ae423e 17-Mar-2022 Augie Fackler <[email protected]>

BuildLibCalls: add alloc-family attribute to many allocator functions

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


# e9404565 16-Mar-2022 Augie Fackler <[email protected]>

BuildLibCalls: infer allocptr attribute for free and realloc() family functions

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


# 14d93907 20-Apr-2022 Fangrui Song <[email protected]>

Revert D123198 "[BuildLibCalls] Introduce getOrInsertLibFunc() for use when building libcalls."

test/Transforms/InstCombine/pr39177.ll failed in a -DLLVM_USE_SANITIZER=Undefined build.
```
lib/Trans

Revert D123198 "[BuildLibCalls] Introduce getOrInsertLibFunc() for use when building libcalls."

test/Transforms/InstCombine/pr39177.ll failed in a -DLLVM_USE_SANITIZER=Undefined build.
```
lib/Transforms/Utils/BuildLibCalls.cpp:1217:17: runtime error: reference binding to null pointer of type 'llvm::Function'
```
`Function &F = *M->getFunction(Name);`

This reverts commit 0f8c626723d2bbd547e78dcab5ab260dfbc437e1.

show more ...


# 0f8c6267 14-Apr-2022 Jonas Paulsson <[email protected]>

[BuildLibCalls] Introduce getOrInsertLibFunc() for use when building libcalls.

A new set of overloaded functions named getOrInsertLibFunc() are now supposed
to be used instead of getOrInsertFunction

[BuildLibCalls] Introduce getOrInsertLibFunc() for use when building libcalls.

A new set of overloaded functions named getOrInsertLibFunc() are now supposed
to be used instead of getOrInsertFunction() when building a libcall from
within an LLVM optimizer(). The idea is that this new function also makes
sure that any mandatory argument attributes are added to the function
prototype (after calling getOrInsertFunction()).

inferLibFuncAttributes() is renamed to inferNonMandatoryLibFuncAttrs() as it
only adds attributes that are not necessary for correctness but merely
helping with later optimizations.

Generally, the front end is responsible for building a correct function
prototype with the needed argument attributes. If the middle end however is
the one creating the call, e.g. when replacing one libcall with another, it
then must take this responsibility.

This continues the work of properly handling argument extension if required
by the target ABI when building a lib call. getOrInsertLibFunc() now does
this for all libcalls currently built by any LLVM optimizer. It is expected
that when in the future a new optimization builds a new libcall with an
integer argument it is to be added to getOrInsertLibFunc() with the proper
handling. Note that not all targets have it in their ABI to sign/zero extend
integer arguments to the full register width, but this will be done
selectively as determined by getExtAttrForI32Param().

Review: Eli Friedman, Nikita Popov, Dávid Bolvanský

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

show more ...


Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2
# b9164140 10-Feb-2022 Augie Fackler <[email protected]>

BuildLibCalls: also set allocsize() attributes

This is part of being able to get rid of two more columns in
MemoryBuiltins.cpp's large table. We'll have two more changes before
we can finish the job

BuildLibCalls: also set allocsize() attributes

This is part of being able to get rid of two more columns in
MemoryBuiltins.cpp's large table. We'll have two more changes before
we can finish the job.

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

show more ...


# dbb6a75f 05-Apr-2022 Jonas Paulsson <[email protected]>

[LibCalls] Respect TLI.getExtAttrForI32Param() in inferLibFuncAttributes().

getExtAttrForI32Param() is the method to be used for determining the type of
extension attribute (if any) that is to be ad

[LibCalls] Respect TLI.getExtAttrForI32Param() in inferLibFuncAttributes().

getExtAttrForI32Param() is the method to be used for determining the type of
extension attribute (if any) that is to be added for a signed/unsigned
argument.

Previously, the SExt attribute was always added to the i32 ldexp* argument as
it was expected to be ignored by targets not needing it. This patch now
changes this so that it is only added for the targets that need it in the
first place.

Putchar() argument is now also extended as required by the target (SystemZ in
the test), to fix the issue below. Many more libcalls will be handled
similarly in a following patch.

Fixes https://github.com/llvm/llvm-project/issues/54532.

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

Review: Eli Friedman

show more ...


Revision tags: llvmorg-14.0.0-rc1, llvmorg-15-init
# b32735d5 21-Jan-2022 Augie Fackler <[email protected]>

BuildLibCalls: add allocalign attributes for memalign and aligned_alloc

This gets us close to being able to remove a column from the table in
MemoryBuiltins.cpp.

Differential Revision: https://revi

BuildLibCalls: add allocalign attributes for memalign and aligned_alloc

This gets us close to being able to remove a column from the table in
MemoryBuiltins.cpp.

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

show more ...


# a494ae43 01-Mar-2022 serge-sans-paille <[email protected]>

Cleanup includes: TransformsUtils

Estimation on the impact on preprocessor output:
before: 1065307662
after: 1064800684

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-

Cleanup includes: TransformsUtils

Estimation on the impact on preprocessor output:
before: 1065307662
after: 1064800684

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120741

show more ...


Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3
# 5ba73c92 19-Jan-2022 Nikita Popov <[email protected]>

[BuildLibCalls] Mark calloc as inaccessiblememonly

Now that DSE handles inaccessiblememonly calloc, mark it as such,
as we do with other memory allocation functions.


Revision tags: llvmorg-13.0.1-rc2
# e3275cfa 12-Jan-2022 Florian Hahn <[email protected]>

[BuildLibCalls] Add nounwind,willreturn to memset_pattern{4,8,16}.

Similar to memset, memset_pattern{4,8,16} all will return and do not
unwind. Use fallthrough to include all attributes also set for

[BuildLibCalls] Add nounwind,willreturn to memset_pattern{4,8,16}.

Similar to memset, memset_pattern{4,8,16} all will return and do not
unwind. Use fallthrough to include all attributes also set for memset.

Reviewed By: nikic

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

show more ...


# 348bc76e 07-Jan-2022 Nikita Popov <[email protected]>

[LibCalls] Infer same attrs for reallocf() as realloc()

reallocf() is the same as realloc() but frees the input pointer
on failure as well. We can infer the same attributes.

Also combine some cases

[LibCalls] Infer same attrs for reallocf() as realloc()

reallocf() is the same as realloc() but frees the input pointer
on failure as well. We can infer the same attributes.

Also combine some cases that infer the same attributes and are
logically related.

show more ...


# c16fd6a3 05-Jan-2022 Philip Reames <[email protected]>

Rename doesNotReadMemory to onlyWritesMemory globally [NFC]

The naming has come up as a source of confusion in several recent reviews. onlyWritesMemory is consist with onlyReadsMemory which we use

Rename doesNotReadMemory to onlyWritesMemory globally [NFC]

The naming has come up as a source of confusion in several recent reviews. onlyWritesMemory is consist with onlyReadsMemory which we use for the corresponding readonly case as well.

show more ...


# 5f0a3497 05-Jan-2022 Benjamin Kramer <[email protected]>

Revert "Revert "[InferAttrs] Add writeonly to all the math functions""

This reverts commit 29b6e967f3e99ac45340ea37a70262c70e4e7528. The bug it
found in PartiallyInlineLibCalls was fixed in
c8ffc733

Revert "Revert "[InferAttrs] Add writeonly to all the math functions""

This reverts commit 29b6e967f3e99ac45340ea37a70262c70e4e7528. The bug it
found in PartiallyInlineLibCalls was fixed in
c8ffc73350dbb6044ca947bbead127b9b914cdf3.

show more ...


# 29b6e967 05-Jan-2022 Martin Storsjö <[email protected]>

Revert "[InferAttrs] Add writeonly to all the math functions"

This reverts commit ea75be3d9df448b6abafaf752a8141764d93ca33 and
1eb5b6e85045d22720f177a02aaf7097930e4b4f.

That commit caused crashes w

Revert "[InferAttrs] Add writeonly to all the math functions"

This reverts commit ea75be3d9df448b6abafaf752a8141764d93ca33 and
1eb5b6e85045d22720f177a02aaf7097930e4b4f.

That commit caused crashes with compilation e.g. like this
(not fixed by the follow-up commit):

$ cat sqrt.c
float a;
b() { sqrt(a); }
$ clang -target x86_64-linux-gnu -c -O2 sqrt.c
Attributes 'readnone and writeonly' are incompatible!
%sqrtf = tail call float @sqrtf(float %0) #1
in function b
fatal error: error in backend: Broken function found, compilation aborted!

show more ...


# 1eb5b6e8 05-Jan-2022 Fangrui Song <[email protected]>

[InferAttrs] If readonly is already set, set readnone instead of writeonly

D116426 may lead to an assertion failure `Attributes 'readonly and writeonly' are incompatible!` if the builtin function al

[InferAttrs] If readonly is already set, set readnone instead of writeonly

D116426 may lead to an assertion failure `Attributes 'readonly and writeonly' are incompatible!` if the builtin function already has `readonly`.

show more ...


# ea75be3d 30-Dec-2021 Benjamin Kramer <[email protected]>

[InferAttrs] Add writeonly to all the math functions

All of these functions would be `readnone`, but can't be on platforms
where they can set `errno`. A `writeonly` function with no pointer
argument

[InferAttrs] Add writeonly to all the math functions

All of these functions would be `readnone`, but can't be on platforms
where they can set `errno`. A `writeonly` function with no pointer
arguments can only write (but never read) global state.

Writeonly theoretically allows these calls to be CSE'd (a writeonly call
with the same arguments will always result in the same global stores) or
hoisted out of loops, but that's not implemented currently.

There are a few functions in this list that could be `readnone` instead
of `writeonly`, if someone is interested.

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

show more ...


# 4683ce2c 30-Dec-2021 Benjamin Kramer <[email protected]>

[InferAttrs] Give strnlen the same attributes as strlen

This moves the only string function out of the big list of math funcs.
And let's us CSE strnlen calls.


# 2de5f39e 02-Dec-2021 Florian Hahn <[email protected]>

[BuildLibCalls] Add support for memset_pattern{4,8}.

Add support for memset_pattern{4,8} similar to the existing
memset_pattern16 handling.

Reviewed By: ab

Differential Revision: https://reviews.l

[BuildLibCalls] Add support for memset_pattern{4,8}.

Add support for memset_pattern{4,8} similar to the existing
memset_pattern16 handling.

Reviewed By: ab

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

show more ...


# 0496edad 02-Dec-2021 Florian Hahn <[email protected]>

[BuildLibCalls] Add additional attrs to memcpy_chk.

`memcpy_chk` can be treated like `memcpy`, with the exception that it
may not return (if it aborts the program).

See D114793 for a similar patch

[BuildLibCalls] Add additional attrs to memcpy_chk.

`memcpy_chk` can be treated like `memcpy`, with the exception that it
may not return (if it aborts the program).

See D114793 for a similar patch for `memset_chk`.

Reviewed By: xbolva00

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

show more ...


12345678