Commit Graph

459473 Commits

Author SHA1 Message Date
Eric Fiselier
db381405ce Fix EBO on std::optional and std::variant when targeting the MSVC ABI
Committing on behalf of davidben. Reviewed as D146190

Patch originally by Jan Dörrie in https://reviews.llvm.org/D120064. I've just updated it to include tests, and update documentation that MSVC ABI is not stable.

In the current implementation both `std::optional` and `std::variant` don't perform the EBO on MSVC's ABI. This is because both classes inherit from multiple empty base classes, which breaks the EBO for MSVC. This patch fixes this issue by applying the `empty_bases` declspec attribute, which is already used to fix a similar issue for `std::tuple`.

See https://reviews.llvm.org/D120064 for discussion on MSVC ABI stability. From the discussion, libc++ doesn't have users that expect a stable ABI on MSVC. The fix is thus applied unconditionally to benefit more users. Documentation has been updated to reflect this.

Fixes https://github.com/llvm/llvm-project/issues/61095.
2023-04-27 21:04:04 -04:00
Jim Ingham
47f72aede1 Make the TSan report capture data structure anonymous.
This was using `struct data` which is way to common a name to use in
an lldb expression, and was causing occasional failures in the
TSan report gatherer.  The structure doesn't need to have a tag,
so remove it to avoid future problems.

The same job was done for the other sanitizers in D145569, but this
one was overlooked.

Differential Revision: https://reviews.llvm.org/D149394
2023-04-27 17:36:31 -07:00
Alexey Bataev
8bacd75125 [SLP][NFC]Fix a warning because of the missing parens, NFC. 2023-04-27 16:59:37 -07:00
Wu, Yingcong
1a8aab6de5 [sanitizer] use the right type for sizeof
`x_aliases` is an array of string, so to calculate its size, it should
be <size-of-array> times <size-of-element>, which should be
`sizeof(char*)` instead of `sizeof(char**)`.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D149242
2023-04-27 16:56:22 -07:00
Jacob Hegna
cc781a4e27 [MLGO] Fix build error concerning ScalarShape. 2023-04-27 23:52:36 +00:00
Jeffrey Byrnes
7f0a881e6c [AMDGPU] Track liveins for max-ilp-sched-strategy
Even if optimizing for ILP, it is still useful to track RP to avoid spilling. Given that, we need to maintin consistent liveness state with the RP tracker. This patch makes RP tracking consistent by updating for liveins.

Otherwise, we should completely eliminate RP tracking for this scheduler (checkScheduling, initCandidate).

Differential Revision: https://reviews.llvm.org/D149358
2023-04-27 16:45:45 -07:00
Alexander Shaposhnikov
ce861ec782 [Clang][Sema] Add a temporary workaround in SemaConcept.cpp
This commit adds FIXME and a temporary workaround to repair
CUDA build bots after e3b1083e00.
2023-04-27 23:34:03 +00:00
Thurston Dang
de79b0baa1 [hwasan] Enable common syscall interceptors
This adds the sanitizer_common syscall hooks to HWASan and also defines
the COMMON_SYSCALL_PRE_{READ/WRITE}_RANGE macros.

Differential Revision: https://reviews.llvm.org/D149386
2023-04-27 23:13:29 +00:00
Jacob Hegna
f9b3e3411c Adjust macros which define the ML inlining features.
This aligns the inlining macros more closely with how the regalloc
macros are defined.

 - Explicitly specify the dtype/shape
 - Remove separate names for python/C++
 - Add docstring for inline cost features

Differential Revision: https://reviews.llvm.org/D149384
2023-04-27 22:47:12 +00:00
Manoj Gupta
be5f35e24f lldb: Fix usage of sve functions on arm64
Use correct internal sve functions for arm64.
Otherwise, when cross-compling lld for AArch64 there are build
errors like:
NativeRegisterContextLinux_arm64.cpp:936:11:
   error: use of undeclared identifier 'sve_vl_valid
NativeRegisterContextLinux_arm64.cpp:63:28:
    error: variable has incomplete type 'struct user_sve_header'

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D148752
2023-04-27 14:59:49 -07:00
Jessica Paquette
17cfd2e025 [profiling] Improve error message for raw profile header mismatches
When a user uses a mismatched clang + llvm-profdata, they didn't get a very
informative error message. It would just say "unsupported version".

