History log of /llvm-project/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll (Results 1 – 25 of 26)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: 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
# 19536292 09-Aug-2024 Nikita Popov <npopov@redhat.com>

[MemoryBuiltins] Handle allocator attributes on call-site

We should handle allocator attributes not only on function
declarations, but also on the call-site. That way we can e.g.
also optimize cases

[MemoryBuiltins] Handle allocator attributes on call-site

We should handle allocator attributes not only on function
declarations, but also on the call-site. That way we can e.g.
also optimize cases where the allocator function is a virtual
function call.

This was already supported in some of the MemoryBuiltins helpers,
but not all of them. This adds support for allocsize, alloc-family
and allockind("free").

show more ...


# 0795ab4e 09-Aug-2024 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove unnecessary RUN line from test (NFC)

As all the necessary information is encoded using attributes
nowadays, this test doesn't actually depend on the triple
anymore.


Revision tags: 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
# e8dfafff 09-Dec-2022 Nikita Popov <npopov@redhat.com>

[MemoryBuiltins] Remove some hardcoded builtins

For all of these we already infer the new memory attributes, so
they don't need to be explicitly listed.


Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4
# fcfc31ff 28-Oct-2022 Nikita Popov <npopov@redhat.com>

[InstCombine] Convert some tests to opaque pointers (NFC)

Conversion was performed (without manual fixup) using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34


Revision tags: llvmorg-15.0.3, working, llvmorg-15.0.2
# 6e504d63 04-Oct-2022 Nikita Popov <npopov@redhat.com>

[ValueTracking] Handle constant exprs in isKnownNonZero()

Handle constant expressions by falling through to the general
operator-based code. In particular, this adds support for bitcast
and GEP expr

[ValueTracking] Handle constant exprs in isKnownNonZero()

Handle constant expressions by falling through to the general
operator-based code. In particular, this adds support for bitcast
and GEP expressions.

show more ...


Revision tags: 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
# 0dcfe7aa 18-Jul-2022 Martin Sebor <msebor@redhat.com>

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

Replace a switch statement used to validate arguments to known library
functions with a more consistent table-driven appro

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

Replace a switch statement used to validate arguments to known library
functions with a more consistent table-driven approach and tighten it
up.

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
# 12c0bf8b 18-Mar-2022 Augie Fackler <augie@google.com>

tests: add attributes that would normally come from inferattrs

As my goal is to remove at least _some_ functions from the static list
in MemoryBuiltins.cpp, these tests either need to run inferattrs

tests: add attributes that would normally come from inferattrs

As my goal is to remove at least _some_ functions from the static list
in MemoryBuiltins.cpp, these tests either need to run inferattrs or
statically declare these attributes to keep passing. A couple of tests
had alternate cases which are no longer meaningful, e.g.
`malloc-load-removal.ll`.

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

show more ...


# 8d58c8e5 21-Jul-2022 Nikita Popov <npopov@redhat.com>

Reapply [InstCombine] Don't check for alloc fn before fetching alloc size

Reapply the patch with getObjectSize() replaced by getAllocSize().
The former will also look through calls that return their

Reapply [InstCombine] Don't check for alloc fn before fetching alloc size

Reapply the patch with getObjectSize() replaced by getAllocSize().
The former will also look through calls that return their argument,
and we'll end up placing dereferenceable attributes on intrinsics
like llvm.launder.invariant.group. While this isn't wrong, it also
doesn't seem to be particularly useful. For now, use getAllocSize()
instead, which sticks closer to the original behavior of this code.

-----

This code is just interested in the allocsize, not any other
allocator properties.

show more ...


# 70056d04 21-Jul-2022 Nikita Popov <npopov@redhat.com>

Revert "[InstCombine] Don't check for alloc fn before fetching object size"

This reverts commit c72c22c04df992c95c5912d0075e5263c88f9fec.

This affected an Analysis test that I missed. Reverting for

Revert "[InstCombine] Don't check for alloc fn before fetching object size"

This reverts commit c72c22c04df992c95c5912d0075e5263c88f9fec.

This affected an Analysis test that I missed. Reverting for now.

show more ...


# c72c22c0 21-Jul-2022 Nikita Popov <npopov@redhat.com>

[InstCombine] Don't check for alloc fn before fetching object size

This code is just interested in the allocsize, not any other
allocator properties.


Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1
# acdc419c 04-Feb-2022 Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>

[test] Use -passes=instcombine instead of -instcombine in lots of tests. NFC

Another step moving away from the deprecated syntax of specifying
pass pipeline in opt.

Differential Revision: https://r

[test] Use -passes=instcombine instead of -instcombine in lots of tests. NFC

Another step moving away from the deprecated syntax of specifying
pass pipeline in opt.

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

show more ...


Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3
# da61cb01 18-Jan-2022 Nikita Popov <npopov@redhat.com>

[Attributes] Make attribute addition behavior consistent

Currently, the behavior when adding an attribute with the same key
as an existing attribute is inconsistent, depending on the type of
the att

[Attributes] Make attribute addition behavior consistent

Currently, the behavior when adding an attribute with the same key
as an existing attribute is inconsistent, depending on the type of
the attribute and the method used to add it. When going through
AttrBuilder::addAttribute(), the new attribute always overwrites
the old one. When going through AttrBuilder::merge() the new
attribute overwrites the existing one if it is a string attribute,
but keeps the existing one for int and type attributes. One
particular API also asserts that you can't overwrite an align
attribute, but does not handle any of the other int, type or string
attributes.

This patch makes the behavior consistent by always overwriting with
the new attribute, which is the behavior I would intuitively expect.
Two tests are affected, which now make a different (but equally
valid) choice. Those tests could be improved by taking the maximum
deref bytes, but I haven't bothered with that, since this is testing
a degenerate case -- the important bit is that it doesn't crash.

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

