History log of /llvm-project/llvm/lib/Analysis/BasicAliasAnalysis.cpp (Results 26 – 50 of 785)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-18.1.0-rc1, llvmorg-19-init
# 5f57ad85 17-Jan-2024 Nikita Popov <npopov@redhat.com>

[BasicAA] Remove incorrect rule about constant pointers (#76815)

BasicAA currently says that any Constant cannot alias an identified
local object. This is not correct if the local object escaped, a

[BasicAA] Remove incorrect rule about constant pointers (#76815)

BasicAA currently says that any Constant cannot alias an identified
local object. This is not correct if the local object escaped, as it's
possible to create a pointer to the escaped object using an inttoptr
constant expression base.

To compensate for this, make sure that inttoptr constant expressions are
treated as escape sources, just like inttoptr instructions. This ensures
that the optimization can still be applied if the local object is
non-escaping. This is sufficient to still optimize the original
motivating case from c53e2ecf0296a55d3c33c19fb70a3aa7f81f2732.

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

show more ...


# d69efa40 16-Jan-2024 David Green <david.green@arm.com>

[BasicAA] Handle disjoint or as add in DecomposeGEP. (#78209)

This removes the MaskedValueIsZero check in decomposing geps in BasicAA, using
the isDisjoint flags instead. This relies on the disjoin

[BasicAA] Handle disjoint or as add in DecomposeGEP. (#78209)

This removes the MaskedValueIsZero check in decomposing geps in BasicAA, using
the isDisjoint flags instead. This relies on the disjoint flags being present
when AA is ran. The alternative would be to keep the old MaskedValueIsZero check
too if this causes issues.

show more ...


# 852596d8 04-Jan-2024 David Goldblatt <davidgoldblatt@fb.com>

[BasicAA] Guess reasonable contexts for separate storage hints (#76770)

The definition of the pointer of the memory location being queried is
always one such context. Even this conservative guess c

[BasicAA] Guess reasonable contexts for separate storage hints (#76770)

The definition of the pointer of the memory location being queried is
always one such context. Even this conservative guess can be better than
no guess at all in some cases.

Fixes #64666

Co-authored-by: David Goldblatt <davidgoldblatt@meta.com>

show more ...


# 7954c571 04-Jan-2024 Jannik Silvanus <37809848+jasilvanus@users.noreply.github.com>

[IR] Fix GEP offset computations for vector GEPs (#75448)

Vectors are always bit-packed and don't respect the elements' alignment
requirements. This is different from arrays. This means offsets of

[IR] Fix GEP offset computations for vector GEPs (#75448)

Vectors are always bit-packed and don't respect the elements' alignment
requirements. This is different from arrays. This means offsets of
vector GEPs need to be computed differently than offsets of array GEPs.

This PR fixes many places that rely on an incorrect pattern
that always relies on `DL.getTypeAllocSize(GTI.getIndexedType())`.
We replace these by usages of `GTI.getSequentialElementStride(DL)`,
which is a new helper function added in this PR.

This changes behavior for GEPs into vectors with element types for which
the (bit) size and alloc size is different. This includes two cases:

* Types with a bit size that is not a multiple of a byte, e.g. i1.
GEPs into such vectors are questionable to begin with, as some elements
are not even addressable.
* Overaligned types, e.g. i16 with 32-bit alignment.

Existing tests are unaffected, but a miscompilation of a new test is fixed.

---------

Co-authored-by: Nikita Popov <github@npopov.com>

show more ...


# 92e211ab 03-Jan-2024 David Goldblatt <davidgoldblatt@fb.com>

[BasicAA] Enable separate storage hints by default (#76864)

As requested in
https://github.com/llvm/llvm-project/pull/76770#pullrequestreview-1801649466

A few months of experimentation in a larg

[BasicAA] Enable separate storage hints by default (#76864)

As requested in
https://github.com/llvm/llvm-project/pull/76770#pullrequestreview-1801649466

A few months of experimentation in a large codebase did not reveal any
significant build speed regressions, and b07bf16 speeds up hint lookup
even further.

Co-authored-by: David Goldblatt <davidgoldblatt@meta.com>

show more ...


# b07bf16a 03-Jan-2024 Nikita Popov <npopov@redhat.com>

[AssumptionCache] Add affected values for separate_storage (#76806)

Add the underlying object of both separate_storage arguments as affected
values. This allows us to use assumptionsFor() in BasicA

[AssumptionCache] Add affected values for separate_storage (#76806)

Add the underlying object of both separate_storage arguments as affected
values. This allows us to use assumptionsFor() in BasicAA, which will be
more efficient if there are many assumes in the function.

show more ...


# d9e8ae7d 29-Nov-2023 Nikita Popov <npopov@redhat.com>

[ValueTracking] Convert MaskedValueIsZero() to use SimplifyQuery (NFC)


Revision tags: llvmorg-17.0.6
# 81b7f115 22-Nov-2023 Sander de Smalen <sander.desmalen@arm.com>

[llvm][TypeSize] Fix addition/subtraction in TypeSize. (#72979)

It seems TypeSize is currently broken in the sense that:

TypeSize::Fixed(4) + TypeSize::Scalable(4) => TypeSize::Fixed(8)

with

[llvm][TypeSize] Fix addition/subtraction in TypeSize. (#72979)

It seems TypeSize is currently broken in the sense that:

TypeSize::Fixed(4) + TypeSize::Scalable(4) => TypeSize::Fixed(8)

without failing its assert that explicitly tests for this case:

assert(LHS.Scalable == RHS.Scalable && ...);

The reason this fails is that `Scalable` is a static method of class
TypeSize,
and LHS and RHS are both objects of class TypeSize. So this is
evaluating
if the pointer to the function Scalable == the pointer to the function
Scalable,
which is always true because LHS and RHS have the same class.

This patch fixes the issue by renaming `TypeSize::Scalable` ->
`TypeSize::getScalable`, as well as `TypeSize::Fixed` to
`TypeSize::getFixed`,
so that it no longer clashes with the variable in
FixedOrScalableQuantity.

The new methods now also better match the coding standard, which
specifies that:
* Variable names should be nouns (as they represent state)
* Function names should be verb phrases (as they represent actions)

show more ...


# a3908d33 21-Nov-2023 Nikita Popov <npopov@redhat.com>

[BasicAA] Optimize index size adjustment (NFC)

In most cases we do not actually have to perform an index size
adjustment. Don't perform any APInt operations in that case.


# 2d39cb49 21-Nov-2023 Florian Hahn <flo@fhahn.com>

[BasicAA] Don't use MinAbsVarIndex = 1. (#72993)

The current code incorrectly assumed that the absolute variable index
needs to be at least 1, if the variable is != 0. This is incorrect, in
case m

[BasicAA] Don't use MinAbsVarIndex = 1. (#72993)

The current code incorrectly assumed that the absolute variable index
needs to be at least 1, if the variable is != 0. This is incorrect, in
case multiplying with Scale wraps.

The code below already checks for wrapping properly, so just remove the
incorrect assignment.

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

show more ...


# 7f740be4 21-Nov-2023 Nikita Popov <npopov@redhat.com>

[BasicAA] Don't assume DT is nonnull

I thought DT is required in BasicAA, but apparently it can be null
in unit tests at least. This should fix the ubsan bot failures.


# 9a09c737 21-Nov-2023 Nikita Popov <npopov@redhat.com>

[BasicAA] Make isNotCapturedBeforeOrAt() check for calls more precise (#69931)

For calls, we are only interested in captures before the call, not
captures by the call itself -- arguments that get p

[BasicAA] Make isNotCapturedBeforeOrAt() check for calls more precise (#69931)

For calls, we are only interested in captures before the call, not
captures by the call itself -- arguments that get passed to the call are
checked explicitly.

In particular, the current implementation is not optimal if the pointer
is captured via a readonly argument -- in that case, we know that even
if the argument is captured, the call will not modify the argument (at
least not via that argument).

Make this more precise by renaming to isCapturedBefore() and adding an
OrAt argument that allows us to toggle whether to consider captures in
the instruction itself or not.

show more ...


Revision tags: llvmorg-17.0.5
# fd95f398 02-Nov-2023 Florian Hahn <flo@fhahn.com>

Revert "[CaptureTracking] Ignore ephemeral values when determining po… (#71066)

Unfortunately the commit (D123162) introduced a mis-compile
(https://github.com/llvm/llvm-project/issues/70547), whic

Revert "[CaptureTracking] Ignore ephemeral values when determining po… (#71066)

Unfortunately the commit (D123162) introduced a mis-compile
(https://github.com/llvm/llvm-project/issues/70547), which wasn't fixed
by the alternative fix (c0de28b92e98acbeb73)

I think as long as the call considered as ephemeral is not removed, we
need to be conservative. To address the correctness issue quickly, I
think we should revert the patch (as this patch does, it doens't revert
cleanly)

This reverts commit 17fdaccccfad9b143e4aadbcdda7f645de127153.

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

show more ...


Revision tags: llvmorg-17.0.4
# 8e247b8f 27-Oct-2023 Fangrui Song <i@maskray.me>

Replace TypeSize::{getFixed,getScalable} with canonical TypeSize::{Fixed,Scalable}. NFC


# 211dc4ad 24-Oct-2023 Harvin Iriawan <25712785+harviniriawan@users.noreply.github.com>

[Analysis] Add Scalable field in MemoryLocation.h (#69716)

This is the first of a series of patch to improve Alias Analysis on
Scalable quantities.
Keep Scalable information from TypeSize whic

[Analysis] Add Scalable field in MemoryLocation.h (#69716)

This is the first of a series of patch to improve Alias Analysis on
Scalable quantities.
Keep Scalable information from TypeSize which
will be used in Alias Analysis.

show more ...


# 1a87bdd7 24-Oct-2023 Nikita Popov <npopov@redhat.com>

[BasicAA] Update comment (NFC)


# a3fb2348 23-Oct-2023 Nikita Popov <npopov@redhat.com>

[BasicAA] Return std::optional from getObjectSize() (NFC)

Prefer this over UnknownSize, especially once the return value
switches to something other than uint64_t.


# 3bfd1f09 20-Oct-2023 Nikita Popov <npopov@redhat.com>

[AA] Make LI and EphValues option in EarliestEscapeInfo (NFC)

To allow using it in places where these may not be available.


Revision tags: llvmorg-17.0.3
# ea4cc200 15-Oct-2023 Yingwei Zheng <dtcxzyw2333@gmail.com>

[BasicAA] Remove NSW flags when merging scales (#69122)

When merging scales of `LinearExpression` that have common index
variables, we cannot guarantee the NSW flag still applies to the merged
exp

[BasicAA] Remove NSW flags when merging scales (#69122)

When merging scales of `LinearExpression` that have common index
variables, we cannot guarantee the NSW flag still applies to the merged
expression.

Fixes #69096.

show more ...


Revision tags: 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
# d020fa2b 24-Apr-2023 David Goldblatt <davidgoldblatt@fb.com>

[AA] Skip the layer of indirection in returning conservative results.

Historically, AA implementations chained to a following implementation
to answer recursive queries. This is no longer the case,

[AA] Skip the layer of indirection in returning conservative results.

Historically, AA implementations chained to a following implementation
to answer recursive queries. This is no longer the case, but the legacy
lives on in a confusing phrasing of the return-a-conservative-value
paths. Let's just return "don't know" directly, where appropriate; the
current two-step way is confusing.

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

show more ...


# c31eb827 19-Jun-2023 Nikita Popov <npopov@redhat.com>

[BasicAA] Fix nsw handling for negated scales (PR63266)

We currently preserve the nsw flag when negating scales, which is
incorrect for INT_MIN.

However, just dropping the NSW flag in this case mak

[BasicAA] Fix nsw handling for negated scales (PR63266)

We currently preserve the nsw flag when negating scales, which is
incorrect for INT_MIN.

However, just dropping the NSW flag in this case makes BasicAA
behavior unreliable and asymmetric, because we may or may not
drop the NSW flag depending on which side gets subtracted.

Instead, leave the Scale alone and add an additional IsNegated flag,
which indicates that the whole VarIndex should be interpreted as a
subtraction. This allows us to retain the NSW flag.

When accumulating the offset range, we need to use subtraction
instead of adding for IsNegated indices. Everything else works on
the absolute value of the scale, so the negation does not matter
there.

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

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

show more ...


# c0de28b9 22-Jun-2023 Nikita Popov <npopov@redhat.com>

[BasicAA] Don't short-circuit non-capturing arguments

This is an alternative to D153464. BasicAA currently assumes that
an unescaped alloca cannot be read through non-nocapture arguments
of a call,

[BasicAA] Don't short-circuit non-capturing arguments

This is an alternative to D153464. BasicAA currently assumes that
an unescaped alloca cannot be read through non-nocapture arguments
of a call, based on the argument that if the argument were based on
the alloca, it would not be unescaped.

This currently fails in the case where the call is an ephemeral value
and as such does not count as a capture. It also happens for calls
that are readonly+nounwind+void, though that case tends to not matter
in practice, because such calls will get DCEd anyway.

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

show more ...


# f9b523eb 31-May-2023 Kazu Hirata <kazu@google.com>

[Analysis] Remove unused class LegacyAARGetter

The last use was removed by:

commit fa6ea7a419f37befbed04368bcb8af4c718facbb
Author: Arthur Eubanks <aeubanks@google.com>
Date: Mon Mar 20 11:

[Analysis] Remove unused class LegacyAARGetter

The last use was removed by:

commit fa6ea7a419f37befbed04368bcb8af4c718facbb
Author: Arthur Eubanks <aeubanks@google.com>
Date: Mon Mar 20 11:18:35 2023 -0700

Once we remove it, createLegacyPMAAResults and createLegacyPMAAResults
become unused, so this patch removes them as well.

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

show more ...


Revision tags: llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4
# 4d59ffb0 03-Mar-2023 David Goldblatt <davidgoldblatt@fb.com>

[InstCombine] Simplify separate_storage assumptions

Before this change, we call getUnderlyingObject on each separate_storage
operand on every alias() call (potentially requiring lots of pointer
chas

[InstCombine] Simplify separate_storage assumptions

Before this change, we call getUnderlyingObject on each separate_storage
operand on every alias() call (potentially requiring lots of pointer
chasing). Instead, we rewrite the assumptions in instcombine to do this
pointer-chasing once.

We still leave the getUnderlyingObject calls in alias(), just expecting
them to be no-ops much of the time. This is relatively fast (just a
couple dyn_casts with no pointer chasing) and avoids making alias
analysis results depend on whether or not instcombine has been run.

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

show more ...


Revision tags: llvmorg-16.0.0-rc3
# f8f3db27 20-Feb-2023 Kazu Hirata <kazu@google.com>

Use APInt::count{l,r}_{zero,one} (NFC)


12345678910>>...32