As a result, users are often confused as to what they are supposed to do and
tend to assume that it's a bug in the profiling runtime.

This patch improves the error message by:

- Adding a new class of error (`raw_profile_version_mismatch`) to make it clear
  that, specifically, the *raw profile* version is unsupported because of a
  tool mismatch.

- Adding an error message that tells the user which raw profile version was
  encountered, which version was expected, and instructs them to align their
  tool versions.

To support this, this patch also updates `InstrProfError::take` to also
propagate the optional error message.

Differential Revision: https://reviews.llvm.org/D149361
2023-04-27 14:51:38 -07:00
Caslyn Tonelli
43ba321096 [gwp_asan] Exclude recoverable tests on Fuchsia
Signal handlers used by recoverable tests are unsupported on Fuchsia.

Exclude the set of tests that test recoverable code paths (i.e.
BacktraceGuardedPoolAllocator tests in recoverable.cpp) and always set
the `Recoverable` testing bool to `false` on the Fuchsia platform.

Differential Revision: https://reviews.llvm.org/D149311
2023-04-27 21:51:30 +00:00
Alexander Shaposhnikov
e3b1083e00 [Clang][Sema] Fix comparison of constraint expressions
This diff switches the approach to comparison of constraint expressions
to the new one based on template args substitution.
It continues the effort to fix our handling of out-of-line definitions
of constrained templates.
This is a recommit of 60bee9ff54.

Differential revision: https://reviews.llvm.org/D146178
2023-04-27 21:33:32 +00:00
Tom Honermann
a68039c51e [Clang] Add tests and mark as implemented WG14-N2728
This change expands testing of UTF-8, UTF-16, and UTF-32 character and string
literals as validation that WG14 N2728 (char16_t & char32_t string literals
shall be UTF-16 & UTF-32) has been implemented.

Reviewed By: cor3ntin, aaron.ballman

Differential Revision: https://reviews.llvm.org/D149098
2023-04-27 14:25:41 -07:00
Roland McGrath
484e64f7e7 [libc++] Use __is_convertible built-in when available
https://github.com/llvm/llvm-project/issues/62396 reports that
GCC 13 barfs on parsing <type_traits> because of the declarations
of `struct __is_convertible`.  In GCC 13, `__is_convertible` is a
built-in, but `__is_convertible_to` is not.  Clang has both, so
using either should be fine.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D149313
2023-04-27 14:23:43 -07:00
Paul Kirth
61976af3ba [clang][driver] Enable MisExpect diagnostics flag outside of CC1
Previously we only accepted the `-fdiagnostics-misexpect-tolerance=` at
CC1, when it should have been handled identically to
`-fdiagnostics-hotness-threshold=`. It should not have been required to
pass this flag w/ `-Xclang` as reported here:
https://reviews.llvm.org/D115907#inline-1440745

Reviewed By: hans, phosek

Differential Revision: https://reviews.llvm.org/D149206
2023-04-27 21:19:46 +00:00
Nick Desaulniers
012ea747ed [CodeGen][MachineLastInstrsCleanup] fix INLINEASM_BR hazard
If the removable definition resides in an INLINEASM_BR target, the
reuseable candidate might not dominate the INLINEASM_BR.

   bb0:
      INLINEASM_BR &"" %bb.1
      renamable $x8 = MOVi64imm 29273397577910035
      B %bb.2
      ...
    bb1:
      renamable $x8 = MOVi64imm 29273397577910035
      renamable $x8 = ADDXri killed renamable $x8, 2048, 0
    bb2:

Removing the second mov is a hazard when the inline asm branches to bb1.

Skip such replacements when the to be removed instruction is in the
target of such an INLINEASM_BR instruction.

We could get more aggressive about this in the future, but for now
simply abort.

This is causing a boot failure on linux-4.19.y branches of the LTS Linux
kernel for ARCH=arm64 with CONFIG_RANDOMIZE_BASE=y (KASLR) and
CONFIG_UNMAP_KERNEL_AT_EL0=y (KPTI).

Link: https://reviews.llvm.org/D123394
Link: https://github.com/ClangBuiltLinux/linux/issues/1837

Thanks to @nathanchance for the report, and @ardb for debugging.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D149191
2023-04-27 13:40:00 -07:00
Nick Desaulniers
095a0c67bb [CodeGen] precommit machine-latecleanup test
Demonstrates a hazard in machine-latecleanup.

