514873 Commits

Author SHA1 Message Date
long.chen
51a2f50ee7
[mlir][affine] fix the issue of ceildiv-mul-ceildiv form expression not satisfying commutative (#111254)
my prove:
we can simple `(n * s) ceildiv a ceildiv s` to `n ceildiv a`
because `(n * s) ceildiv a ceildiv b` <=> `(n * s) ceildiv s ceildiv a`
<=> `n ceildiv a`

let's prove the `s floordiv a floor b` <=> `s floordiv b floor a`
let `s = ka +m (m < a)` so `s floordiv a` <=> `s / a - m / a`

similarly, it can be proven that: 
`s floordiv a floordiv b` <=> `s / (a * b) - m / (a * b) - n / (b)   constrain  (n < b)` 
<=> `s / (a * b) - (m + a*n) / (a*b)`

because `a* b - (m + a*n)` <=> `a*b - a*n - m` > `a - m` > `0`
so `s floordiv a floordiv b` <=> `[s / (a*b)]` <=> `s floordiv b floordiv a`
but if `s floordiv b` mutiply a factor above didn't always hold true.

Fixes https://github.com/llvm/llvm-project/issues/107508
2024-10-12 11:25:57 -04:00
Kazu Hirata
c9a1cffd3d
[Analysis] Simplify code with DenseMap::operator[] (NFC) (#112082) 2024-10-12 08:04:38 -07:00
Kazu Hirata
571354e251
[clang-tidy] Avoid repeated hash lookups (NFC) (#112074) 2024-10-12 08:04:17 -07:00
Kazu Hirata
b192f208d6
[BOLT] Avoid repeated hash lookups (NFC) (#112073) 2024-10-12 08:03:39 -07:00
Kazu Hirata
abb594b965
[SystemZ] Avoid repeated hash lookups (NFC) (#112072) 2024-10-12 08:01:26 -07:00
Kazu Hirata
9c2fc17ee7
[Sema] Avoid repeated hash lookups (NFC) (#112071) 2024-10-12 08:00:31 -07:00
Joseph Huber
6a6af0246b [Clang] Remove unused TC variable 2024-10-12 07:09:03 -05:00
Joseph Huber
3acb0e9e60
[HIP] Replace use of llvm-mc with clang (#112041)
Summary:
We currently use `llvm-mc` which is intended for internal testing and
not expected to be present in every installation. This patch changes
that to just use clang instead to get the `.o` from the HIP registration
code.

My preferred solution would be to use the new driver, but I still
haven't gotten the test suite to pass on this one weird OpenMP case.

Fixes: https://github.com/llvm/llvm-project/issues/112031
2024-10-12 07:03:28 -05:00
Miguel Saldivar
6fd229a655
[X86] Invert (and X, ~(and ~Y, Z)) back into (and X, (or Y, ~Z)) (#109215)
When `andn` is available, we should avoid switching `s &= ~(z & ~y);` into `s &= ~z | y;`

This patch turns this assembly from:
```
foo:
        not     rcx
        and     rsi, rdx
        andn    rax, rsi, rdi
        or      rcx, rdx
        and     rax, rcx
        ret
```
into:
```
foo:
        and     rsi, rdx
        andn    rcx, rdx, rcx
        andn    rax, rsi, rdi
        andn    rax, rcx, rax
        ret
```
Fixes #108731
2024-10-12 11:28:39 +01:00
Javed Absar
b9cae45b63
[mlir][linalg][NFC] Fix documentation. (#112009) 2024-10-12 11:26:50 +01:00
Matt Arsenault
cb2f161957
AArch64: Remove incorrect REQUIRES arm-registered-target from test (#111983) 2024-10-12 13:26:17 +04:00
Tim Renouf
76007138f4
[LLVM] New NoDivergenceSource function attribute (#111832)
A call to a function that has this attribute is not a source of
divergence, as used by UniformityAnalysis. That allows a front-end to
use known-name calls as an instruction extension mechanism (e.g.
https://github.com/GPUOpen-Drivers/llvm-dialects ) without such a call
being a source of divergence.
2024-10-12 09:34:45 +01:00
Oleksandr T.
3292ce0867
[Clang] fix overload resolution for object parameters with top-level cv-qualifiers in member functions (#110435)
Fixes #100394
2024-10-12 10:11:36 +02:00
Nikolas Klauser
9f24c14549 [libc++][NFC] Remove non-existant macros from the clang-format file
These macros existed at some point in libc++, but have been removed now,
so we can also remove them from the clang-format file.
2024-10-12 09:52:36 +02:00
Nikolas Klauser
ba87515fea
[libc++][RFC] Always define internal feature test macros (#89178)
Currently, the library-internal feature test macros are only defined if
the feature is not available, and always have the prefix
`_LIBCPP_HAS_NO_`. This patch changes that, so that they are always
defined and have the prefix `_LIBCPP_HAS_` instead. This changes the
canonical use of these macros to `#if _LIBCPP_HAS_FEATURE`, which means
that using an undefined macro (e.g. due to a missing include) is
diagnosed now. While this is rather unlikely currently, a similar change
in `<__configuration/availability.h>` caught a few bugs. This also
improves readability, since it removes the double-negation of `#ifndef
_LIBCPP_HAS_NO_FEATURE`.

The current patch only touches the macros defined in `<__config>`. If
people are happy with this approach, I'll make a follow-up PR to also
change the macros defined in `<__config_site>`.
2024-10-12 09:49:52 +02:00
Fangrui Song
dbd197118d [ELF] Pass Ctx & to Symbol 2024-10-11 23:34:43 -07:00
Kazu Hirata
a62768c427
[CodeGen] Simplify code with *Map::operator[] (NFC) (#112075) 2024-10-11 23:01:21 -07:00
Amir Ayupov
79d695f049
[BOLT][NFCI] Speedup BAT::writeMaps
For a large binary with BAT section of size 38 MB with ~170k maps,
reduces writeMaps time from 70s down to 1s.

The inefficiency was in the use of std::distance with std::map::iterator
which doesn't provide random access. Use sorted vector for lookups.

Test Plan: NFC

Reviewers: maksfb, rafaelauler, dcci, ayermolo

Reviewed By: maksfb

Pull Request: https://github.com/llvm/llvm-project/pull/112061
2024-10-11 21:40:53 -07:00
Fangrui Song
dd326b1225 [ELF] Pass Ctx & 2024-10-11 21:10:05 -07:00
Fangrui Song
d0606c265e [ELF] Make .comment have a non-full file
This ensures that SectionBase::file is non-null except
InputSection::discarded.
2024-10-11 20:55:21 -07:00
Fangrui Song
c33133279b [ELF] Pass Ctx & to InputSection 2024-10-11 20:39:53 -07:00
Pavel Samolysov
23c64beecc
[PGO] Preserve analysis results when nothing was instrumented (#93421)
The `PGOInstrumentationGen` pass should preserve all analysis results
when nothing was actually instrumented. Currently, only modules that
contain at least a single function definition are instrumented. When a
module contains only function declarations and, optionally, global
variable definitions (a module for the regular-LTO phase for thin-LTO
when LTOUnit splitting is enabled, for example), such module is not
instrumented (yet?) and there is no reason to invalidate any analysis
results.

NFC.
2024-10-12 06:29:55 +03:00
Fangrui Song
9bf2e20b17 [ELF] Pass Ctx & to OutputSection 2024-10-11 20:28:58 -07:00
Fangrui Song
6dd773b650 [ELF] Pass Ctx & 2024-10-11 20:15:02 -07:00
Yingwei Zheng
966bee739c
[InstCombine][NFC] Fix typo in is_fpclass.ll (#112067)
This typo causes alive2 to crash.
2024-10-12 11:06:25 +08:00
Matt Arsenault
1ac6ef5af2
clang: Add llvm-mc to CLANG_TEST_DEPS (#112032)
Attempt to fit sporadic precommit test failures in
hip-partial-link.hip

The driver really shouldn't be using llvm-mc in the first place
though, filed #112031 to fix this.
2024-10-12 06:42:31 +04:00
Iuri Chaer
0fba8381d2
[clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (#96804)
* Convert `ReflowComments` from boolean into a new `enum` which can take
on the value `RCS_Never`, `RCS_IndentOnly`, or `RCS_Always`. The first
one is equivalent to the old `false`, the third one is `true`, and the
middle one means that multiline comments should only have their
indentation corrected, which is what Doxygen users will want.
* Preserve backward compatibility while parsing `ReflowComments`.
2024-10-11 19:14:09 -07:00
Fangrui Song
1c28f31133 [ELF] Pass Ctx & 2024-10-11 18:35:02 -07:00
Keith Smiley
24ac6cf4f7
[bazel] Port 58d97034c9c149d175c66440d31f46e9dfd4b760 (#112064) 2024-10-11 18:10:38 -07:00
Vitaly Buka
fa81868fe6
[lsan] Log thread history (#111949)
Only with high verbosity and leak reports, or thread logging requested.
2024-10-11 18:09:37 -07:00
Nicolas van Kempen
f1367a473d
[clang-tidy][modernize-use-starts-ends-with] Add support for two ends_with patterns (#110448)
Add support for the following two patterns:
```
haystack.compare(haystack.length() - needle.length(), needle.length(), needle) == 0;
haystack.rfind(needle) == (haystack.size() - needle.size());
```
2024-10-11 21:00:38 -04:00
Youngsuk Kim
6d4edf2f75
[clang][CGOpenMPRuntime] Avoid Type::getPointerTo() (NFC) (#112017)
`llvm::Type::getPointerTo()` is to be deprecated & removed soon.
2024-10-11 20:09:24 -04:00
Vitaly Buka
aa44f59abf
[NFC][sanitizer] Add Debug utility to print thread history (#111948)
For #111949
2024-10-11 16:58:42 -07:00
Vitaly Buka
e1cff8bf81
[lsan] Add debug option to "deflake" leaks (#112037)
There are hard to debug leaks which look like
false.

In general, repeating leak checking should not
affect set of leaks significantly, especial
`at_exit` leak checking.

But if we see significant discrepancy, it may give
us a clue for investigation.
2024-10-11 16:57:19 -07:00
Craig Topper
902520256b [RISCV] Make (sext_inreg X, i1) legal for XTHeadBb to cover the existing isel pattern.
I just happened to notice the untested isel pattern.
2024-10-11 16:16:07 -07:00
Michael Jones
637054640e
[libc] Make strtointeger handle all bigint types (#111926)
Needed for #110894

The strtointeger code was updated to support some bigint types in #85201
but not all. This patch finishes the cleanup so that it can work for a
wider range of types.
2024-10-11 16:07:19 -07:00
Thomas Symalla
f4cf6242fb
[Docs] Fix typo in recent coro docs (#112005) 2024-10-12 00:23:18 +02:00
Vitaly Buka
abe148a09f
[NFC][sanitizer][asan] Promote stack_id into ThreadContextBase (#111917)
`parent_id` and `stack_id` represent location
where the thread was created, so it's reasonable
to keep them togeter.

For now, only Asan and MemProf use `stack_id`,
but it will be halpfull to print thread origin from
other sanitizers as well.

For #111948
2024-10-11 14:47:01 -07:00
Tex Riddell
82b40fd4fd
Fix scalar overload name constructed by ReplaceWithVeclib.cpp (#111095)
ReplaceWithVeclib.cpp would construct overload name using all the
arguments in the intrinsic, but overloads should only be constructed
from arguments for which isVectorIntrinsicWithOverloadTypeAtArg returns
true, including the return type first (index -1).

Additionally,
- skip when `Intrinsic::not_intrinsic`, otherwise
`isVectorIntrinsicWithOverloadTypeAtArg` asserts for some
IntrinsicCalls.

Unblocks translation for pow and atan2 intrinsics.

Fixes #111093
2024-10-11 14:38:35 -07:00
Craig Topper
8b46d40221 [RISCV] Re-generate orc-b-patterns.ll for store clustering. NFC
The patch added orc-b-patterns.ll landed while store clustering was
still in review.
2024-10-11 14:28:51 -07:00
Eric Astor
9a97a57d9e
[clang][frontend] Add support for attribute plugins for statement attributes (#110334)
We already have support for declaration attributes; this is just a matter of extending the plugin infrastructure to cover one more case.
2024-10-11 17:28:44 -04:00
Florian Mayer
38b010258b
[MTE] Also test alignment and size of MTE globals (#112039) 2024-10-11 14:01:24 -07:00
Teresa Johnson
1de71652fd
[MemProf] Support cloning for indirect calls with ThinLTO (#110625)
This patch enables support for cloning in indirect callsites.

This is done by synthesizing callsite records for each virtual call
target from the profile metadata. In the thin link all the synthesized
records for a particular indirect callsite initially share the same
context node, but support is added to partition the callsites and
outgoing edges based on the callee function, creating a separate node
for each target.

In the LTO backend, when cloning is needed we first perform indirect
call promotion, then change the target of the new direct call to the
desired clone.

Note this is ThinLTO-specific, since for regular LTO indirect call
promotion should have already occurred.
2024-10-11 13:53:35 -07:00
Shourya Goel
111b062f63
[libc] Fix for adding macro I (#111872)
We have two (EDIT: 4) files in which we are using `I`. This PR replaces
them with alternatives like `i` and `IDX` etc.
2024-10-11 16:35:01 -04:00
Alexey Bataev
3ed8acf2f0 [SLP][NFC]Simplify check for external user parent basic block, NFC. 2024-10-11 13:11:16 -07:00
Brox Chen
16c8056ca9
[AMDGPU][test] update test with update_mc_test_check (#111913)
a non-functional change

Update test script with update_mc_test_check script and sort the
testline to be alphabetic order. This helps to maintain the test file in
a clean state
2024-10-11 20:54:33 +01:00
Brian Cain
77aa8257ac
[lld][Hexagon] Support predicated-add GOT_16_X mask lookup (#111896)
When encountering an instruction like `if (p0) r0 = add(r0,##bar@GOT)`,
lld would fail with:
```
ld.lld: error: unrecognized instruction for 16_X type: 0x7400C000
```

This issue was encountered while building libreadline with clang 19.1.0.

Fixes: #111876
2024-10-11 14:31:41 -05:00
Alex Bradbury
2967e5f800
[RISCV] Enable store clustering by default (#73796)
Builds on #73789, enabling store clustering by default using the same
heuristic.
2024-10-11 20:25:53 +01:00
vporpo
cc8edbca7d
[SandboxVec][Interval][NFC] Rename From/To to Top/Bottom (#112034)
The API was already using top()/bottom() but internally we were still
using From/To. This patch fixes this.

Top/Bottom seems a better choice because implies program order, whereas
From/To does not.
2024-10-11 12:25:22 -07:00
Fabian Mora
58d97034c9
[mlir][OpenMP] Implement the ConvertToLLVMPatternInterface (#101997)
This patch implements the `ConvertToLLVMPatternInterface` for the OpenMP
dialect, allowing `convert-to-llvm` to act on the OpenMP dialect.
2024-10-11 15:07:08 -04:00