show more ...


Revision tags: llvmorg-13.0.1-rc2
# 7febd60a 10-Jan-2022 Bryce Wilson <bryce@brycemw.ca>

[instcombine] Add align return attributes for operator new(..., align_val)

(Split from original patch to separate non-NFC part and add coverage. I typoed when adding the new test, so this change in

[instcombine] Add align return attributes for operator new(..., align_val)

(Split from original patch to separate non-NFC part and add coverage. I typoed when adding the new test, so this change includes the typo fix to let libfunc recongize the signature. Didn't figure it was worth another separate commit.)

Differential Revision: https://reviews.llvm.org/D116851 (part 2 of 2)

show more ...


# 332642e6 10-Jan-2022 Philip Reames <listmail@philipreames.com>

Add test coverage for D116851


# f4c54683 10-Jan-2022 Philip Reames <listmail@philipreames.com>

[instcombine] Infer alignment for aligned_alloc with potentially zero size

This change removes a previous restriction where we had to prove the allocation performed by aligned_alloc was non-zero in

[instcombine] Infer alignment for aligned_alloc with potentially zero size

This change removes a previous restriction where we had to prove the allocation performed by aligned_alloc was non-zero in size before using the align parameter to annotate the result. I believe this was conservatism around the C11 specification of this routine which allowed UB when size was not a multiple of alignment, but if so, it was a partial one at best. (ex: align 32, size 16 was equally UB, but not restricted) The spec has since been clarified to require nullptr return, not UB.

A nullptr - the documented return for this function on failure for all cases after UB mentioned above was removed - is trivially aligned for any power of two. This isn't totally new behavior even for this transform, we'd previously annotate potentially failing allocs (e.g. huge sizes) meaning we were putting align on potentially null pointers anyways. This change simpy does the same for all failure modes.

show more ...


# dcbc91f4 07-Jan-2022 Philip Reames <listmail@philipreames.com>

[instcombine] Delete duplicate object size logic

nstCombine appears to duplicate the allocation size logic used inside getObjectSize when figuring out which attributes are safe to place on the calls

[instcombine] Delete duplicate object size logic

nstCombine appears to duplicate the allocation size logic used inside getObjectSize when figuring out which attributes are safe to place on the callsite. We can use the existing utility function instead.

The test change is correct. With aligned_alloc, a zero alignment is required to return nullptr. As such, deref_or_null is a correct attribute to use.

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

show more ...


Revision tags: llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1
# 5f77e770 23-Apr-2021 Dávid Bolvanský <david.bolvansky@gmail.com>

[InstCombine] Fixed crash when setting align attr for memalign


# 319c9f6e 20-Apr-2021 Dávid Bolvanský <david.bolvansky@gmail.com>

[MemoryBuiltins] Added support for memalign

memalign is older aligned_alloc.


# 324d641b 20-Apr-2021 Dávid Bolvanský <david.bolvansky@gmail.com>

[InstCombine] Enhance deduction of alignment for aligned_alloc

This patch improves https://reviews.llvm.org/D76971 (Deduce attributes for aligned_alloc in InstCombine) and implements "TODO" item men

[InstCombine] Enhance deduction of alignment for aligned_alloc

This patch improves https://reviews.llvm.org/D76971 (Deduce attributes for aligned_alloc in InstCombine) and implements "TODO" item mentioned in the review of that patch.

> The function aligned_alloc() is the same as memalign(), except for the added restriction that size should be a multiple of alignment.

Currently, we simply bail out if we see a non-constant size - change that.

Reviewed By: jdoerfert

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

show more ...


Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2
# 8233439f 09-Jun-2020 Simon Pilgrim <llvm-dev@redking.me.uk>

[InstCombine] Ensure allocation alignment mask is within range before applying as an attribute

Fixes OSS-Fuzz #23214
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23214


Revision tags: llvmorg-10.0.1-rc1
# dc817b2d 28-Mar-2020 Uday Bondhugula <uday@polymagelabs.com>

[InstCombine] Deduce attributes for aligned_alloc in InstCombine

Make InstCombine aware of the aligned_alloc library function.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>

Depends on D76

[InstCombine] Deduce attributes for aligned_alloc in InstCombine

Make InstCombine aware of the aligned_alloc library function.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>

Depends on D76970.

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

show more ...


Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6
# be2487a2 17-Sep-2019 David Bolvansky <david.bolvansky@gmail.com>

[InstCombine] Annotate strdup with deref_or_null

llvm-svn: 372098


Revision tags: llvmorg-9.0.0-rc5
# 4dae283c 11-Sep-2019 David Bolvansky <david.bolvansky@gmail.com>

[InstCombine] Fixed handling of isOpNewLike (PR11748)

llvm-svn: 371602


Revision tags: llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3
# 42032726 28-Aug-2019 David Bolvansky <david.bolvansky@gmail.com>

[NFC] Added more tests for D66651

llvm-svn: 370222


# 05bda8b4 28-Aug-2019 David Bolvansky <david.bolvansky@gmail.com>

Annotate return values of allocation functions with dereferenceable_or_null

Summary:
Example
define dso_local noalias i8* @_Z6maixxnv() local_unnamed_addr #0 {
entry:
%call = tail call noalias der

Annotate return values of allocation functions with dereferenceable_or_null

Summary:
Example
define dso_local noalias i8* @_Z6maixxnv() local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(64) i8* @malloc(i64 64) #6
ret i8* %call
}


Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: aaron.ballman, llvm-commits

Tags: #llvm

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

llvm-svn: 370168

show more ...


12