Differential Revision: https://reviews.llvm.org/D149190
2023-04-27 13:39:48 -07:00
LLVM GN Syncbot
d1c2034cce [gn build] Port bf199576f9 2023-04-27 20:33:13 +00:00
Nikolas Klauser
bf199576f9 [libc++][PSTL][NFC] Rename to pstl/ to __pstl/
Reviewed By: ldionne, #libc

Spies: sstefan1, pcwang-thead, jplehr, libcxx-commits, arichardson, mgrang, miyuki

Differential Revision: https://reviews.llvm.org/D149275
2023-04-27 13:33:03 -07:00
Mingming Liu
b3cb950cf3 [PGO]Implement metadata combine for 'branch_weights' of direct
callsites when none of the instructions folds the rest away.

- Merge cases are added for simplify-cfg {sink,hoist}, based on https://gcc.godbolt.org/z/avGvc38W7 and https://gcc.godbolt.org/z/dbWbjGhaE
- When one instruction folds the others in, do not update branch_weights
  with sum (see test/Transforms/GVN/calls-readonly.ll)

Differential Revision: https://reviews.llvm.org/D148877
2023-04-27 13:04:17 -07:00
Andrew Gozillon
f478721231 [MLIR][LLVM] Add accessor for LLVMModule and invoke convertDialectAttributes on GlobalOps
This patch seeks to do two things add an accessor method to
retrieve the ModuleTranslations contained LLVM Module for direct
usage by dialects that are being lowered to LLVM-IR. One particular
use case for this is in the OpenMP Dialect, when interfacing
with the OMPIRBuilder in certain cases it is useful to be able
to access the LLVM Module directly.

The second is invoking convertDialectAttributes on GlobalOp's
so as to be able to lower dialect specific attributes that are
applied or lowered onto GlobalOp's.

Reviewers: ftynse

Differential Revision: https://reviews.llvm.org/D149279
2023-04-27 14:51:54 -05:00
Christian Ulmann
c67079f1be [PGO] Fix dead StringRef access
This commit fixes a dead StringRef access introduced in
https://reviews.llvm.org/D149324
2023-04-27 19:42:56 +00:00
Joseph Huber
efe5e2bbb6 [libc] Add more missing GPU utilities
Summary:
This patch adds a way to get the total number of blocks and implement
the wave sync intrinsic for AMDGPU. This is a no-op, but that may change
in the future so we might as well implement it right.
2023-04-27 14:37:00 -05:00
Mircea Trofin
460ea85014 [nfc][thinlto] Handle global constant importing separately
This makes the logic for referenced globals reusable for import criteria
that don't use thresholds - in fact, we currently didn't consider any
thresholds when importing.

Differential Revision: https://reviews.llvm.org/D149298
2023-04-27 12:21:50 -07:00
Snehasish Kumar
1176d97598 [memprof][NFC] Update a stale comment about symbolization.
Symbolization of position independent code was added in D146181. Update
the comment to note that the checks below are to sanity check the
assumptions we make to simplify symbolization.

Differential Revision: https://reviews.llvm.org/D149370
2023-04-27 18:59:33 +00:00
Slava Zakharin
882e5f7bb7 [flang][hlfir] Fixed passing c_ptr arguments by value.
c_ptr arguments passed by value need special handling, which was missing
in HLFIR lowering. The lowering has to load the __address component
and pass the loaded value as the actual argument.

Differential Revision: https://reviews.llvm.org/D149307
2023-04-27 11:54:33 -07:00
Noah Goldstein
d8e9dd33b2 [ValueTracking] Add logic for udiv x,y != 0 if y u<= x
Alive2 Link:
        https://alive2.llvm.org/ce/z/2DKh46

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D149203
2023-04-27 13:48:41 -05:00
Arthur Eubanks
3db8ae1f68 Revert "[MergeICmps] Adapt to non-eq comparisons, bugfix"
This reverts commit ca94b02e55.

