508596 Commits

Author SHA1 Message Date
Leandro Lupori
062e69a647
[flang][OpenMP] Fix 2 more regressions after #101009 (#101538)
PR #101009 exposed a semantic check issue with OPTIONAL dummy
arguments.
Another issue occurred when using %{re,im,len,kind}, as these also
need to be skipped when handling variables with implicitly defined
DSAs.

These issues were found by Fujitsu testsuite.
2024-08-15 14:14:18 -03:00
Volodymyr Vasylkun
d68d2172f9
[InstCombine] Fold ucmp/scmp(x, y) >> N to zext/sext(x < y) when N is one less than the width of the result of ucmp/scmp (#104009)
Proof: https://alive2.llvm.org/ce/z/4diUqN

---------

Co-authored-by: Nikita Popov <github@npopov.com>
2024-08-15 18:08:23 +01:00
Keith Smiley
dd3f1313ae
[bazel] Enable more lit self tests (#104285)
I assume the intent of the initial `*/*.py` was to also collect things
in `*.py`, but that's not what bazel does unless you use `**/*.py` which
is what we're doing now. A few of these tests fail so I explicitly
disabled them until someone has time to debug.
2024-08-15 09:59:29 -07:00
jeffreytan81
54154f9f06
Fix single thread stepping timeout race condition (#104195)
This PR fixes a potential race condition in
https://github.com/llvm/llvm-project/pull/90930.

This race can happen because the original code set `m_info->m_isAlive =
true` **after** the timer thread is created. So if there is a context
switch happens and timer thread checks `m_info->m_isAlive` before main
thread got a chance to run `m_info->m_isAlive = true`, the timer thread
may treat `ThreadPlanSingleThreadTimeout` as not alive and simply exit
resulting in async interrupt never being sent to resume all threads
(deadlock).

The PR fixes the race by initializing all states **before** worker timer
thread creates.

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2024-08-15 09:57:01 -07:00
Koakuma
e61776a0ed
[SPARC][Utilities] Add names for SPARC ELF flags in LLVM binary utilities (#102843)
This allows us to use and print readable names in LLVM binary utilities.
2024-08-15 23:49:01 +07:00
Koakuma
6c270a8b9f
[SPARC][Driver] Add -m(no-)v8plus flags handling (#98713)
Implement handling for `-m(no-)v8plus` flags to allow the user to switch
between V8 and V8+ mode with 32-bit code.

Currently it only toggles the V8+ feature bit, ABI and codegen changes
will be done in future patches.
2024-08-15 23:46:09 +07:00
Hansang Bae
9e0ee0e104
[OpenMP] Add support for pause with omp_pause_stop_tool (#97100)
This patch adds support for pause resource with a new enumerator
omp_pause_stop_tool. The expected behavior of this enumerator is
* omp_pause_resource: not allowed
* omp_pause_resource_all: equivalent to omp_pause_hard
2024-08-15 11:44:50 -05:00
Alexey Bataev
b6bb208662 Revert "[SLP][NFC]Remove unused using declarations, reduce mem usage in containers, NFC"
This reverts commit 2d52eb6a434fe47e67086f5ec1c3789bf6e7a604 to fix
compile time regression found in https://llvm-compile-time-tracker.com/compare.php?from=fcefe957ddfdc5a2fe9463757b597635e3436e01&to=2d52eb6a434fe47e67086f5ec1c3789bf6e7a604&stat=instructions%3Au.
2024-08-15 09:19:01 -07:00
Nikita Popov
afa0f53f96 [ValueTracking] Fix f16 fptosi range for large integers
We were missing the signed flag on the negative value, so the
range was incorrectly interpreted for integers larger than 64-bit.

Split out from https://github.com/llvm/llvm-project/pull/80309.
2024-08-15 18:18:19 +02:00
Nikita Popov
46fb225f3a [InstSimplify] Add tests for f16 to i128 range (NFC) 2024-08-15 18:18:19 +02:00
Fangrui Song
64c856055a
Revert "[Object][x86-64] Add support for R_X86_64_GLOB_DAT relocations. (#103029)" (#103497)
This reverts commit 5ae9faa538d100ab38f6f4f99c924de0e4270272.

RelocationResolver is only supposed to handle static relocation types.
Introducing GLOB_DAT could negatively impact other RelocationResolver
users who solely handle static relocations and want to report errors for
dynamic relocations.

If GLOB_DAT is the sole required relocation, explicitly checking for it
in the caller would be more reliable. Additionally, the caller should
handle GLOB_DAT on other architectures.
2024-08-15 17:01:06 +01:00
sp
51328b78dc
[NFC] Fix spelling of "definitely". (#104455)
This corrects the misspelling of "definitely" as "definately". No
functional changes.
2024-08-15 18:00:03 +02:00
Kevin McAfee
e63b7ba0eb
[InstCombine][NFC] Add tests for shifts of constants by common factor (#103471) 2024-08-15 08:49:55 -07:00
Hansang Bae
5989709047
[OpenMP] Miscellaneous small code improvements (#95603)
Removes a few uninitialized variables, possible resource leaks, and
redundant code.
2024-08-15 10:42:22 -05:00
Daniel Grumberg
57abd4e4ab
[clang][ExtractAPI] Emit environment component of target triple in SGF (#103273)
rdar://133533830
2024-08-15 16:23:31 +01:00
Luke Lau
11c2da8fb7
[RISCV] Narrow indices to e16 for LMUL > 1 when lowering vector_reverse (#104427)
The vector_shuffle lowering already does this to reduce register
pressure, so also do it here.
2024-08-15 23:18:03 +08:00
Rahul Joshi
db8ef6188c
[NFC] Fix code line exceeding 80 columns (#104428) 2024-08-15 08:15:30 -07:00
Alexey Bataev
2d52eb6a43 [SLP][NFC]Remove unused using declarations, reduce mem usage in containers, NFC 2024-08-15 08:12:20 -07:00
Mital Ashok
c7df775440
[Clang] Check explicit object parameter for defaulted operators properly (#100419)
Previously, the type of explicit object parameters was not considered
for relational operators. This was defined by CWG2586,
<https://cplusplus.github.io/CWG/issues/2586.html>. This fix also means
CWG2547 <https://cplusplus.github.io/CWG/issues/2547.html> is now fully
implemented. Fixes #100329, fixes #104413.

Now start rejecting invalid rvalue reference parameters, which weren't
checked for, and start accepting non-reference explicit object
parameters (like `bool operator==(this C, C) = default;`) which were
previously rejected for the object param not being a reference.

Also start rejecting non-reference explicit object parameters for
defaulted copy/move assign operators (`A& operator=(this A, const A&) =
default;` is invalid but was previously accepted). Fixes #104414.
2024-08-15 19:12:11 +04:00
Jeffrey Byrnes
fcefe957dd
[LegalizeTypes][AMDGPU]: Allow for scalarization of insert_subvector (#104236)
Legalization for when the inserted subvector is to be scalarized.

https://godbolt.org/z/vx3joWqoh
2024-08-15 08:07:05 -07:00
Snehasish Kumar
95daf1aedf
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.
2024-08-15 08:06:41 -07:00
Alexey Bataev
56140a8258 [SLP]Fix PR104422: Wrong value truncation
The minbitwidth restrictions can be skipped only for immediate reduced
values, for other nodes still need to check if external users allow
bitwidth reduction.

Fixes https://github.com/llvm/llvm-project/issues/104422
2024-08-15 08:00:08 -07:00
Tobias Stadler
13a6a79752
[GlobalISel] Combiner: Fix warning after #102163
Default case in covered switches is illegal.
https://llvm.org/docs/CodingStandards.html#don-t-use-default-labels-in-fully-covered-switches-over-enumerations

Pull Request: https://github.com/llvm/llvm-project/pull/104441
2024-08-15 16:27:18 +02:00
Alexey Bataev
65ac12d3c9 [SLP][NFC]Add a test with incorrect minbitwidth analysis for reduced operands 2024-08-15 07:26:44 -07:00
earnol
75cb7de404
[ubsan] Display correct runtime messages for negative _BitInt (#96240)
Without this patch compiler-rt ubsan library has a bug displaying
incorrect values for variables of the _BitInt (previously called
_ExtInt) type. This patch affects affects both: generation of metadata
inside code generator and runtime part. The runtime part provided only
for i386 and x86_64 runtimes. Other runtimes should be updated to take
full benefit of this patch.
The patch is constructed the way to be backward compatible and int and
float type runtime diagnostics should be unaffected for not yet updated
runtimes.

This patch fixes issue
https://github.com/llvm/llvm-project/issues/64100.

Co-authored-by: Eänolituri Lómitaurë <vladislav.aranov@ericsson.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: Paul Kirth <paulkirth@google.com>
2024-08-15 10:15:27 -04:00
Nikita Popov
aaab4fcf65 Revert "[SLP][NFC]Remove unused using declarations, reduce mem usage in containers, NFC"
This reverts commit e1b15504a831e63af6fb9a6e83faaa10ef425ae6.

This causes compile-time regressions, see:
http://llvm-compile-time-tracker.com/compare.php?from=e687a9f2dd389a54a10456e57693f93df0c64c02&to=e1b15504a831e63af6fb9a6e83faaa10ef425ae6&stat=instructions:u

Probably some of the new SmallVector sizes are sub-optimal.
2024-08-15 15:50:48 +02:00
Sergei Barannikov
6543bd718e
[DataLayout] Extract loop body into a function to reduce nesting (NFC) (#104420)
Also, use `iterator_range` version of `split`.

Pull Request: https://github.com/llvm/llvm-project/pull/104420
2024-08-15 16:41:52 +03:00
Daniel Grumberg
026d963cb0
[clang][ExtractAPI] Compute inherited availability information (#103040)
Additionally this computes availability information for all platforms
ahead of possibly introducing a flag to enable this behavior.

rdar://123513706
2024-08-15 14:19:49 +01:00
Jie Fu
a4525fcc8f [CodeGen] Fix -Wcovered-switch-default in Combiner.cpp (NFC)
/llvm-project/llvm/lib/CodeGen/GlobalISel/Combiner.cpp:220:3:
error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
  default:
  ^
1 error generated.
2024-08-15 21:17:12 +08:00
Steven Wu
d2a8351be2
[CompilerRT][Tests] Fix profile/darwin-proof-of-concept.c (#104237)
Fix profile/darwin-proof-of-concept.c on AppleSilicon Mac where there is
a different page alignment. The previous fix to drop alignment is
actually breaking the tests on Apple Silicon Mac. Revert to the original
section alignment and requires an ARM64 target for this test to run.
2024-08-15 06:16:27 -07:00
Andrea Faulds
569698443d
[mlir][gpu] Fix typo in test filename (#104053)
The word "redule" doesn't appear anywhere else in the MLIR codebase and
seems to be a typo of "reduce".
2024-08-15 08:11:31 -05:00
WANG Rui
82cf6558e5 [LoongArch] Pre-commit tests for validating the merge base offset in vecotrs. NFC 2024-08-15 21:06:27 +08:00
Lukacma
d7aeea626d
[AArch64] optimise SVE prefetch intrinsics with no active lanes (#103052)
This patch extends https://github.com/llvm/llvm-project/pull/73964 and
optimises away SVE prefetch intrinsics when predicate is zero.
2024-08-15 13:52:35 +01:00
Janek van Oirschot
bfce1aae76
[AMDGPU] MCExpr printing helper with KnownBits support (#95951)
Walks over the MCExpr and uses KnownBits to deduce whether an expression
is known and if so, prints said known value. Should support the most
common MCExpr cases for AMDGPU metadata.
2024-08-15 13:43:13 +01:00
Tobias Stadler
846f790216
[GlobalISel] Combiner: Observer-based DCE and retrying of combines
Continues the work for disabling fixed-point iteration in the Combiner
(#94291).

This introduces improved Observer-based heuristics in the
GISel Combiner to retry combining defs/uses of modified instructions and
for performing sparse dead code elimination.

I have experimented a lot with the heuristics and this seems to be the
minimal set of heuristics that allows disabling fixed-point iteration
for AArch64 CTMark O2 without regressions.
Enabling this globally would pass all regression tests for all official
targets (apart from small benign diffs), but I have made this fully
opt-in for now, because I can't quantify the impact for other targets.

This should mostly be on-par with how the WorkList-aware functions
in the InstCombiner and DAGCombiner handle rescheduling instructions
for recombining.

For performance numbers see my follow-up patch for AArch64 (#102167)

Pull Request: https://github.com/llvm/llvm-project/pull/102163
2024-08-15 14:40:16 +02:00
Joseph Huber
f71b638651
[libcxx] Use aligned_alloc for testing instead of posix_memalign (#101748)
Summary:
The `aligned_alloc` function is the C11 replacement for
`posix_memalign`. We should favor the C standard over the POSIX standard
so more C library implementations can run the tests.
2024-08-15 07:11:31 -05:00
Florian Hahn
42555cdba4
[VPlan] Run VPlan optimizations on plans in native path.
Update buildVPlans (used in native path) to also run general VPlan
optimizations in another small step to align both codepaths.
2024-08-15 13:05:51 +01:00
Timm Baeder
d2c26d82b0
[clang][Interp] Use first field decl for Record field lookup (#104412) 2024-08-15 13:57:38 +02:00
Matt Arsenault
2ccbf92f87 InferAddressSpaces: Restore non-instruction user check
Fixes regression after 79658d65c3c7a075382b74d81e74714e2ea9bd2d.
We were missing test coverage for the nested constant expression
case.
2024-08-15 15:55:09 +04:00
Fraser Cormack
2e9f3f3b84
[AMDGPU][llvm-split] Fix another division by zero (#104421)
Somehow I missed this in #98888. It requires a log file, or the debug
flag to be passed.
2024-08-15 12:54:26 +01:00
Pavel Labath
57a19ac336
Reapply "[lldb] Tolerate multiple compile units with the same DWO ID (#100577)" (#104041)
The only change vs. the first version of the patch is that I've made
DWARFUnit linking thread-safe/unit. This was necessary because, during
the
indexing step, two skeleton units could attempt to associate themselves
with the split unit.

The original commit message was:

I ran into this when LTO completely emptied two compile units, so they
ended up with the same hash (see #100375). Although, ideally, the
compiler would try to ensure we don't end up with a hash collision even
in this case, guaranteeing their absence is practically impossible. This
patch ensures this situation does not bring down lldb.
2024-08-15 13:34:03 +02:00
Adrian Vogelsgesang
7898866065
[lldb-dap] Expose log path in extension settings (#103482)
lldb-dap already supports a log file which can be enabled by setting the
`LLDBDAP_LOG` environment variable. With this commit, the log location
can be set directly through the VS-Code extension settings.

Also, this commit bumps the version number, such that the new VS Code
extension gets published to the Marketplace.
2024-08-15 13:19:32 +02:00
Timm Baeder
91ffc12a82
[clang][Interp] Pass callee decl to null_callee diagnostics (#104426)
The callee is null, not the full call expression.
2024-08-15 13:18:33 +02:00
Hua Tian
43ba1097ee
[llvm][CodeGen] Resolve issues when updating live intervals in window scheduler (#101945)
Corrupted live interval information can cause window scheduling to crash
in some cases. By adding the missing MBB's live interval information in the
ModuloScheduleExpander, the information can be correctly analyzed in 
the window scheduler.
2024-08-15 19:03:27 +08:00
Sergei Barannikov
100c9c019c
[DataLayout] Add helper predicates to sort specifications (NFC) (#104417) 2024-08-15 13:52:25 +03:00
Matt Arsenault
79658d65c3
InferAddressSpaces: Make getPredicatedAddrSpace less confusing (#104052)
This takes a pointer value and the user instruction. Name them as
such, and remove the null check which should be dead.
2024-08-15 14:42:08 +04:00
zhongyunde 00443407
43ffe2eed0 [AArch64] Fold more load.x into load.i with large offset
The list of load.x is refer to canFoldIntoAddrMode on D152828.
Also support LDRSroX missed in canFoldIntoAddrMode
2024-08-15 18:22:52 +08:00
zhongyunde 00443407
33190490c6 [AArch64] merge index address with large offset into base address
A case for this transformation, https://gcc.godbolt.org/z/nhYcWq1WE
Fold
  mov     w8, #56952
  movk    w8, #15, lsl #16
  ldrb    w0, [x0, x8]
into
  add     x0, x0, 1036288
  ldrb    w0, [x0, 3704]

Only LDRBBroX is supported for the first time.
Fix https://github.com/llvm/llvm-project/issues/71917

Note: This PR is try relanding the commit 32878c2065 with fix crash for PR79756
  this crash is exposes when there is MOVKWi instruction in the head of a block,
but without MOVZWi
2024-08-15 18:22:52 +08:00
David Green
36231a5b55
[AArch64] Add verification for MemOp immediate ranges (#97561)
This adds an implementation of AArch64InstrInfo::verifyInstruction for
AArch64, and adds some basic verification of the range of immediate
ranges of memory operations using the information from getMemOpInfo.

Some extra memory operations have been added to getMemOpInfo, along with
the equivalent opcodes to getLoadStoreImmIdx to ensure we use the
correct index.

Please let us know if this starts reporting verification failures, Thanks.
2024-08-15 11:20:20 +01:00
Hans Wennborg
05f6630815 Revert "[Clang] [AST] Fix placeholder return type name mangling for MSVC 1920+ / VS2019+ (#102848)"
It cause builds to start failing with

  Invalid type expected
  UNREACHABLE executed at clang/lib/AST/MicrosoftMangle.cpp:2551!

see comments on the PR.

> Partial fix for https://github.com/llvm/llvm-project/issues/92204.
> This PR just fixes VS2019+ since that is the suite of compilers that I
> require link compatibility with at the moment.
> I still intend to fix VS2017 and to update llvm-undname in future PRs.
> Once those are also finished and merged I'll close out
> https://github.com/llvm/llvm-project/issues/92204.
> I am hoping to get the llvm-undname PR up in a couple of weeks to be
> able to demangle the VS2019+ name mangling.
>
> MSVC 1920+ mangles placeholder return types for non-templated functions
> with "@".
> For example `auto foo() { return 0; }` is mangled as `?foo@@YA@XZ`.
>
> MSVC 1920+ mangles placeholder return types for templated functions as
> the qualifiers of the AutoType followed by "_P" for `auto` and "_T" for
> `decltype(auto)`.
> For example `template<class T> auto foo() { return 0; }` is mangled as
> `??$foo@H@@YA?A_PXZ` when `foo` is instantiated as follows `foo<int>()`.
>
> Lambdas with placeholder return types are still mangled with clang's
> custom mangling since MSVC lambda mangling hasn't been deciphered yet.
> Similarly any pointers in the return type with an address space are
> mangled with clang's custom mangling since that is a clang extension.
>
> We cannot augment `mangleType` to support this mangling scheme as the
> mangling schemes for variables and functions differ.
> auto variables are encoded with the fully deduced type where auto return
> types are not.
> The following two functions with a static variable are mangled the same
> ```
> template<class T>
> int test()
> {
>     static int i = 0; // "?i@?1???$test@H@@YAHXZ@4HA"
>     return i;
> }
>
> template<class T>
> int test()
> {
>     static auto i = 0; // "?i@?1???$test@H@@YAHXZ@4HA"
>     return i;
> }
> ```
> Inside `mangleType` once we get to mangling the `AutoType` we have no
> context if we are from a variable encoding or some other encoding.
> Therefore it was easier to handle any special casing for `AutoType`
> return types with a separate function instead of using the `mangleType`
> infrastructure.

This reverts commit e0d173d44161bf9b68243845666d58999e74f759
and the wollow-up fa343be414f9364911b947f109f3df5539e23068.
2024-08-15 11:48:28 +02:00