#
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 |
|
#
193ea83d |
| 14-Jan-2025 |
Nikita Popov <npopov@redhat.com> |
[SimplifyLibCalls] Don't infer call-site nocapture on atoi
This is already inferred on the function declaration by BLC, there is no need to also do it at the call-site.
|
Revision tags: llvmorg-19.1.7 |
|
#
a77346ba |
| 06-Jan-2025 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[IRBuilder] Refactor FMF interface (#121657)
Up to now, the only way to set specified FMF flags in IRBuilder is to
use `FastMathFlagGuard`. It makes the code ugly and hard to maintain.
This patc
[IRBuilder] Refactor FMF interface (#121657)
Up to now, the only way to set specified FMF flags in IRBuilder is to
use `FastMathFlagGuard`. It makes the code ugly and hard to maintain.
This patch introduces a helper class `FMFSource` to replace the original
parameter `Instruction *FMFSource` in IRBuilder. To maximize the
compatibility, it accepts an instruction or a specified FMF.
This patch also removes the use of `FastMathFlagGuard` in some simple
cases.
Compile-time impact:
https://llvm-compile-time-tracker.com/compare.php?from=f87a9db8322643ccbc324e317a75b55903129b55&to=9397e712f6010be15ccf62f12740e9b4a67de2f4&stat=instructions%3Au
show more ...
|
#
bc8fa9c4 |
| 20-Dec-2024 |
Owen Anderson <resistor@mac.com> |
Revert "SimplifyLibCalls: Use default globals address space when building new global strings. (#118729)" (#119616)
This reverts commit cfa582e8aaa791b52110791f5e6504121aaf62bf.
|
Revision tags: llvmorg-19.1.6 |
|
#
22f0ebb1 |
| 12-Dec-2024 |
Owen Anderson <resistor@mac.com> |
TargetLibraryInfo: Use pointer index size to determine getSizeTSize(). (#118747)
When using non-integral pointer types, such as on CHERI targets, size_t
is equivalent
to the index size, which is a
TargetLibraryInfo: Use pointer index size to determine getSizeTSize(). (#118747)
When using non-integral pointer types, such as on CHERI targets, size_t
is equivalent
to the index size, which is allowed to be smaller than the size of the
pointer.
show more ...
|
#
cfa582e8 |
| 05-Dec-2024 |
Owen Anderson <resistor@mac.com> |
SimplifyLibCalls: Use default globals address space when building new global strings. (#118729)
Writing a test for this transitively exposed a number of places in
BuildLibCalls where
we were faili
SimplifyLibCalls: Use default globals address space when building new global strings. (#118729)
Writing a test for this transitively exposed a number of places in
BuildLibCalls where
we were failing to propagate address spaces properly, which are
additionally fixed.
show more ...
|
Revision tags: llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3 |
|
#
6ab26eab |
| 28-Oct-2024 |
Ellis Hoag <ellis.sparky.hoag@gmail.com> |
Check hasOptSize() in shouldOptimizeForSize() (#112626)
|
#
c85611e8 |
| 17-Oct-2024 |
goldsteinn <35538541+goldsteinn@users.noreply.github.com> |
[SimplifyLibCall][Attribute] Fix bug where we may keep `range` attr with incompatible type (#112649)
In a variety of places we change the bitwidth of a parameter but don't
update the attributes.
[SimplifyLibCall][Attribute] Fix bug where we may keep `range` attr with incompatible type (#112649)
In a variety of places we change the bitwidth of a parameter but don't
update the attributes.
The issue in this case is from the `range` attribute when inlining
`__memset_chk`. `optimizeMemSetChk` will replace an `i32` with an
`i8`, and if the `i32` had a `range` attr assosiated it will cause an
error.
Fixes #112633
show more ...
|
#
85c17e40 |
| 17-Oct-2024 |
Jay Foad <jay.foad@amd.com> |
[LLVM] Make more use of IRBuilder::CreateIntrinsic. NFC. (#112706)
Convert many instances of:
Fn = Intrinsic::getOrInsertDeclaration(...);
CreateCall(Fn, ...)
to the equivalent CreateIntrinsi
[LLVM] Make more use of IRBuilder::CreateIntrinsic. NFC. (#112706)
Convert many instances of:
Fn = Intrinsic::getOrInsertDeclaration(...);
CreateCall(Fn, ...)
to the equivalent CreateIntrinsic call.
show more ...
|
Revision tags: llvmorg-19.1.2 |
|
#
fa789dff |
| 11-Oct-2024 |
Rahul Joshi <rjoshi@nvidia.com> |
[NFC] Rename `Intrinsic::getDeclaration` to `getOrInsertDeclaration` (#111752)
Rename the function to reflect its correct behavior and to be consistent
with `Module::getOrInsertFunction`. This is a
[NFC] Rename `Intrinsic::getDeclaration` to `getOrInsertDeclaration` (#111752)
Rename the function to reflect its correct behavior and to be consistent
with `Module::getOrInsertFunction`. This is also in preparation of
adding a new `Intrinsic::getDeclaration` that will have behavior similar
to `Module::getFunction` (i.e, just lookup, no creation).
show more ...
|
#
3645c64d |
| 10-Oct-2024 |
braw-lee <93831198+braw-lee@users.noreply.github.com> |
[SimplifyLibCalls] fdim constant fold (#109235)
2nd PR to fix #108695
based on #108702
---------
Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
|
#
5184d763 |
| 10-Oct-2024 |
David Green <david.green@arm.com> |
[InstCombine] Convert @log to @llvm.log if the input is known positive. (#111428)
Similar to 112aac4e8961b9626bb84f36deeaa5a674f03f5a, this converts log
libcalls to llvm.log.f64 intrinsics if we kn
[InstCombine] Convert @log to @llvm.log if the input is known positive. (#111428)
Similar to 112aac4e8961b9626bb84f36deeaa5a674f03f5a, this converts log
libcalls to llvm.log.f64 intrinsics if we know they do not set errno, as
the input is not zero and not negative. As log will produce errno if the
input is 0 (returning -inf) or if the input is negative (returning nan),
we also perform the conversion when we have noinf and nonan.
show more ...
|
#
db98be3c |
| 08-Oct-2024 |
David Green <david.green@arm.com> |
[InstCombine] Minor cleanup for optimizeFMod. NFC
|
Revision tags: llvmorg-19.1.1 |
|
#
40389748 |
| 18-Sep-2024 |
David Green <david.green@arm.com> |
[InstCombine] Return FRem, as opposed to substituteInParent.
This attempts to fix the ASan buildbot, which is detecting that CI is used after it is removed in substituteInParent. The idea was to mak
[InstCombine] Return FRem, as opposed to substituteInParent.
This attempts to fix the ASan buildbot, which is detecting that CI is used after it is removed in substituteInParent. The idea was to make sure it was removed even if it had side-effects writing errno, but that appears to happen if we return FRem directly as usual.
show more ...
|
#
112aac4e |
| 18-Sep-2024 |
David Green <david.green@arm.com> |
[InstCombine] Fold fmod to frem if we know it does not set errno. (#107912)
fmod will be folded to frem in clang under -fno-math-errno and can be constant
folded in llvm if the operands are known.
[InstCombine] Fold fmod to frem if we know it does not set errno. (#107912)
fmod will be folded to frem in clang under -fno-math-errno and can be constant
folded in llvm if the operands are known. It can be relatively common to have
fp code that handles special values before doing some calculation:
```
if (isnan(f))
return handlenan;
if (isinf(f))
return handleinf;
..
fmod(f, 2.0)
```
This patch enables the folding of fmod to frem in instcombine if the first
parameter is not inf and the second is not zero. Other combinations do not set
errno.
The same transform is performed for fmod with the nnan flag, which implies the
input is known to not be inf/zero.
show more ...
|
Revision tags: llvmorg-19.1.0 |
|
#
c0e308ba |
| 13-Sep-2024 |
David Green <david.green@arm.com> |
[InstCombine] Pass DomTree and DomTreeCacheto LibCallSimplifier (#108446)
This allows any combines to pick up Known states from dominating
conditions.
|
Revision tags: llvmorg-19.1.0-rc4 |
|
#
7134d2e9 |
| 26-Aug-2024 |
Sergei Barannikov <barannikov88@gmail.com> |
[SimplifyLibCalls] Fix memchr misoptimization (#106121)
The `ch` argument of memcmp should be truncated to `unsigned char`
before using it in comparisons. This didn't happen on all code paths.
The
[SimplifyLibCalls] Fix memchr misoptimization (#106121)
The `ch` argument of memcmp should be truncated to `unsigned char`
before using it in comparisons. This didn't happen on all code paths.
The following program miscompiled at -O1 and higher:
```C++
#include <cstring>
#include <iostream>
char ch = '\x81';
int main() {
bool found = std::strchr("\x80\x81\x82", ch) != nullptr;
std::cout << std::boolalpha << found << '\n';
}
```
show more ...
|
Revision tags: llvmorg-19.1.0-rc3 |
|
#
60bffe22 |
| 16-Aug-2024 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Handle commuted variant of sqrt transform
|
#
95daf1ae |
| 15-Aug-2024 |
Snehasish Kumar <snehasishk@google.com> |
Allow optimization of __size_returning_new variants. (#102258)
https://github.com/llvm/llvm-project/pull/101564 added support to TLI to
detect variants of operator new which provide feedback on the
Allow optimization of __size_returning_new variants. (#102258)
https://github.com/llvm/llvm-project/pull/101564 added support to TLI to
detect variants of operator new which provide feedback on the actual
size of memory allocated (http://wg21.link/P0901R5). This patch extends
SimplifyLibCalls to handle hot cold hinting of these variants.
show more ...
|
Revision tags: llvmorg-19.1.0-rc2 |
|
#
5c48f6fa |
| 04-Aug-2024 |
Sergei Barannikov <barannikov88@gmail.com> |
[InstCombine] Don't add extra 0 to string in str[np]cpy optimization (#101884)
It is unused by subsequent memcpy.
|
#
4f42deb5 |
| 01-Aug-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[SimplifyLibCalls] Constant fold nan libcall (#101459)
Reference: https://en.cppreference.com/w/c/numeric/math/nan
The logic is copied from clang frontend:
https://github.com/llvm/llvm-project
[SimplifyLibCalls] Constant fold nan libcall (#101459)
Reference: https://en.cppreference.com/w/c/numeric/math/nan
The logic is copied from clang frontend:
https://github.com/llvm/llvm-project/blob/1d2b2d29d733200b704f38d220d22ecc07d6cf42/clang/lib/AST/ExprConstant.cpp#L14741-L14777
---------
Co-authored-by: Nikita Popov <github@npopov.com>
show more ...
|
#
67fb7c34 |
| 29-Jul-2024 |
Noah Goldstein <goldstein.w.n@gmail.com> |
[TLI] Add support for inferring attr `cold` on `exit`/`abort`
`abort` can be assumed always cold and assume non-zero `exit` status as a `cold` path as well.
Closes #101003
|
Revision tags: llvmorg-19.1.0-rc1 |
|
#
9d45b450 |
| 24-Jul-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[SimplifyLibCalls] Constant fold `remquo` (#99647)
This patch adds constant folding support for `remquo`.
Reference: https://en.cppreference.com/w/cpp/numeric/math/remquo
Closes https://github.c
[SimplifyLibCalls] Constant fold `remquo` (#99647)
This patch adds constant folding support for `remquo`.
Reference: https://en.cppreference.com/w/cpp/numeric/math/remquo
Closes https://github.com/llvm/llvm-project/issues/99497.
show more ...
|
Revision tags: llvmorg-20-init |
|
#
e980990e |
| 11-Jul-2024 |
Hendrik Hübner <117831077+HendrikHuebner@users.noreply.github.com> |
[SimplifyLibCalls] Simplify cabs libcall if real or imaginary part of input is zero (#97976)
cabs(a + i0) -> abs(a)
cabs(0 +ib) -> abs(b)
Closes #97336
|
#
2d209d96 |
| 27-Jun-2024 |
Nikita Popov <npopov@redhat.com> |
[IR] Add getDataLayout() helpers to BasicBlock and Instruction (#96902)
This is a helper to avoid writing `getModule()->getDataLayout()`. I
regularly try to use this method only to remember it does
[IR] Add getDataLayout() helpers to BasicBlock and Instruction (#96902)
This is a helper to avoid writing `getModule()->getDataLayout()`. I
regularly try to use this method only to remember it doesn't exist...
`getModule()->getDataLayout()` is also a common (the most common?)
reason why code has to include the Module.h header.
show more ...
|