Causes miscompiles, see D141188
2023-04-27 11:46:36 -07:00
Alan Zhao
3e22eb36b6 Fix spacing in ReleaseNotes.rst link 2023-04-27 11:41:21 -07:00
Craig Topper
0e02e5decc [RISCV] Add a release note for the removal of __attribute__((interrupt("user"))). NFC
This was removed by D149314.
2023-04-27 11:22:21 -07:00
Jonathon Penix
524ceecd89 [flang] Add Clang CMake modules path for Decimal library
This fixes an error that clang_target_link_libraries is unknown
when building the Decimal library standalone--this is the same
as D149090, just for the Decimal library (vs the runtime).

I was still seeing this error for the Decimal library and didn't
see a corresponding patch--apologies in advance if I missed one
or if this is a duplicate!

Differential Revision: https://reviews.llvm.org/D149277
2023-04-27 11:05:28 -07:00
Alexey Bataev
1604a100f1 [SLP][NFC]Avoid extra useless ConstantVector creation, use PointerUnion
instead, NFC.

Better to use PointerUnion<Value *, const TreeEntry *> instead of extra
attempts of creating null vector values, where possible.
2023-04-27 10:48:14 -07:00
Changpeng Fang
1ab8b9ae15 AMDGPU: Define sub-class of SGPR_64 for tail call return
Summary:
  Registers for tail call return should not be clobbered by callee.
So we need a sub-class of SGPR_64 (excluding callee saved registers (CSR)) to hold
the tail call return address.

Because GFX and C calling conventions have different CSR, we need to define
the sub-class separately. This work is an extension of D147096 with the
consideration of GFX calling convention.

Based on the calling conventions, different instructions will be selected with
different sub-class of SGPR_64 as the input.

Reviewers: arsenm, cdevadas and sebastian-ne

Differential Revision: https://reviews.llvm.org/D148824
2023-04-27 10:45:11 -07:00
Elliot Goodrich
d7354fb634 Keep multiple-include optimization for null directives
The multiple-include optimization allows Clang to avoid opening a
files when they contain #pragma once or a proper include guard.

Both GCC and Microsoft Visual Studio allow null directives outside of
the #ifndef/#endif pair without disabling this multiple-include
optimization. GCC documents this behavior here
https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html.

> There must be no directives outside the controlling directive pair,
> but the null directive (a line containing nothing other than a
> single '#' and possibly whitespace) is permitted.

However, Clang disables the multiple-include optimization when
encountering the null directive.

In particular, this slows down preprocessing of most projects that
depend on boost as many boost libraries depend on the boost
preprocessor library, which contains null directives outside the
include guard on every header file.

Differential Revision: https://reviews.llvm.org/D147928
2023-04-27 13:44:11 -04:00
Alan Zhao
7417e9d75c [clang] Fix a crash with parenthesized aggregate initialization and base classes
When calling InitializeBase(...), TryOrBuidlParenListInit(...) needs to
pass in the parent entity; otherwise, we erroneously try to cast
CurContext to a CXXConstructorDecl[0], which can't be done since we're
performing aggregate initialization, not constructor initialization.

Field initialization is not affected, but this patch still adds some
tests for it.

Fixes 62296

[0]: 33d6bd1c66/clang/lib/Sema/SemaAccess.cpp (L1696)

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D149301
2023-04-27 10:43:16 -07:00
Arthur Eubanks
48ed7c4389 [NFC][MachineFunctionPassManager] Remove unused DebugLogging param 2023-04-27 10:38:11 -07:00
ManuelJBrito
d22edb9794 [IR][NFC] Change UndefMaskElem to PoisonMaskElem
Following the change in shufflevector semantics,
poison will be used to represent undefined elements in shufflevector masks.

Differential Revision: https://reviews.llvm.org/D149256
2023-04-27 18:01:54 +01:00
Alexis Engelke
1e743732e7 [RegAllocFast] Use uint16_t SparseT for LiveRegMap
For functions with very large numbers of live variables, lookups into
LiveRegMap previously detoriated to linear searches.

This slightly increases memory usage, but that is barely measurable.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D149330
2023-04-27 18:58:49 +02:00
Shubham Sandeep Rastogi
7fde0b2fa1 Remove unused attributes from move-dbg-values-imm-test.mir
Differential Revision: https://reviews.llvm.org/D149355
2023-04-27 09:42:20 -07:00
Mingming Liu
4ab76b77ce [AArch64][InlineAsm]Add Clang support for flag output constraints
- Mention this change in Clang release notes

Before:
- Clang emits "invalid output constraint '=@cceq' in asm" https://gcc.godbolt.org/z/b9crfEo8h

