#
29441e4f |
| 29-Jan-2025 |
Nikita Popov <npopov@redhat.com> |
[IR] Convert from nocapture to captures(none) (#123181)
This PR removes the old `nocapture` attribute, replacing it with the new
`captures` attribute introduced in #116990. This change is
intended
[IR] Convert from nocapture to captures(none) (#123181)
This PR removes the old `nocapture` attribute, replacing it with the new
`captures` attribute introduced in #116990. This change is
intended to be essentially NFC, replacing existing uses of `nocapture`
with `captures(none)` without adding any new analysis capabilities.
Making use of non-`none` values is left for a followup.
Some notes:
* `nocapture` will be upgraded to `captures(none)` by the bitcode
reader.
* `nocapture` will also be upgraded by the textual IR reader. This is to
make it easier to use old IR files and somewhat reduce the test churn in
this PR.
* Helper APIs like `doesNotCapture()` will check for `captures(none)`.
* MLIR import will convert `captures(none)` into an `llvm.nocapture`
attribute. The representation in the LLVM IR dialect should be updated
separately.
show more ...
|
Revision tags: llvmorg-21-init |
|
#
4233a15c |
| 18-Jan-2025 |
Florian Hahn <flo@fhahn.com> |
[FunctionAttrs] Handle zero writes in initializes inference.
ConstantRange's constructor asserts that the range not empty, except if lower/upper are min or max values.
Check if the length is strict
[FunctionAttrs] Handle zero writes in initializes inference.
ConstantRange's constructor asserts that the range not empty, except if lower/upper are min or max values.
Check if the length is strictly positive instead of just non-negative so std::nullopt is returned when the size is 0. If that's the case, the access doesn't initialize anything.
This should fix a crash when building on macOS with ASan & UBsan after https://github.com/llvm/llvm-project/pull/97373 / https://github.com/llvm/llvm-project/pull/117104 landed: https://green.lab.llvm.org/job/llvm.org/job/clang-stage2-cmake-RgSan/664/console
show more ...
|
#
1a56360c |
| 15-Jan-2025 |
Alex MacLean <amaclean@nvidia.com> |
[IR] Treat calls with byval ptrs as read-only (#122961)
|
#
b6eb6a87 |
| 14-Jan-2025 |
Nikita Popov <npopov@redhat.com> |
[FunctionAttrs] Use doesNotCapture()
To be conservative, explicitly exclude byval arguments, which doesNotCapture() would otherwise allow. Even if byval has an initializes attribute, it would only a
[FunctionAttrs] Use doesNotCapture()
To be conservative, explicitly exclude byval arguments, which doesNotCapture() would otherwise allow. Even if byval has an initializes attribute, it would only apply to the implicit copy.
show more ...
|
Revision tags: llvmorg-19.1.7 |
|
#
c6c864da |
| 13-Jan-2025 |
Alex MacLean <amaclean@nvidia.com> |
[FunctionAttrs] Treat byval calls as only reading ptrs (#122618)
Since byval arguments are passed via a hidden copy of the pointee, they do not have the same semantics as normal pointer arguments. T
[FunctionAttrs] Treat byval calls as only reading ptrs (#122618)
Since byval arguments are passed via a hidden copy of the pointee, they do not have the same semantics as normal pointer arguments. The callee cannot capture or write to the pointer and the copy is a read of the pointer.
show more ...
|
#
8daba2c1 |
| 23-Dec-2024 |
Haopeng Liu <153236845+haopliu@users.noreply.github.com> |
Skip negative length while inferring initializes attr (#120874)
Bail out negative length while inferring initializes attr. Otherwise it
causes an assertion error:
`Attribute 'initializes' does not
Skip negative length while inferring initializes attr (#120874)
Bail out negative length while inferring initializes attr. Otherwise it
causes an assertion error:
`Attribute 'initializes' does not support unordered ranges`
show more ...
|
Revision tags: llvmorg-19.1.6, llvmorg-19.1.5 |
|
#
4d6e6914 |
| 21-Nov-2024 |
Haopeng Liu <153236845+haopliu@users.noreply.github.com> |
Add the initializes attribute inference (#117104)
reland https://github.com/llvm/llvm-project/pull/97373 after fixing
clang tests.
Confirmed with "ninja check-llvm" and "ninja check-clang"
|
#
f77126c5 |
| 19-Nov-2024 |
Mikhail Goncharov <goncharov.mikhail@gmail.com> |
Revert "[FunctionAttrs] Add the "initializes" attribute inference (#97373)"
This reverts commit 661c593850715881d2805a59e90e6d87d8b9fbb8.
Multiple buildbot failures, e.g. https://lab.llvm.org/build
Revert "[FunctionAttrs] Add the "initializes" attribute inference (#97373)"
This reverts commit 661c593850715881d2805a59e90e6d87d8b9fbb8.
Multiple buildbot failures, e.g. https://lab.llvm.org/buildbot/#/builders/108/builds/6096
show more ...
|
Revision tags: llvmorg-19.1.4 |
|
#
661c5938 |
| 19-Nov-2024 |
Haopeng Liu <153236845+haopliu@users.noreply.github.com> |
[FunctionAttrs] Add the "initializes" attribute inference (#97373)
Add the "initializes" attribute inference.
This change is expected to have ~0.09% compile time regression, which
seems acceptab
[FunctionAttrs] Add the "initializes" attribute inference (#97373)
Add the "initializes" attribute inference.
This change is expected to have ~0.09% compile time regression, which
seems acceptable for interprocedural DSE.
https://llvm-compile-time-tracker.com/compare.php?from=9f10252c4ad7cffbbcf692fa9c953698f82ac4f5&to=56345c1cee4375eb5c28b8e7abf4803d20216b3b&stat=instructions%3Au
show more ...
|
Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4 |
|
#
64f19951 |
| 30-Aug-2024 |
Danial Klimkin <dklimkin@google.com> |
Fix stack overflow in allPathsGoThroughCold past 6b11573b8c5e (#106384)
Recursion here causes stack overflow on large inputs. Fixing by
unrolling via a stack.
|
#
6b11573b |
| 21-Aug-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
Recommit "[FunctionAttrs] deduce attr `cold` on functions if all CG paths call a `cold` function"
Fixed up the uar test that was failing. It seems with the new `cold` attribute the order of the func
Recommit "[FunctionAttrs] deduce attr `cold` on functions if all CG paths call a `cold` function"
Fixed up the uar test that was failing. It seems with the new `cold` attribute the order of the functions is different. As far as I can tell this is not a concern.
Closes #105559
show more ...
|
#
69a0af75 |
| 21-Aug-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
Revert "[FunctionAttrs] deduce attr `cold` on functions if all CG paths call a `cold` function"
This reverts commit b7eac8c6fea1ba3930d08011a0e5e3a262bfaece.
Causing a test failure. Not 100% sure t
Revert "[FunctionAttrs] deduce attr `cold` on functions if all CG paths call a `cold` function"
This reverts commit b7eac8c6fea1ba3930d08011a0e5e3a262bfaece.
Causing a test failure. Not 100% sure the issue so to reverting to unblock pipeline.
show more ...
|
Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2 |
|
#
b7eac8c6 |
| 31-Jul-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[FunctionAttrs] deduce attr `cold` on functions if all CG paths call a `cold` function
Closes #101298
|
Revision tags: llvmorg-19.1.0-rc1 |
|
#
559be8e2 |
| 24-Jul-2024 |
DianQK <dianqk@dianqk.net> |
Reapply "[FunctionAttrs] Determine underlying object by `getUnderlyingObjectAggressive` (#100102)"
Added handling for `AllocaInst`.
This reverts commit 1ee686a55aa6365eff39bbd1dc2059b16be6c2f1.
|
#
1ee686a5 |
| 23-Jul-2024 |
Nikita Popov <npopov@redhat.com> |
Revert "[FunctionAttrs] Determine underlying object by `getUnderlyingObjectAggressive` (#100102)"
This reverts commit a213edd32abff8d154dad96824689b98ec7b5a35.
Assertion failures on buildbots.
|
#
a213edd3 |
| 23-Jul-2024 |
DianQK <dianqk@dianqk.net> |
[FunctionAttrs] Determine underlying object by `getUnderlyingObjectAggressive` (#100102)
Thanks to #99509, we can fix
https://github.com/rust-lang/rust/issues/119573 too.
|
Revision tags: llvmorg-20-init |
|
#
9df71d76 |
| 28-Jun-2024 |
Nikita Popov <npopov@redhat.com> |
[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)
Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, re
[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)
Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, replacing the
current `getParent()->getDataLayout()` pattern.
show more ...
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6 |
|
#
f34d30cd |
| 07-May-2024 |
Nikita Popov <npopov@redhat.com> |
[FunctionAttrs] Fix incorrect nonnull inference for non-inbounds GEP (#91180)
For inbounds GEPs, if the source pointer is non-null, the result must
also be non-null. However, this does not hold for
[FunctionAttrs] Fix incorrect nonnull inference for non-inbounds GEP (#91180)
For inbounds GEPs, if the source pointer is non-null, the result must
also be non-null. However, this does not hold for non-inbounds GEPs.
Fixes https://github.com/llvm/llvm-project/issues/91177.
show more ...
|
Revision tags: llvmorg-18.1.5 |
|
#
a2ccd5d8 |
| 23-Apr-2024 |
Nikita Popov <npopov@redhat.com> |
[FunctionAttrs] Fix incorrect noundef inference with poison attrs (#89348)
Currently, when inferring noundef, we only check that the return value
is not undef/poison. However, we fail to account fo
[FunctionAttrs] Fix incorrect noundef inference with poison attrs (#89348)
Currently, when inferring noundef, we only check that the return value
is not undef/poison. However, we fail to account for the possibility
that a poison-generating return attribute will convert the value to
poison, and then violate the noundef attribute, resulting in immediate
UB.
For the relevant return attributes (align, nonnull and range), check
whether we can trivially re-prove the relevant property, otherwise do
not infer noundef.
This fixes the FunctionAttrs side of
https://github.com/llvm/llvm-project/issues/88026.
show more ...
|
Revision tags: llvmorg-18.1.4 |
|
#
60de56c7 |
| 16-Apr-2024 |
Harald van Dijk <harald.vandijk@codeplay.com> |
[ValueTracking] Restore isKnownNonZero parameter order. (#88873)
Prior to #85863, the required parameters of llvm::isKnownNonZero were
Value and DataLayout. After, they are Value, Depth, and Simpli
[ValueTracking] Restore isKnownNonZero parameter order. (#88873)
Prior to #85863, the required parameters of llvm::isKnownNonZero were
Value and DataLayout. After, they are Value, Depth, and SimplifyQuery,
where SimplifyQuery is implicitly constructible from DataLayout. The
change to move Depth before SimplifyQuery needed callers to be updated
unnecessarily, and as commented in #85863, we actually want Depth to be
after SimplifyQuery anyway so that it can be defaulted and the caller
does not need to specify it.
show more ...
|
#
e0a62871 |
| 12-Apr-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[ValueTracking] Convert `isKnownNonZero` to use SimplifyQuery (#85863)
This patch converts `isKnownNonZero` to use SimplifyQuery. Then we can
use the context information from `DomCondCache`.
Fix
[ValueTracking] Convert `isKnownNonZero` to use SimplifyQuery (#85863)
This patch converts `isKnownNonZero` to use SimplifyQuery. Then we can
use the context information from `DomCondCache`.
Fixes https://github.com/llvm/llvm-project/issues/85823.
Alive2: https://alive2.llvm.org/ce/z/QUvHVj
show more ...
|
Revision tags: 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 |
|
#
7e405eb7 |
| 01-Jan-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[FuncAttrs] Don't infer `noundef` for functions with `sanitize_memory` attribute (#76691)
MemorySanitizer assumes that the definition and declaration of a
function will be consistent. If we add `no
[FuncAttrs] Don't infer `noundef` for functions with `sanitize_memory` attribute (#76691)
MemorySanitizer assumes that the definition and declaration of a
function will be consistent. If we add `noundef` for some definitions,
it will break msan.
Fix buildbot failure caused by #76553.
show more ...
|
#
1228becf |
| 31-Dec-2023 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[FuncAttrs] Deduce `noundef` attributes for return values (#76553)
This patch deduces `noundef` attributes for return values.
IIUC, a function returns `noundef` values iff all of its return values
[FuncAttrs] Deduce `noundef` attributes for return values (#76553)
This patch deduces `noundef` attributes for return values.
IIUC, a function returns `noundef` values iff all of its return values
are guaranteed not to be `undef` or `poison`.
Definition of `noundef` from LangRef:
```
noundef
This attribute applies to parameters and return values. If the value representation contains any
undefined or poison bits, the behavior is undefined. Note that this does not refer to padding
introduced by the type’s storage representation.
```
Alive2: https://alive2.llvm.org/ce/z/g8Eis6
Compile-time impact: http://llvm-compile-time-tracker.com/compare.php?from=30dcc33c4ea3ab50397a7adbe85fe977d4a400bd&to=c5e8738d4bfbf1e97e3f455fded90b791f223d74&stat=instructions:u
|stage1-O3|stage1-ReleaseThinLTO|stage1-ReleaseLTO-g|stage1-O0-g|stage2-O3|stage2-O0-g|stage2-clang|
|--|--|--|--|--|--|--|
|+0.01%|+0.01%|-0.01%|+0.01%|+0.03%|-0.04%|+0.01%|
The motivation of this patch is to reduce the number of `freeze` insts
and enable more optimizations.
show more ...
|
#
4358e6e0 |
| 26-Dec-2023 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[FuncAttrs] Infer `norecurse` for funcs with calls to `nocallback` callees (#76372)
This patch adds missing `norecurse` attrs to funcs that only call intrinsics with `nocallback` attrs.
Fixes the r
[FuncAttrs] Infer `norecurse` for funcs with calls to `nocallback` callees (#76372)
This patch adds missing `norecurse` attrs to funcs that only call intrinsics with `nocallback` attrs.
Fixes the regression found in https://github.com/dtcxzyw/llvm-opt-benchmark/pull/45#discussion_r1436148743.
The function loses `norecurse` attr because it calls `@llvm.fabs.f64`, which is not marked as `norecurse`.
Since `norecurse` is not a default attribute of intrinsics and it is
ambiguous for intrinsics, I decided to use the existing `callback`
attributes.
> nocallback
This attribute indicates that the function is only allowed to jump back
into caller’s module by a return or an exception, and is not allowed to
jump back by invoking a callback function, a direct, possibly
transitive, external function call, use of longjmp, or other means. It
is a compiler hint that is used at module level to improve dataflow
analysis, dropped during linking, and has no effect on functions defined
in the current module.
See also https://llvm.org/docs/LangRef.html#function-attributes.
show more ...
|
Revision tags: 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 |
|
#
6b8ed787 |
| 16-Aug-2023 |
Nikita Popov <npopov@redhat.com> |
[IR] Add writable attribute
This adds a writable attribute, which in conjunction with dereferenceable(N) states that a spurious store of N bytes is introduced on function entry. This implies that th
[IR] Add writable attribute
This adds a writable attribute, which in conjunction with dereferenceable(N) states that a spurious store of N bytes is introduced on function entry. This implies that this many bytes are writable without trapping or introducing data races. See https://llvm.org/docs/Atomics.html#optimization-outside-atomic for why the second point is important.
This attribute can be added to sret arguments. I believe Rust will also be able to use it for by-value (moved) arguments. Rust likely won't be able to use it for &mut arguments (tree borrows does not appear to allow spurious stores).
In this patch the new attribute is only used by LICM scalar promotion. However, the actual motivation for this is to fix a correctness issue in call slot optimization, which needs this attribute to avoid optimization regressions.
Followup to the discussion on D157499.
Differential Revision: https://reviews.llvm.org/D158081
show more ...
|