Enna1 [Fri, 28 Apr 2023 08:56:40 +0000 (16:56 +0800)]
[hwasan][test] add test for hwasan-check-memaccess when hwasan-match-all-tag flag and short granules both used
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D149399
Andrzej Warzynski [Fri, 28 Apr 2023 08:39:27 +0000 (09:39 +0100)]
Revert "[flang][driver] Allow main program to be in an archive"
This reverts commit
876df74dd47196a9ca3b4fff21ffb5441491a0a0.
My understanding (based on https://reviews.llvm.org/D149429) is that
this patch has caused all of Flang's buildbots to fail. I'm not really
able to verify 100% as the buildbot UI is incredibly slow ATM. I am
reverting either way so that we can discuss the right solution offline.
OCHyams [Fri, 28 Apr 2023 07:46:22 +0000 (08:46 +0100)]
[Assignment Tracking] Check getTypeSizeInBits result for scalable vector types
Without this patch, in `getAssignmentInfo` the result of `getTypeSizeInBits` is
cast to `uint64_t`, which a) is an operation that will eventually be
unsupported by the API according to the comments, and b) causes an assertion
failure if the type is a scalable vector. Don't cast the `TypeSize` to
`uint64_t` and check `isScalable` before getting the fixed size.
This can result in incorrect variable locations, see llvm.org/PR62346 (but is
better than crashing).
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D149137
Fangrui Song [Fri, 28 Apr 2023 07:52:33 +0000 (00:52 -0700)]
MC: Use parseEOL
The diagnostics have changed from "unexpected token" to clearer "expected newline"
Vitaly Buka [Fri, 28 Apr 2023 07:44:46 +0000 (00:44 -0700)]
[NFC][HWASAN] Use named const instead of 0xf
Fangrui Song [Fri, 28 Apr 2023 07:41:58 +0000 (00:41 -0700)]
RISCVAsmParser: Simplify with parseToken. NFC
Vitaly Buka [Fri, 28 Apr 2023 07:24:34 +0000 (00:24 -0700)]
[NFC][HWASAN] Remove unnecessary untag
Looks like HWASAN_ALIASING_MODE work around.
But any tagged pointer should be mapped, so load
should work.
Wang, Xin10 [Fri, 28 Apr 2023 07:02:30 +0000 (03:02 -0400)]
[NFC]Fix 2 logic dead code
First, in CodeGenPrepare.cpp, line 6891, the VectorCond will always be false
because if not function will return at 6888.
Second, in SelectionDAGBuilder.cpp, line 5443, getSExtValue() will return
value as int type, but now we use unsigned Val to maintain it, which make the
if condition at 5452 meaningless.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D149033
Noah Goldstein [Fri, 28 Apr 2023 06:18:20 +0000 (01:18 -0500)]
[ValueTracking] Add logic for `fshl/fshr(A, B, C) != 0` if `A == B && A ! = 0`
Having `A == B` is quite common for rotate patterns.
Alive2 Links:
- https://alive2.llvm.org/ce/z/mPXi9c
- https://alive2.llvm.org/ce/z/UfDHoI
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149372
Noah Goldstein [Wed, 26 Apr 2023 20:45:02 +0000 (15:45 -0500)]
[ValueTracking] Add tests for proving `fshr`/`fshl` is non-zero; NFC
Differential Revision: https://reviews.llvm.org/D149371
Jacob Hegna [Fri, 28 Apr 2023 06:21:46 +0000 (06:21 +0000)]
[MLGO] Replace explicit shape with initializer list.
Vedant Paranjape [Mon, 24 Apr 2023 06:20:12 +0000 (06:20 +0000)]
[IVDescriptors] Add assert to isInductionPhi to check for invalid Phis
Phis that are present inside loop headers can only be Induction Phis
legally. This patch adds an assertion to isInductionPhi which checks for
the said legality and it also updates the docs of the said function to
reflect the given legality.
Differential Revision: https://reviews.llvm.org/D149041
Valentin Clement [Fri, 28 Apr 2023 04:02:11 +0000 (21:02 -0700)]
[flang][openacc] Generate acc.bound op when local array is passed without subscript
Add support to generate the acc.bound operation when the array is passed without
any subscripts. Without this patch, no bound is generated.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D149297
Ben Shi [Wed, 29 Mar 2023 03:55:54 +0000 (11:55 +0800)]
[lld][ELF] Support relocations R_AVR_LO8_LDI_GS/R_AVR_HI8_LDI_GS
Relocations R_AVR_LO8_LDI_GS/R_AVR_HI8_LDI_GS (indirect calls
via function pointers) only cover range 128KiB. They are
equivalent to R_AVR_LO8_LDI_PM/R_AVR_HI8_LDI_PM within this
range.
But for function addresses beyond this range, GNU-ld emits
trampolines. And this patch implements corresponding thunks
for them in lld.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D147364
Thurston Dang [Fri, 28 Apr 2023 02:50:09 +0000 (02:50 +0000)]
[hwasan] Fix -Wunneeded-internal-declaration by declaring static inline
https://reviews.llvm.org/D149386 caused a buildbot error (https://lab.llvm.org/buildbot#builders/37/builds/21766):
'In file included from /b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/lib/hwasan/hwasan_interceptors.cpp:18:
/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/lib/hwasan/hwasan_checks.h:128:53: error: 'static' function 'PossiblyShortTagMatches' declared in header file should be declared 'static inline' [-Werror,-Wunneeded-internal-declaration]
__attribute__((always_inline, nodebug)) static bool PossiblyShortTagMatches('
This patch simply adds the inline annotation.
Differential Revision: https://reviews.llvm.org/D149402
Matthias Springer [Fri, 28 Apr 2023 01:34:03 +0000 (10:34 +0900)]
[mlir][tensor] Add transform to make tensor.pad loop-independent
Add a transform to make `tensor.pad` and `tensor.empty` ops independent of SCF loop IVs. Such ops can then be hoisted.
E.g.:
```
scf.for %iv = %lb to %ub step %step {
%high = affine.apply affine_map<(d0)[s0] -> (s0 - d0)> (%i)[%ub]
%p = tensor.pad %t low[5] high[%high] ...
...
}
```
Is transformed to:
```
%high_new = affine.apply affine_map<()[s0, s1] -> (-s0 + s1)> ()[%lb, %ub]
%p_hoistable = tensor.pad %t low[5] high[%high_new]
%dim = tensor.dim %t, %c0
%size = affine.apply affine_map<(d0)[s0, s1] -> (-d0 + s0 + s1 + 5)>(%iv)[%ub, %dim]
%slice = tensor.extract_slice %p_hoistable [0] [%size] [1]
```
Differential Revision: https://reviews.llvm.org/D143910
Jordan Rupprecht [Fri, 28 Apr 2023 02:16:32 +0000 (19:16 -0700)]
Revert "[CodeGenPrepare] Estimate liveness of loop invariants when checking for address folding profitability"
This reverts commit
5344d8e10bb7d8672d4bfae8adb010465470d51b.
It causes non-determinism when building clang. See the review thread on D143897.
Shao-Ce SUN [Tue, 25 Apr 2023 07:18:29 +0000 (15:18 +0800)]
[flang][driver] Allow main program to be in an archive
Add --undefined=_QQmain to the link line, so that a Fortran main program
will be included in the link job even if it is in an archive (unless we
are building a shared object). For now, this is only applied to the Gnu
toolchain.
We also add a section on the linker invocation to docs/FlangDriver.md.
The new tests require llvm-ar to construct an archive we can include in
the link job. This is a new dependency for flang/test (which already
depends on similar tools such as llvm-objdump).
See discussions in
https://github.com/llvm/llvm-project/issues/54787
which this patch fixes.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D134821
Joseph Huber [Thu, 27 Apr 2023 18:05:29 +0000 (13:05 -0500)]
[libc] Implement `exit` for the GPU partially
This patch implements the `exit` function on the GPU. This required
breaking the entrypoints calling eachother on `linux` since this doesn't
work with a non-aliased target. This is only partial support because
full support requires a malloc / free implementation for the exit
callbacks array.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149363
Joseph Huber [Thu, 27 Apr 2023 01:46:02 +0000 (20:46 -0500)]
[libc] Support the `abs` functions in the GPU libc.
This patch simply enables building the integer `abs` functions for the
GPU.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149317
Joseph Huber [Wed, 26 Apr 2023 23:37:30 +0000 (18:37 -0500)]
[libc] Support the string conversion methods on the GPU
This patch enables us to use the existing `libc` support for string
conversion functions on the GPU. This required setting the `fenv_t` and
long double configuration. As far as I am aware, long doubles are
converted to doubles on the GPU and the floating point environment is
just an `uint32_t`.
This code is still untested as we are still working out how to run the
unit tests on the GPU.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D149306
Eric Fiselier [Fri, 28 Apr 2023 01:04:04 +0000 (21:04 -0400)]
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.
Jim Ingham [Fri, 28 Apr 2023 00:36:31 +0000 (17:36 -0700)]
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
Alexey Bataev [Thu, 27 Apr 2023 23:33:58 +0000 (16:33 -0700)]
[SLP][NFC]Fix a warning because of the missing parens, NFC.
Wu, Yingcong [Thu, 27 Apr 2023 23:46:42 +0000 (16:46 -0700)]
[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
Jacob Hegna [Thu, 27 Apr 2023 23:41:59 +0000 (23:41 +0000)]
[MLGO] Fix build error concerning ScalarShape.
Jeffrey Byrnes [Thu, 27 Apr 2023 15:45:29 +0000 (08:45 -0700)]
[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
Alexander Shaposhnikov [Thu, 27 Apr 2023 23:34:03 +0000 (23:34 +0000)]
[Clang][Sema] Add a temporary workaround in SemaConcept.cpp
This commit adds FIXME and a temporary workaround to repair
CUDA build bots after
e3b1083e00e62f.
Thurston Dang [Thu, 27 Apr 2023 22:05:46 +0000 (22:05 +0000)]
[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
Jacob Hegna [Thu, 27 Apr 2023 21:33:56 +0000 (21:33 +0000)]
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
Manoj Gupta [Wed, 19 Apr 2023 22:49:17 +0000 (15:49 -0700)]
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
Jessica Paquette [Thu, 27 Apr 2023 17:32:36 +0000 (10:32 -0700)]
[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
Caslyn Tonelli [Wed, 26 Apr 2023 22:15:21 +0000 (22:15 +0000)]
[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
Alexander Shaposhnikov [Thu, 27 Apr 2023 21:33:32 +0000 (21:33 +0000)]
[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
60bee9ff5445.
Differential revision: https://reviews.llvm.org/D146178
Tom Honermann [Mon, 24 Apr 2023 20:27:26 +0000 (13:27 -0700)]
[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
Roland McGrath [Thu, 27 Apr 2023 21:18:18 +0000 (14:18 -0700)]
[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
Paul Kirth [Tue, 25 Apr 2023 21:13:51 +0000 (21:13 +0000)]
[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
Nick Desaulniers [Thu, 27 Apr 2023 20:39:54 +0000 (13:39 -0700)]
[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
Nick Desaulniers [Thu, 27 Apr 2023 20:39:45 +0000 (13:39 -0700)]
[CodeGen] precommit machine-latecleanup test
Demonstrates a hazard in machine-latecleanup.
Differential Revision: https://reviews.llvm.org/D149190
LLVM GN Syncbot [Thu, 27 Apr 2023 20:33:13 +0000 (20:33 +0000)]
[gn build] Port
bf199576f931
Nikolas Klauser [Wed, 26 Apr 2023 17:55:41 +0000 (10:55 -0700)]
[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
Mingming Liu [Fri, 21 Apr 2023 06:44:42 +0000 (23:44 -0700)]
[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
Andrew Gozillon [Thu, 27 Apr 2023 19:44:19 +0000 (14:44 -0500)]
[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
Christian Ulmann [Thu, 27 Apr 2023 19:40:23 +0000 (19:40 +0000)]
[PGO] Fix dead StringRef access
This commit fixes a dead StringRef access introduced in
https://reviews.llvm.org/D149324
Joseph Huber [Thu, 27 Apr 2023 19:35:47 +0000 (14:35 -0500)]
[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.
Mircea Trofin [Wed, 26 Apr 2023 21:41:25 +0000 (14:41 -0700)]
[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
Snehasish Kumar [Thu, 27 Apr 2023 18:53:37 +0000 (18:53 +0000)]
[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
Slava Zakharin [Wed, 26 Apr 2023 23:24:10 +0000 (16:24 -0700)]
[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
Noah Goldstein [Thu, 27 Apr 2023 16:03:40 +0000 (11:03 -0500)]
[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
Arthur Eubanks [Thu, 27 Apr 2023 18:41:23 +0000 (11:41 -0700)]
Revert "[MergeICmps] Adapt to non-eq comparisons, bugfix"
This reverts commit
ca94b02e559242e6d1fcdd65320334438be69448.
Causes miscompiles, see D141188
Alan Zhao [Thu, 27 Apr 2023 18:41:09 +0000 (11:41 -0700)]
Fix spacing in ReleaseNotes.rst link
Craig Topper [Thu, 27 Apr 2023 18:21:55 +0000 (11:21 -0700)]
[RISCV] Add a release note for the removal of __attribute__((interrupt("user"))). NFC
This was removed by D149314.
Jonathon Penix [Tue, 25 Apr 2023 21:01:23 +0000 (14:01 -0700)]
[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
Alexey Bataev [Thu, 27 Apr 2023 17:24:00 +0000 (10:24 -0700)]
[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.
Changpeng Fang [Thu, 27 Apr 2023 17:45:11 +0000 (10:45 -0700)]
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
Elliot Goodrich [Thu, 27 Apr 2023 17:43:18 +0000 (13:43 -0400)]
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
Alan Zhao [Wed, 26 Apr 2023 21:50:01 +0000 (14:50 -0700)]
[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]: https://github.com/llvm/llvm-project/blob/
33d6bd1c667456f7f4a9d338a7996a30a3af50a3/clang/lib/Sema/SemaAccess.cpp#L1696
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D149301
Arthur Eubanks [Thu, 27 Apr 2023 17:37:53 +0000 (10:37 -0700)]
[NFC][MachineFunctionPassManager] Remove unused DebugLogging param
ManuelJBrito [Thu, 27 Apr 2023 15:22:57 +0000 (16:22 +0100)]
[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
Alexis Engelke [Wed, 26 Apr 2023 14:26:42 +0000 (16:26 +0200)]
[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
Shubham Sandeep Rastogi [Thu, 27 Apr 2023 16:11:08 +0000 (09:11 -0700)]
Remove unused attributes from move-dbg-values-imm-test.mir
Differential Revision: https://reviews.llvm.org/D149355
Mingming Liu [Tue, 25 Apr 2023 05:13:30 +0000 (22:13 -0700)]
[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
Jean Perier [Thu, 27 Apr 2023 16:35:51 +0000 (18:35 +0200)]
[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
Alexey Bataev [Thu, 27 Apr 2023 16:00:21 +0000 (09:00 -0700)]
[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.
Nikolas Klauser [Fri, 13 Jan 2023 20:12:54 +0000 (21:12 +0100)]
[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
Martin Storsjö [Fri, 14 Apr 2023 08:37:24 +0000 (08:37 +0000)]
[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
e78223e79efc886ef6f0ea5413deab3737d6d63b. (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
Martin Storsjö [Thu, 27 Apr 2023 07:11:05 +0000 (10:11 +0300)]
[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
b8b23aa80eefe84187d6ba364d06496c90c53bdb
(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
Martin Storsjö [Thu, 6 Apr 2023 08:19:06 +0000 (11:19 +0300)]
[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
David Green [Thu, 27 Apr 2023 16:21:13 +0000 (17:21 +0100)]
[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.
Christian Ulmann [Thu, 27 Apr 2023 16:04:51 +0000 (16:04 +0000)]
[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
Jay Foad [Thu, 27 Apr 2023 15:58:41 +0000 (16:58 +0100)]
[SimplifyCFG] Remove some unnecessary TTI arguments. NFC.
TTI was already available in the SimplifyCFGOpt class.
Kiung Jung [Thu, 27 Apr 2023 15:52:59 +0000 (15:52 +0000)]
[MLIR][EmitC] Add empty emitc.constant check
Implementing logic to check if the emitc dialect constant Op is empty.
Reviewed By: marbre
Differential Revision: https://reviews.llvm.org/D147907
Ulrich Weigand [Thu, 27 Apr 2023 15:49:32 +0000 (17:49 +0200)]
[LLD][ELF] Fix compressed-debug-level test on SystemZ
The libz compression library on SystemZ by default makes use of the
platform's hardware-accelerated compression facility. This is much
faster than the regular software implementation, but often results in
slightly different outputs. This causes failures with the
compressed-debug-level test case.
To fix this, run this test while setting the DFLTCC environment
variable to zero, which prevents use of hardware compression and falls
back to the software implementation. (This should not have any effect
on other platforms.)
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D149273
Ulrich Weigand [Thu, 27 Apr 2023 15:45:25 +0000 (17:45 +0200)]
Fix PDB relocation on big-endian hosts
When running the LLD test suite on a big-endian host, the
COFF/pdb-framedata.yaml test case currently fails.
As it turns out, this is because code in DebugSHandler::finish
intended to relocate RvaStart entries of FDO records does not
work correctly when compiled for a big-endian host.
Fixed by always reading file data in little-endian mode.
Reviewed By: aganea
Differential Revision: https://reviews.llvm.org/D149268
Akash Banerjee [Thu, 27 Apr 2023 15:26:29 +0000 (15:26 +0000)]
[MLIR][OpenMP] Use inlineConvertOmpRegions for targetData conversion
Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Reviewed By: TIFitis
Differential Revision: https://reviews.llvm.org/D149153
Kiung Jung [Thu, 27 Apr 2023 15:22:23 +0000 (15:22 +0000)]
Disallow to apply the op & to const
Disallow to apply the operator & (address of) to emitc.constant operations.
Reviewed By: marbre, simon-camp
Differential Revision: https://reviews.llvm.org/D147992
Craig Topper [Thu, 27 Apr 2023 15:26:11 +0000 (08:26 -0700)]
[LegalizeVectorOps] Use all ones mask when expanding i1 VP_SELECT.
We were previously using the condition as the mask. By the semantics
of VP operations, that means that anywhere the condition is false
returns poison and not the false operand.
Use an all ones mask instead.
No tests are affected because RISC-V drops the mask when lowering.
Reviewed By: fakepaper56
Differential Revision: https://reviews.llvm.org/D149310
Mark de Wever [Thu, 20 Apr 2023 19:03:39 +0000 (21:03 +0200)]
[libc++] Adds newer clang-tidy in the CI.
In order to use clang-tidy for modules version 17 is required. Some of the
development fixes haven't been backported. This adds the new version to
the CI so it can be used in a follow-up patch.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D148831
Jakub Kuderski [Thu, 27 Apr 2023 15:13:46 +0000 (11:13 -0400)]
[mlir][arith] Add missing canon pattern `trunci(ext*i(x)) -> ext*i(x)`
This pattern triggers when only the extension bits are truncated.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D149286
Craig Topper [Thu, 27 Apr 2023 15:21:24 +0000 (08:21 -0700)]
[RISCV] Remove support for attribute interrupt("user").
This was part of the N extension which didn't make it version
1.12 of the privilege specification.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D149314
Mark de Wever [Thu, 20 Apr 2023 19:40:36 +0000 (21:40 +0200)]
[libc++][chrono] Adds formatter file_time.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D148928
LLVM GN Syncbot [Thu, 27 Apr 2023 15:07:24 +0000 (15:07 +0000)]
[gn build] Port
9d16cbc5c8bd
Mark de Wever [Thu, 20 Apr 2023 19:03:40 +0000 (21:03 +0200)]
[libc++] Adds more forward declaration headers.
The module validation script of D144994 validate whether the contents of
an include match its module. An include is the set of files matching the
pattern:
- foo
- foo/*.
- __fwd/foo.h
Several declarations of the stream headers are in the header iosfwd.
This gives issue using the validation script. Adding iosfwd to the set
of matching files gives too many declarations. For example when
validating the fstream header it will pull in declarations of the
istream header. Instead if writing a set of filters the headers are
granularized into smaller headers containing the expected declarations.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D148927
Louis Dionne [Wed, 26 Apr 2023 20:35:13 +0000 (16:35 -0400)]
[libc++] Fix ODR violation with placeholders
In D145589, we made the std::bind placeholders inline constexpr to
satisfy C++17. It turns out that this causes ODR violations since the
shared library provides strong definitions for those placeholders, and
the linker on Windows actually complains about this.
Fortunately, C++17 only encourages implementations to use `inline constexpr`,
it doesn't force them. So instead, we unconditionally define the placeholders
as `extern const`, which avoids the ODR violation and is indistinguishable
from `inline constexpr` for most purposes, since the placeholders are
empty types anyway.
Note that we could also go back to the pre-D145589 state of defining them
as non-inline constexpr variables in C++17, however that is definitely
non-conforming since that means the placeholders have different addresses
in different TUs. This is all a bit pedantic, but all in all I feel that
`extern const` provides the best bang for our buck, and I can't really
find any downsides to that solution.
Differential Revision: https://reviews.llvm.org/D149292
Andrew Gozillon [Thu, 27 Apr 2023 14:10:34 +0000 (09:10 -0500)]
[MLIR][OpenMP][test] Update omp::FlagsAttr tests to only use CHECK tests
The CHECK-NOT tests were incorrect and impacting the other
tests flag tests negatively, they'd pass as false positives.
Andrew Gozillon [Thu, 27 Apr 2023 13:18:57 +0000 (08:18 -0500)]
[MLIR][OpenMP] Add check for appropriate module operation during convertFlagsAttr
Checks if the operation the attirbute resides on is an ModuleOp otherwise it fails.
Nico Weber [Thu, 27 Apr 2023 14:12:39 +0000 (10:12 -0400)]
[clang] Try to fix check-clang after
f539b6ffc251
Christian Ulmann [Thu, 27 Apr 2023 14:06:26 +0000 (14:06 +0000)]
[PGO] Move CFGMST.h into the include directory
This commit moves the CFGMST.h file into the include directory. The
implemented algorithm is can be helpful for downstream projects that
want to use the PGO data in a non-standard way.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D149336
Nikita Popov [Thu, 27 Apr 2023 14:08:34 +0000 (16:08 +0200)]
[Polly] Update polly test after SCEV changes
Make the phi non-trivial, so SCEV can't see through it.
skc7 [Tue, 3 Jan 2023 12:01:58 +0000 (17:31 +0530)]
[AMDGPU] Legalize soffset of buffer instructions. Use Waterfall loop logic.
Legalize soffset of buffer instructions using waterfall loop.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D141030
Zequan Wu [Thu, 27 Apr 2023 14:01:56 +0000 (10:01 -0400)]
Revert "[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols"
This reverts commit
10c17c97ebaf81ac26f6830e51a7a57ddcf63cd2. It causes undefined symbol error on chromium windows build. A small repro was uploaded to the code review.
Akash Banerjee [Thu, 27 Apr 2023 13:47:42 +0000 (14:47 +0100)]
[MLIR][OpenMP][NFC] Minor code cleanup
Cleanup how the IsBegin argument is passed and removed unnecessary variable.
Jingu Kang [Thu, 27 Apr 2023 13:31:40 +0000 (14:31 +0100)]
[AArch64] Precommit tests for VECTOR_SHUFFLE
ManuelJBrito [Wed, 26 Apr 2023 13:19:12 +0000 (14:19 +0100)]
[IR] Change shufflevector undef mask to poison
With this patch an undefined mask in a shufflevector will be printed as poison.
This change is done to support the new shufflevector semantics
for undefined mask elements.
Differential Revision: https://reviews.llvm.org/D149210
Zhongyunde [Thu, 27 Apr 2023 13:32:28 +0000 (21:32 +0800)]
[InstCombine] Add frozen for the condition value of SelectInst
If the condition value of SelectInst may be a poison or undef value,
infer constant range at SelectInst use is incorrect, similar to D143883.
Fixes https://github.com/llvm/llvm-project/issues/62401
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149339
Erich Keane [Thu, 27 Apr 2023 13:31:46 +0000 (06:31 -0700)]
[NFC] Add tests from my fix for GH62362.
This ended up being fixed separately by @rsmith in
1e43349e3 in a
better/correct way. This patch adds the tests from the original, as
though they are reasonably covered in his patch, explicit versions seem
to have value here.
Additionally, this adds a release note for
1e43349e3.
Nikita Popov [Thu, 27 Apr 2023 10:57:28 +0000 (12:57 +0200)]
[SCEV] Drop LCSSA check in createNodeFromSelectLikePHI()
SCEV expressions no longer try to preserve LCSSA form. SCEV
construction will try to look through LCSSA phi nodes. As such,
we also no longer need to limit this special-case fold.
Nikita Popov [Thu, 27 Apr 2023 13:05:03 +0000 (15:05 +0200)]
[SCEV] Try simplifying phi before createNodeFromSelectLikePHI()
Sometimes a phi can both be trivial and match the
createNodeFromSelectLikePHI() fold. In that case it is generally
more profitable to look through the phi node.
Haojian Wu [Thu, 27 Apr 2023 12:57:40 +0000 (14:57 +0200)]
[clangd] Fix the include-cleaner-batch-fix.test failure on some
platforms
It seems that on some platforms, the spelling include doesn't work. Make
the test less strict on it.
OCHyams [Thu, 27 Apr 2023 12:44:12 +0000 (13:44 +0100)]
[DebugInfo][InstCombine] Fix missing source and variable locations after foldOpIntoPhi
Reviewed By: fdeazeve
Differential Revision: https://reviews.llvm.org/D149335