After:
- For aarch64 targets (with __aarch64__ defined), Clang validates and parses flag output constraints to generate LLVM IR.

Differential Revision: https://reviews.llvm.org/D149123
2023-04-27 09:39:08 -07:00
Jean Perier
cd319489e9 [flang][lowering] Do not instantiate component symbols used in spec expr
Lowering analyse specification expressions in order to create order the
symbol instantiations in the IR (If symbol B is used in the
specification expression of A, symbol B must be instantiated first).

This analysis was mistakenly collecting component symbols used in
component references inside specification expressions, which led
lowering to instantiate component symbols as if they were local
objects.

This patch prevents collecting component symbols during this analysis.

Differential Revision: https://reviews.llvm.org/D149328
2023-04-27 18:36:53 +02:00
Alexey Bataev
cf792f664a [SLP]Fix a crash for the replaced vectorized value.
If two nodes share the same value, which is replaced in one of the
nodes, need to automatically replace same value in all nodes. Btter to
use WeakTrackingVH for this to fix compiler crash.
2023-04-27 09:32:00 -07:00
Nikolas Klauser
1e9f7079de [libc++][PSTL][NFC] clang-format files
Reviewed By: ldionne, #libc

Spies: sstefan1, pcwang-thead, jplehr, libcxx-commits, arichardson, mgrang

Differential Revision: https://reviews.llvm.org/D141781
2023-04-27 09:28:57 -07:00
Martin Storsjö
ba3bddb6f4 [libcxx] [test] Prepend to PATH instead of overriding it
On Windows, the PATH env variable is used for locating dynamically
linked librarys, akin to LD_LIBRARY_PATH on Linux.

The tests that run with a dynamically linked libc++ used "--env
PATH=%{lib}" in the test config. This had the unfortunate side effect
of making other tools from PATH unavailable during the runtime of the
tests; in particular, it caused the "executor-has-no-bash" flag to be
set for all those Windows test configs (with the clang-cl static config
being the only one lacking it).

Thus, this increases the number of tests actually included in the
clang-cl dll and all mingw test configs by 9 tests.

The clang-cl static test configuration has been executing those tests
since the "--env PATH=%{lib}" was removed from that test config in
e78223e79e. (For mingw we haven't had a
need to split the test config between shared and static, which means
that the mingw static test config previously ran with --env PATH
needlessly.)

This increases the test coverage for patches like D146398 which
can't be executed in the executor-has-no-bash configs.

Change the default value of the arg.env to an empty array; when we do
pass values to the option, they get passed as an array of strings,
so make sure the variable behaves consistently when no arguments
have been passed.

Differential Revision: https://reviews.llvm.org/D148324
2023-04-27 19:25:59 +03:00
Martin Storsjö
eb5f9a5a52 [libcxx] [test] Unbreak passing multiple env variables in ssh.py
No test actually does this, but this makes the option behave like
the corresponding one in run.py.

This was broken by commit b8b23aa80e
(https://reviews.llvm.org/D99242) which introduced quoting; instead
of quoting the whole space separated list, quote each individual
argument.

Differential Revision: https://reviews.llvm.org/D149319
2023-04-27 19:25:59 +03:00
Martin Storsjö
1ec4e139ef [libcxx] [test] Print the failing commands in Configuration{Compilation,Runtime}Error
This allows for easier debugging of the test environment when something
fails.

Differential Revision: https://reviews.llvm.org/D145807
2023-04-27 19:24:35 +03:00
David Green
4249d609ac [AArch64] Regenerate trunc-to-tbl and zext-to-tbl tests. NFC
The -mattr=+global-isel is not valid syntax, so those lines have been removed.
With Global-ISel there is currently missing vector legalization for wide G_EXT,
and it does not support BE.
2023-04-27 17:21:13 +01:00
Christian Ulmann
d8e15dc4ae [PGO] Minor instrumentation code cleanup (NFC)
This commit cleans up some parts of the PGO instrumentation. Most
importantly, it removes a template parameter shadowing of a class name
that could lead to confusion.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D149324
2023-04-27 16:10:10 +00:00
Jay Foad
ee88cd82a9 [SimplifyCFG] Remove some unnecessary TTI arguments. NFC.
TTI was already available in the SimplifyCFGOpt class.
2023-04-27 17:05:14 +01:00