Cyndy Ishida [Fri, 24 Feb 2023 18:46:51 +0000 (10:46 -0800)]
[llvm][NFC] Move tapi tests using nm to llvm-nm test directory
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D144658
Aaron Ballman [Fri, 24 Feb 2023 18:52:41 +0000 (13:52 -0500)]
[C2x] Remove the ATOMIC_VAR_INIT macro from stdatomic.h
This implements WG14 N2886 (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2886.htm)
which removed the macro entirely. (NB the macro was deprecated in C17.)
As the paper is not particularly clear on what alternative was picked,
here are my notes from the May 2022 meeting:
Does WG14 wish to adopt variant 1, change 3.2, 3.3, and 3.4 from N2886
into C23?
14/2/2 (consensus)
Does WG14 want to exchange Variant 1 with Variant 2 in N2886 in C23?
9/3/6 (consensus)
(There was no sentiment in the room for either Variant 3 or Variant 4
so those were not voted on.)
Does WG14 want to integrate change 3.5 in N2886 into C23?
8/1/9 (consensus)
Does WG14 want to integrate change 3.6 in N2886 into C23?
2/5/9 (no consensus)
Any code that is broken by the removal can remove the use of
ATOMIC_VAR_INIT and use regular initialization instead.
Differential Revision: https://reviews.llvm.org/D144196
Tue Ly [Fri, 24 Feb 2023 18:35:52 +0000 (13:35 -0500)]
[libc][math] Fix floating point exception testing macros in FPMatcher.h for
aarch64.
Akira Hatanaka [Fri, 24 Feb 2023 18:32:42 +0000 (10:32 -0800)]
[CodeGen] Stop storing alignment information into pointers in Address
This reverts
b1613f05ae0ce4efc6b6475ea4459957ebcb0150. The change was
made in an attempt to reduce memory consumption by storing the alignment
information into pointers, but it turns out it doesn't make much
difference.
https://llvm-compile-time-tracker.com/compare.php?from=
998ad085e865f2e5acc589d6bee0e3379042da2e&to=
5de4a1989c474f37ac03f20ccb0aef50f6e3b854&stat=max-rss
This fixes a bug introduced in https://reviews.llvm.org/D142584. The
patch reduced the number of bits used for alignment from 6 bits to 5
bits, which made it impossible to encode the maximum allowed alignment
in llvm (1 << 32).
Differential Revision: https://reviews.llvm.org/D144686
Vitaly Buka [Fri, 24 Feb 2023 18:04:26 +0000 (10:04 -0800)]
Revert "[InstCombine] Remove early constant fold"
Increase compile time with ubsan ARM from 3 to 14 min single file.
I upload reproducer into D144369.
Also we have random timeouts on internal x86_64 builds.
Both bisected to this one.
This reverts commit
45a0b812fa13ec255cae91f974540a4d805a8d79.
Tue Ly [Sun, 19 Feb 2023 02:33:46 +0000 (21:33 -0500)]
[libc][math] Set floating point exceptions for exp*f, sinhf, and coshf.
Set FE_OVERFLOW and FE_UNDERFLOW for expf, exp2f, exp10f, expm1f, sinhf
and coshf.
Reviewed By: sivachandra, renyichen
Differential Revision: https://reviews.llvm.org/D144340
Craig Topper [Fri, 24 Feb 2023 17:36:58 +0000 (09:36 -0800)]
[RISCV] Use ComplexPattern to reduce the number of patterns for XVentanaCondOps.
XVentanaCondOps check the condition operand for zero or non-zero.
We use this to optimize seteq/setne that would otherwise becomes
xor/xori/addi+snez/seqz. These patterns avoid the snez/seqz.
This patch adds two ComplexPatterns to match the varous cases and
emit the xor/xori/addi instruction.
These patterns can also be used by D144681.
Reviewed By: philipp.tomsich
Differential Revision: https://reviews.llvm.org/D144700
Arthur Eubanks [Thu, 23 Feb 2023 21:19:08 +0000 (13:19 -0800)]
[clang][Driver] Pass /INFERASANLIBS:NO to link.exe under -fsanitize=address
With recent MSVC releases, STL headers will add /INFERASANLIBS to the drectve section of object files that are compiled with clang. With this flag, link.exe will automatically attempt to look for asan libs.
When using clang as the driver to invoke the linker, we want to disable this feature because we explicitly pass the proper asan libraries, otherwise we get symbols defined multiple times.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D144684
Markus Böck [Fri, 24 Feb 2023 15:59:46 +0000 (16:59 +0100)]
[mlir][NVGPUToNVVM] Add option for emitting opaque pointers
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
The 'use-opaque-pointers' options, when enabled, changes the patterns to emit opaque pointers instead of typed pointers. As part of the migration effort the test have been converted to typed pointers, with an extra file for testing just typed pointers specific code paths.
Differential Revision: https://reviews.llvm.org/D144736
David Spickett [Fri, 24 Feb 2023 16:37:14 +0000 (16:37 +0000)]
Revert "[clang-tidy] handle exceptions properly in `ExceptionAnalyzer`"
This reverts commit
6b0cf1e15f8f84e3d4b6f9522287f6460527a7bf.
The included test is timing out on Arm/AArch64 bots.
Markus Böck [Fri, 24 Feb 2023 13:11:35 +0000 (14:11 +0100)]
[mlir][SPIRV] Enable use of opaque-pointers in spirv-cpu-runner
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
All passes required for lowering have already been successfully converted to allowing opaque-pointers. Switching the Spir-V runner to opaque-pointers is therefore only a matter of turning it on in these conversion passes. Regression tests also did not find any issues.
Differential Revision: https://reviews.llvm.org/D144725
Markus Böck [Tue, 21 Feb 2023 09:43:18 +0000 (10:43 +0100)]
[mlir][GPUToVulkan] Port conversion passes and `mlir-vulkan-runner` to opaque pointers
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
This patch adds the new pass option 'use-opaque-pointers' to `-launch-func-to-vulkan` instructing the pass to emit LLVM opaque pointers instead of typed pointers.
Note that the pass as it was previously implemented relied on the fact LLVM pointers carried an element type. The passed used this information to deduce both the rank of a "lowered-to-llvm" MemRef as well as the element type. Since the element type when using LLVM opaque pointers is completely erased it is not possible to deduce the element type.
I therefore added a new attribute that is attached to the `vulkanLaunch` call alongside the binary blob and entry point name by the `-convert-gpu-launch-to-vulkan-launch` pass. It simply attaches a type array specifying the element types of each memref. This way the `-launch-func-to-vulkan` can simply read out the element type from the attribute.
The rank can still be deduced from the auto-generated C interface from `FinalizeMemRefToLLVM`. This is admittedly a bit fragile but I was not sure whether it was worth the effort to also add a rank array attribute.
As a last step, the use of opaque-pointers in `mlir-vulkan-runners` codegen pipeline was also enabled, since all covnersion passes used fully support it.
Differential Revision: https://reviews.llvm.org/D144460
Manuel Klimek [Wed, 1 Feb 2023 13:20:28 +0000 (13:20 +0000)]
[clang-format] Add simple macro replacements in formatting.
Add configuration to specify macros.
Macros will be expanded, and the code will be parsed and annotated
in the expanded state. In a second step, the formatting decisions
in the annotated expanded code will be reconstructed onto the
original unexpanded macro call.
Eventually, this will allow to remove special-case code for
various macro options we accumulated over the years in favor of
one principled mechanism.
Differential Revision: https://reviews.llvm.org/D144170
Jon Chesterfield [Fri, 24 Feb 2023 15:20:11 +0000 (15:20 +0000)]
[amdgpu] Change LDS lowering default to hybrid
Postponed from D139433 until the bug fixed by D139874 could be resolved.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D141852
Jon Chesterfield [Fri, 24 Feb 2023 14:47:12 +0000 (14:47 +0000)]
[amdgpu] Add test case showing bug prior to D141852
Tobias Gysi [Fri, 24 Feb 2023 14:47:23 +0000 (15:47 +0100)]
[mlir][llvm] Add FastmathFlagsInterface only once (NFC).
Previously, the FastmathFlagsInterface has been added twice to
the LLVM::PowIOp. Once directly and once indirectly using the
requiresFastmath flag. This revision only uses the flag and drops
the redundant interface.
Reviewed By: definelicht
Differential Revision: https://reviews.llvm.org/D144702
Steve Merritt [Fri, 10 Feb 2023 13:49:49 +0000 (08:49 -0500)]
[Codeview] Fix incorrect size determination for complex types.
In Codeview, the basic type of a complex represents the size
of an individual component rather than the sum of the real
and imaginary components.
Differential Revision: https://reviews.llvm.org/D143760
Hans Wennborg [Fri, 27 Jan 2023 17:33:02 +0000 (18:33 +0100)]
[PDB] Error on too large stream directories
We hit this in Chromium builds where the PDB file was just under 4GB,
but the stream directory was actually too large to be correctly
represented.
llvm-pdbutil would error about this in llvm::msf::validateSuperBlock,
but lld should not write such PDB files in the first place.
Differential revision: https://reviews.llvm.org/D144385
Matt Arsenault [Fri, 24 Feb 2023 13:38:10 +0000 (09:38 -0400)]
Verifier: Don't rely on bitmask enum when checking nofpclass value
Markus Böck [Fri, 24 Feb 2023 13:33:19 +0000 (14:33 +0100)]
[mlir][Vector][Trivial] Move a conversion to LLVM test to the conversion passes test directory and port it to opaque pointers
Markus Böck [Fri, 24 Feb 2023 13:26:02 +0000 (14:26 +0100)]
[mlir][LLVM] Enable opaque-pointers in e2e lowering test pass
Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179
Given this is only a test pass I believe it should be fine to switch it to opaque-pointers entirely while migrating.
Differential Revision: https://reviews.llvm.org/D144726
Markus Böck [Fri, 24 Feb 2023 13:10:26 +0000 (14:10 +0100)]
[mlir][LinalgToLLVM] Add pass option for emitting opaque-pointers
While the pass itself doesn't directly require any changes to be compatible with opaque-pointers, it does import patterns for lowering MemRefs to LLVM.
Adding this pass option allows any users of the pass to switch to emitting opaque-pointers via the pass option
Differential Revision: https://reviews.llvm.org/D144724
Joseph Huber [Fri, 24 Feb 2023 13:23:34 +0000 (07:23 -0600)]
[Libomptarget] Remove unused image argument from global handler function
Summary:
A previous patch got rid of the use of this image but forgot to remove
it from this function. Simply remove it as it is unused now.
Nikolas Klauser [Tue, 21 Feb 2023 13:16:41 +0000 (14:16 +0100)]
[libc++] Remove <experimental/{algorithm,functional}>
The contents of these files have been implemented for at least two releases, so let's remove them according to our policy (https://libcxx.llvm.org/DesignDocs/ExperimentalFeatures.html#id4).
Reviewed By: Mordante, #libc
Spies: arichardson, libcxx-commits
Differential Revision: https://reviews.llvm.org/D144475
Ilya Leoshkevich [Fri, 24 Feb 2023 12:10:15 +0000 (13:10 +0100)]
[sanitizer] Support v2 and v3 capabilities
capget() and capset() may read or write more than one cap_user_data_t,
depending on the version field of cap_user_header_t. Currently the
code assumes it's just one, so MSan complains if an application uses
version 2 or 3, where two cap_user_data_ts are used.
Parse the header in order to determine the number of cap_user_data_ts.
Also add a test.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D143660
Aaron Ballman [Fri, 24 Feb 2023 12:56:47 +0000 (07:56 -0500)]
Fix the LLVM Sphinx build
This addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/32299
Haojian Wu [Fri, 24 Feb 2023 11:49:06 +0000 (12:49 +0100)]
[Tooling/Inclusion] Add the generic abs symbol to the table.
Fixes https://github.com/llvm/llvm-project/issues/60964
Differential Revision: https://reviews.llvm.org/D144721
Florian Hahn [Fri, 24 Feb 2023 12:47:30 +0000 (13:47 +0100)]
Recommit "[SCCP] Remove legacy SCCP pass."
This reverts commit
a9a1950115d7db95c7439128b14af2cefe8f796d.
The legacy PM uses in Polly have been removed, so recommit the patch.
Original message:
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D144201
isuckatcs [Fri, 7 Oct 2022 22:23:33 +0000 (00:23 +0200)]
[clang-tidy] handle exceptions properly in `ExceptionAnalyzer`
This patch implements the exception handling rules found in
N4849 14.4 and as a result fixes many false positives in
the bugprone-exception-escape checker.
Differential Revision: https://reviews.llvm.org/D135495
Matt Arsenault [Fri, 24 Feb 2023 12:40:41 +0000 (08:40 -0400)]
LLParser: Fix failing nofpclass test
Florian Hahn [Fri, 24 Feb 2023 12:39:32 +0000 (13:39 +0100)]
[Polly] Remove CodegenCleanupPass.
The pass uses a bunch of deprecated legacy passes and appears unused.
Remove it to unblock removing legacy passes.
Fixes https://github.com/llvm/llvm-project/issues/60852
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D144332
Dmitri Gribenko [Fri, 24 Feb 2023 12:24:51 +0000 (13:24 +0100)]
Revert "Add tests to reproduce pointer/index width confusion crashes"
This reverts commit
5a4f193afa0d73f7ec459648d8f02535577dd604.
See https://reviews.llvm.org/D144673, this change broke multiple
buildbots.
Haojian Wu [Fri, 24 Feb 2023 10:45:29 +0000 (11:45 +0100)]
[Tooling/Inclusion] Add the missing NULL symbol to the table.
Differential Revision: https://reviews.llvm.org/D144713
Matt Arsenault [Tue, 6 Dec 2022 18:50:35 +0000 (13:50 -0500)]
AMDGPU: Document denormal behavior
Not sure this is the right place for it next to the table.
Matt Arsenault [Tue, 6 Dec 2022 18:04:15 +0000 (13:04 -0500)]
IR: Add nofpclass parameter attribute
This carries a bitmask indicating forbidden floating-point value kinds
in the argument or return value. This will enable interprocedural
-ffinite-math-only optimizations. This is primarily to cover the
no-nans and no-infinities cases, but also covers the other floating
point classes for free. Textually, this provides a number of names
corresponding to bits in FPClassTest, e.g.
call nofpclass(nan inf) @must_be_finite()
call nofpclass(snan) @cannot_be_snan()
This is more expressive than the existing nnan and ninf fast math
flags. As an added bonus, you can represent fun things like nanf:
declare nofpclass(inf zero sub norm) float @only_nans()
Compared to nnan/ninf:
- Can be applied to individual call operands as well as the return value
- Can distinguish signaling and quiet nans
- Distinguishes the sign of infinities
- Can be safely propagated since it doesn't imply anything about
other operands.
- Does not apply to FP instructions; it's not a flag
This is one step closer to being able to retire "no-nans-fp-math" and
"no-infs-fp-math". The one remaining situation where we have no way to
represent no-nans/infs is for loads (if we wanted to solve this we
could introduce !nofpclass metadata, following along with
noundef/!noundef).
This is to help simplify the GPU builtin math library
distribution. Currently the library code has explicit finite math only
checks, read from global constants the compiler driver needs to set
based on the compiler flags during linking. We end up having to
internalize the library into each translation unit in case different
linked modules have different math flags. By propagating known-not-nan
and known-not-infinity information, we can automatically prune the
edge case handling in most functions if the function is only reached
from fast math uses.
Jirui Wu [Thu, 16 Feb 2023 16:28:09 +0000 (16:28 +0000)]
[ARM] Remove redundant BTI instructions for table jumps
A BTI instruction was previously inserted at the beginning of each block
that has its address stored in a jump table. Jump tables only emit
indirect jumps in ARM or Thumb1 modes. However, PACBTI is not supported
in these modes. As a result, BTI instructions emitted by jump tables are
redundant. Removing redundant BTI instructions improves the code size
and prevents potential gadgets.
Differential Revision: https://reviews.llvm.org/D144470
Jirui Wu [Tue, 31 Jan 2023 10:11:24 +0000 (10:11 +0000)]
[ARM] Accept .w suffixes for some memory instructions
Some memory instructions in the following sections of Armv7-M ARM allow
the .w mnemonic suffix, even though the preferred disassembly is without
the suffix.
A7.7.46 LDRB (immediate) T3
A7.7.55 LDRH (immediate) T3
A7.7.59 LDRSB (immediate) T2
A7.7.63 LDRSH (immediate) T2
A7.7.163 STRB (immediate) T3
A7.7.170 STRH (immediate) T3
This patch accepts the .w suffixes for theses instructions.
Pseudo-instructions and custom parsing logic are used instead of simple
aliases. More discussions are in these relevant patches:
https://reviews.llvm.org/D68916
https://reviews.llvm.org/D96632
Differential Revision: https://reviews.llvm.org/D142980
Paul Semel [Wed, 22 Feb 2023 10:36:39 +0000 (10:36 +0000)]
[clang][dataflow] Fix wrong assert for CXXConstructExpr
Differential Revision: https://reviews.llvm.org/D144546
Kadir Cetinkaya [Thu, 23 Feb 2023 15:33:03 +0000 (16:33 +0100)]
[Tooling][Inclusions] Add c-header and global namespace alternatives for size_t
Differential Revision: https://reviews.llvm.org/D144646
Kadir Cetinkaya [Fri, 24 Feb 2023 08:52:40 +0000 (09:52 +0100)]
[clangd] Fix UB in scanPreamble
getMemBufferCopy triggers an UB when it receives a default constructed
StringRef. Make sure that we're always passing the null-terminated string
created in ParseInputs throughout the scanPreamble.
Differential Revision: https://reviews.llvm.org/D144708
Nathan Ridge [Fri, 24 Feb 2023 06:17:44 +0000 (01:17 -0500)]
[clangd] Avoid using CompletionItemKind.Text for macro completions
Fixes https://github.com/clangd/clangd/issues/1484
Differential Revision: https://reviews.llvm.org/D144703
Matthias Springer [Fri, 24 Feb 2023 09:13:36 +0000 (10:13 +0100)]
[mlir][IR] Add Iterator template option to IR walkers
This allows users to specify a top-down or bottom-up traversal of the IR, in addition to the already existing WalkOrder.
Certain transformations work better with a forward traversal. E.g., when cloning a piece of IR, operations should be cloned top-down so that all uses are defined when creating an op.
Certain transformations work better with a reverse traversal. E.g., when erasing a piece of IR, operations should be erased bottom-up to avoid erasing operations that still have users.
Differential Revision: https://reviews.llvm.org/D144257
Florian Hahn [Fri, 24 Feb 2023 08:41:52 +0000 (09:41 +0100)]
[SCEV] Increase FoldID bits size cover common cases.
This should fix the regressions introduced by
a53d940cee6f by making
sure no dynamic allocations are needed in the common case, while
retaining support for arbitrary SCEV expressions.
Alternative to D144335.
Compile-time impact:
* NewPM-O3: -0.11%
* NewPM-ReleaseThinLTO: -0.10%
*NewPM-ReleaseLTO-g: -0.08%
https://llvm-compile-time-tracker.com/compare.php?from=
df016a9525e5722dfd1e1e1632cec3ed7b33bc8a&to=
c1c64de4a973bcecaddbc4038a539234eb39413b&stat=instructions:u
Reviewed By: vitalybuka, nikic
Differential Revision: https://reviews.llvm.org/D144382
Valentin Clement [Fri, 24 Feb 2023 08:21:45 +0000 (09:21 +0100)]
[flang] Perform default value initialization on abstract type if needed
Abstract derived-type components can have default value so perform
the default value initialization if necessary.
```
type, abstract :: a
integer :: b = 10
end type
type, extends(a) :: b
integer :: d
end type
```
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D144668
Jean Perier [Fri, 24 Feb 2023 08:18:15 +0000 (09:18 +0100)]
[flang][hlfir] Array constructor lowering [part 4/4]
Enable character and derived type array constructor lowering.
Nothing special needs to be done other than lowering the types
before the array constructor lowering.
Derived type are forced to use the runtime for now to avoid
undesired usage of user defined assignment that hlfir.assign
may trigger when using the runtime.
Differential Revision: https://reviews.llvm.org/D144548
Serge Pavlov [Fri, 24 Feb 2023 08:11:16 +0000 (15:11 +0700)]
[NFC] Make FPClassTest a bitmask enumeration
This is recommit of
2e416cdd52, fixed to be accepatble by GCC.
The original commit message is below.
With this change bitwise operations are allowed for FPClassTest
enumeration, it must simplify using this type. Also some functions
changed to get argument of type FPClassTest instead of unsigned.
Differential Revision: https://reviews.llvm.org/D144241
Jean Perier [Fri, 24 Feb 2023 08:09:52 +0000 (09:09 +0100)]
[flang][hlfir] Array constructor lowering [part 3/4]
Lower the cases that require runtime support to deal
with the allocation, reallocation, or copy of ac-values to
the array constructor storage.
Differential Revision: https://reviews.llvm.org/D144513
Martin Liska [Mon, 20 Feb 2023 20:06:08 +0000 (21:06 +0100)]
ASAN: keep support for Global::location
We as GCC still emit __asan_global_source_location for global variables
and we would like to use it in the future. On other hand, we don't
support llvm-symbolizer and the default libbacktraace symbolizer
does not support location info.
Differential Revision: https://reviews.llvm.org/D144424
Jean Perier [Fri, 24 Feb 2023 08:07:25 +0000 (09:07 +0100)]
[flang] Do not include dangling ac-implied-do-index in folded shape inquiry
The current code was replacing inquiry to array constructor whose
ac-value shape depends on ac-implied-do-index with an expression
using the ac-implied-do-index without the implied-do (folding the
first case added in the test as in the second case with a regular
symbol).
Differential Revision: https://reviews.llvm.org/D144655
Jean Perier [Fri, 24 Feb 2023 08:06:14 +0000 (09:06 +0100)]
[flang] Preserve useResultSymbolShape_ option when folding array constructor shape
By default evaluate::GetShape(expr) may return a compiler generated expression
using symbols that are part of function interfaces if there are function
references in "expr".
It is not right to replace an inquiry of "expr" with such compiler
generated expression since the call context would be lost, along with
the meaning of the inquiry expression.
Inquiry folding uses GetContextFreeShape(expr) that sets-up
useResultSymbolShape_ in GetShapeHelper to prevent such bad rewrites. But this did not
work properly with array constructor: GetShapeHelper made a call to
GetShape, ignoring and losing the "useResultSymbolShape_" instruction.
Differential Revision: https://reviews.llvm.org/D144512
LLVM GN Syncbot [Fri, 24 Feb 2023 07:34:42 +0000 (07:34 +0000)]
[gn build] Port
fffbfe7c0ca8
Julian Lettner [Fri, 24 Feb 2023 07:28:59 +0000 (23:28 -0800)]
Restore "[Darwin] Apply workaround to make symbolication in iOS simulators work"
This reverts commit
d8b8911d58dba73fd7a28210d8d3e780ae881179.
Craig Topper [Fri, 24 Feb 2023 07:23:40 +0000 (23:23 -0800)]
[WebAssembly] Split WebAssemblyUtils to fix library layering for MC tools.
WebAssemblyUtils depends on CodeGen which depends on all middle end
optimization libraries.
This component is used by WebAssembly's AsmParser, Disassembler, and
MCTargetDesc libraries. Because of this, any MC layer tool built with
WebAssembly support includes a larger portion of LLVM than it should.
To fix this I've created an MC only version of WebAssemblyTypeUtilities.cpp
in MCTargetDesc to be used by the MC components.
This shrinks llvm-objdump and llvm-mc on my local release+asserts
build by 5-6 MB.
Reviewed By: MaskRay, aheejin
Differential Revision: https://reviews.llvm.org/D144354
Alexis Murzeau [Fri, 24 Feb 2023 06:53:00 +0000 (06:53 +0000)]
[clang-tidy] Fix readability-identifer-naming Hungarian CString options
When reading readability-identifier-naming.HungarianNotation.CString
options, correctly use the type string stored in CStr.second instead of
the option name (CStr.first) as the HNOption.CString map key.
This will make CString options really working and properly parsed by the
checker.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D144431
Vikram [Wed, 15 Feb 2023 11:05:31 +0000 (11:05 +0000)]
[AMDGPU] Autogenerate carryout-selection.ll, uaddo.ll, usubo.ll (NFC)
Differential Revision: https://reviews.llvm.org/D143987
Chuanqi Xu [Fri, 24 Feb 2023 06:27:51 +0000 (14:27 +0800)]
Add test for issue 60486
Close https://github.com/llvm/llvm-project/issues/60486.
When I look back at this problem again, it only appears if we specify it
with `-fmodule-file=<BMI-path>`. And it disappears after we specify it
as `-fmodule-file=<module-name>=<BMI-path>`. Since we want to depreacate
the form `-fmodule-file=<BMI-path>`, we can think the problem goes
away.
Mehdi Amini [Fri, 24 Feb 2023 06:28:34 +0000 (23:28 -0700)]
Fix internal link in the MLIR doc
Fangrui Song [Fri, 24 Feb 2023 05:45:14 +0000 (21:45 -0800)]
[FunctionImport] Change IRMover report_fatal_error to a proper error
Conflicting module flags leads to a proper error for regular LTO but a crash
(report_fatal_error) for ThinLTO. Switch to createStringError to fix the crash
and match regular LTO.
Chia-hung Duan [Fri, 24 Feb 2023 01:59:01 +0000 (01:59 +0000)]
[scudo] Accessing PossibleRegions requires lock
It is preferable to use `std::shared_mutex` style mutex. Will switch to
using it when it's available.
Differential Revision: https://reviews.llvm.org/D144691
Ben Shi [Thu, 23 Feb 2023 07:06:38 +0000 (15:06 +0800)]
[AVR][MC] Add ELF flag 'EF_AVR_LINKRELAX_PREPARED' to OBJ files
This is in accordance with avr-gcc, even '-mno-relax' is specified
to avr-gcc, this flag will also be added to the output relocatables.
With this flag set, the GNU ld will perform long call -> short call
optimization for AVR, otherwise not.
Fixes https://github.com/llvm/llvm-project/issues/54508
Reviewed By: MaskRay, jacquesguan, aykevl
Differential Revision: https://reviews.llvm.org/D144617
Siva Chandra Reddy [Thu, 2 Feb 2023 07:23:52 +0000 (07:23 +0000)]
[libc] Remove a now uneccesary CMake policy.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D143139
Michael Liao [Fri, 17 Feb 2023 20:58:23 +0000 (15:58 -0500)]
[LangRef] Correct value ranges for address space, vector, and float bit sizes.
- The current implementation checks them for 24-bit inegers but the
document says 23-bit one effectively by listing the range as [1,2^23).
- Minor error message correction.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D144685
Siva Chandra Reddy [Thu, 23 Feb 2023 19:28:22 +0000 (19:28 +0000)]
[libc] Introduce a target named libc-unit-tests to run just the unit tests.
The target "check-libc" now runs all enabled tests which, depending on
the build mode, includes the unit tests, the integration tests and the api
test.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D144663
Julian Lettner [Fri, 24 Feb 2023 02:12:52 +0000 (18:12 -0800)]
Revert "[Darwin] Apply workaround to make symbolication in iOS simulators work"
This reverts commit
ebd8eee62a431a6744c3f187fcda58e5dea08499.
Noah Goldstein [Thu, 23 Feb 2023 19:50:02 +0000 (13:50 -0600)]
Use `analyzeKnownBitsFromAndXorOr` in `SimplifyDemandedUseBits` for and/xor/or
There are extra patterns that have for these three logic operations
that aren't covered in `SimplifyDemandedUseBits`. To avoid duplicating
the code, just use `analyzeKnownBitsFromAndXorOr` in
`SimplifyDemandedUseBits` to get full coverage.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142429
Noah Goldstein [Thu, 26 Jan 2023 17:35:51 +0000 (11:35 -0600)]
Add logic for tracking lowbit of (and/xor/or X, (add/sub X, Odd))
Any case of logicop + add/sub(Odd) we can prove the low bit is either
zero/non-zero.
Alive2 Links:
xor:
sub x, C: https://alive2.llvm.org/ce/z/aaABdS
sub C, x: https://alive2.llvm.org/ce/z/2W-ZJ7
add C, x: https://alive2.llvm.org/ce/z/pzDkte
or:
sub x, C: https://alive2.llvm.org/ce/z/xd-bcP
sub C, x: https://alive2.llvm.org/ce/z/p8hXJF
add C, x: https://alive2.llvm.org/ce/z/osmkB6
and:
sub x, C: https://alive2.llvm.org/ce/z/D_NNxR
sub C, x: https://alive2.llvm.org/ce/z/N_5C62
add C, x: https://alive2.llvm.org/ce/z/4cy7a4
Differential Revision: https://reviews.llvm.org/D142427
Noah Goldstein [Sun, 29 Jan 2023 22:02:38 +0000 (16:02 -0600)]
Add helper for handling `computeKnownBits` for and/xor/or; NFC
This change just factors out the existing logic for and/xor/or and
puts them in a publicly available helper. functionality is the same.
Differential Revision: https://reviews.llvm.org/D142849
Noah Goldstein [Sun, 29 Jan 2023 22:02:32 +0000 (16:02 -0600)]
Add tests for KnownBits of (and/xor/or X, (add/sub X, OddV)); NFC
Differential Revision: https://reviews.llvm.org/D142426
Min-Yih Hsu [Thu, 19 Jan 2023 19:44:20 +0000 (11:44 -0800)]
[M68k] Provide exception pointer and selector registers
Using d0 for exception pointer and d1 for selector, as suggested by GCC.
Kadir Cetinkaya [Fri, 24 Feb 2023 00:05:15 +0000 (01:05 +0100)]
Revert "Revert "[Tooling/Inclusion] Handle std::get symbol.""
This reverts commit
7c9b15fbaeb2846ad25e797d55ffe1ccef9e1379. Breakage
was in downstream code.
Shilei Tian [Fri, 24 Feb 2023 00:12:51 +0000 (19:12 -0500)]
[OpenMP] Fix the wrong use of `fopen`
This patch fixes the wrong use of `fopen`.
Fix https://github.com/llvm/llvm-project/issues/60934
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D144601
Qiongsi Wu [Thu, 23 Feb 2023 22:31:50 +0000 (17:31 -0500)]
[PGO] Setting ValueProfNode Array's Alignment
`instrprof` currently does not set `__llvm_prf_vnds`'s alignment after creating it. The consequence is that the alignment is set to 16 later (https://github.com/llvm/llvm-project/blob/
c0f3ac1d0015fd051144a987ff500b888a32be86/llvm/lib/IR/DataLayout.cpp#L1019). This can lead to undefined behaviour when we calculate `NumVNodes` in `lprofGetLoadModuleSignature` (https://github.com/llvm/llvm-project/blob/
c0f3ac1d0015fd051144a987ff500b888a32be86/compiler-rt/lib/profile/InstrProfilingMerge.c#L32). The reason is that when the `__llvm_prf_vnds` array is 16 byte aligned, `__llvm_profile_end_vnodes() - __llvm_profile_begin_vnodes()` may not be a multiple of the size of ValueProfNode (which is 24, 20 on 32 bit targets).
This patch sets `__llvm_prf_vnds`'s alignment to its ABI alignment, which always divides its size. Then `__llvm_profile_end_vnodes() - __llvm_profile_begin_vnodes()` will be a multiple of `sizeof(ValueProfNode)`.
Reviewed By: w2yehia, MaskRay
Differential Revision: https://reviews.llvm.org/D144302
Alex Lorenz [Thu, 23 Feb 2023 23:52:21 +0000 (15:52 -0800)]
[clang] fix intendation in newly added release note
This fixes the llvm docs build bot.
Markus Böck [Thu, 23 Feb 2023 23:25:17 +0000 (00:25 +0100)]
[mlir][doc] Remove section about now removed `useFoldAPI` option
Manolis Tsamis [Thu, 23 Feb 2023 23:18:55 +0000 (00:18 +0100)]
[RISCV] Add vendor-defined XTheadFMemIdx (FP Indexed Memory Operations) extension
The vendor-defined XTHeadFMemIdx (no comparable standard extension exists
at the time of writing) extension adds indexed load/store instructions
for floating-point registers.
It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.
The current (as of this commit) public documentation for this
extension is available at:
https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf
Support for these instructions has already landed in GNU Binutils:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
f511f80fa3fcaf6bcbe727fb902b8bd5ec8f9c20
Depends on D144249
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144647
Chia-hung Duan [Thu, 23 Feb 2023 22:51:29 +0000 (22:51 +0000)]
[scudo] Mark all blocks in a range without visiting each of them
When all the blocks in the group are known to be used, we should just
mark the pages in the range as all counted instead of visiting each of
them. This will reduce the time of marking free blocks especially for
smaller size class.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D141958
Caroline Tice [Thu, 23 Feb 2023 23:10:36 +0000 (15:10 -0800)]
Revert "[Tooling/Inclusion] Handle std::get symbol."
This reverts commit
cbcb3eef70def3509bdffd4fe1ebfb6422afeaa2.
Causing many clangd test breakages, similar to:
error: no matching constructor for initialization of 'llvm::SmallVector<clang::tooling::stdlib::Header>'
: llvm::SmallVector<clang::tooling::stdlib::Header>(
^
Manolis Tsamis [Thu, 23 Feb 2023 23:04:08 +0000 (00:04 +0100)]
[RISCV] Add vendor-defined XTheadMemIdx (Indexed Memory Operations) extension
The vendor-defined XTHeadMemIdx (no comparable standard extension exists
at the time of writing) extension adds indexed load/store instructions
as well as load/store and update register instructions.
It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.
The current (as of this commit) public documentation for this
extension is available at:
https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf
Support for these instructions has already landed in GNU Binutils:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
27cfd142d0a7e378d19aa9a1278e2137f849b71b
Depends on D144002
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144249
Ben Shi [Thu, 23 Feb 2023 07:39:02 +0000 (15:39 +0800)]
[clang][driver] Handle '-mrelax' and '-mno-relax' for AVR
Reviewed By: MaskRay, aykevl
Fixes https://github.com/llvm/llvm-project/issues/54508
Differential Revision: https://reviews.llvm.org/D144620
Leonard Chan [Tue, 18 Oct 2022 18:23:48 +0000 (18:23 +0000)]
[llvm] Teach GlobalDCE about dso_local_equivalent
This way, C++ relative-vtables can also participate in GlobalDCE. This
depends on some TypeMetadataUtils.cpp bits in D134320, but that
dependency can be removed and included here if necessary.
Differential Revision: https://reviews.llvm.org/D135928
Fangrui Song [Thu, 23 Feb 2023 23:06:02 +0000 (15:06 -0800)]
[Driver] Define BareMetal::HasNativeLLVMSupport to return true
D33259 switched the default linker to ld.lld which supports LLVM LTO.
We can support LTO compile/link in one command and drop the
`unable to pass LLVM bit-code files to linker` error.
Fix https://github.com/llvm/llvm-project/issues/52807
Ziqing Luo [Thu, 23 Feb 2023 22:53:43 +0000 (14:53 -0800)]
[-Wunsafe-buffer-usage] Fixits for assignments to array subscript expressions
Let generate fix-its to make assignments' left-hand side of the form
`dre[e]` safe if `e` is known to be non-negative.
Commit on behalf of jkorous (Jan Korous)
Reviewed by: NoQ (Artem Dergachev)
Differential revision: https://reviews.llvm.org/D142794
Alex Lorenz [Thu, 23 Feb 2023 22:14:14 +0000 (14:14 -0800)]
[clang] extend external_source_symbol attribute with USR clause
Allow the user to specify a concrete USR in the external_source_symbol attribute.
That will let Clang's indexer to use Swift USRs for Swift declarations that are
represented with C++ declarations.
This new clause is used by Swift when generating a C++ header representation
of a Swift module:
https://github.com/apple/swift/pull/63002
Differential Revision: https://reviews.llvm.org/D141324
Krzysztof Drewniak [Thu, 23 Feb 2023 21:47:48 +0000 (21:47 +0000)]
Add tests to reproduce pointer/index width confusion crashes
Some calls to GEPOperator::accumulateConstantOffset(APInt) passed the
pointer bitwidth as the width of the APInt, while the function asserts
that the width of its argument is equal to the index width of the GEP
pointer input. These values are almost always the same, so mixing up
which call to use doesn't usually cause issues. However, when dealing
with data layouts where these values are different, the passes tested
here can crash.
This will be fixed in D143437 .
Differential Revision: https://reviews.llvm.org/D144673
Ziqing Luo [Thu, 23 Feb 2023 22:43:21 +0000 (14:43 -0800)]
[-Wunsafe-buffer-usage] Create Fix-Its only if they are emitted
`-Wunsafe-buffer-usage` diagnostics shall not emit fix-its if fix-its
are globally disabled.
Commit on behalf of jkorous (Jan Korous)
Reviewed by: NoQ (Artem Dergachev)
Differential revision: https://reviews.llvm.org/D143697
Quentin Colombet [Thu, 23 Feb 2023 22:26:15 +0000 (22:26 +0000)]
[mlir][LinAlg][Transform] Add a transform op for conv2d to im2col
This patch adds patterns to convert `linalg.conv_2d_xxx` operations
into `linalg.generic` (for img2col packing) and `linalg.matmul`.
The meat of the patch comes straight from IREE
(https://github.com/iree-org/iree).
(To the original authors are you okay with that?)
What this patch adds is proper plumbing of the im2col patterns into the
transform dialect.
PS: Feel free to add more reviewers. I wanted to cover the original contributors of im2col in IREE but I'm not sure I got all of them.
Reviewed By: nicolasvasilache, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D144108
Leonard Chan [Mon, 26 Sep 2022 20:27:09 +0000 (20:27 +0000)]
[llvm] Teach whole program devirtualization about relative vtables
Prior to this patch, WPD was not acting on relative-vtables in C++. This
involves teaching WPD about these things:
- llvm.load.relative which is how relative-vtables are indexed (instead of GEP)
- dso_local_equivalent which is used in the vtable itself when taking the
offset between a virtual function and vtable
- Update llvm/test/ThinLTO/X86/devirt.ll to use opaque pointers and add
equivalent tests for RV
Differential Revision: https://reviews.llvm.org/D134320
Leonard Chan [Thu, 23 Feb 2023 22:16:49 +0000 (22:16 +0000)]
Add REQUIRES: riscv to riscv test
This should fix builders like
https://lab.llvm.org/buildbot/#/builders/139/builds/36522
Leonard Chan [Thu, 23 Feb 2023 22:05:11 +0000 (22:05 +0000)]
[lld][RISCV] Introduce handling for R_RISCV_PLT32 relocation
This introduces R_RISCV_PLT32, a PC-relative data relocation that takes
the 32-bit relative offset to a function or its PLT entry.
This is needed to support relative vtables on RISCV.
Github PR: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/363
D143226 has the llvm parts.
Differential Revision: https://reviews.llvm.org/D143115
Teresa Johnson [Fri, 17 Feb 2023 15:38:01 +0000 (07:38 -0800)]
[LTO/WPD] Allow devirtualization to function alias in vtable
Follow on to D144209 to support single implementation devirtualization
for Regular LTO when the vtable holds a function alias.
For now I have prevented other optimizations performed in regular LTO
that need to analyze the contents of the function target when the vtable
holds an alias, as I'm not sure they are always correct to perform in
that case.
Differential Revision: https://reviews.llvm.org/D144270
Kirill Stoimenov [Thu, 23 Feb 2023 20:30:53 +0000 (20:30 +0000)]
[HWASAN][LSAN] Only initialize Symbolizer if leak checking is enabled
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D144669
Nikolas Klauser [Thu, 23 Feb 2023 12:33:55 +0000 (13:33 +0100)]
[libc++] Run modules_include.sh.cpp compiles in parallel
It's not pretty, but it makes the test run a lot faster.
Reviewed By: #libc, philnik
Spies: DavidSpickett, libcxx-commits
Differential Revision: https://reviews.llvm.org/D144640
Sanjay Patel [Thu, 23 Feb 2023 19:49:59 +0000 (14:49 -0500)]
[InstCombine] add tests for select of div/rem with common operand; NFC
issue #60906
Jez Ng [Thu, 23 Feb 2023 20:15:14 +0000 (15:15 -0500)]
[MC][nfc] Don't use a value after it has been std::move()'d
Reviewed By: serge-sans-paille
Differential Revision: https://reviews.llvm.org/D144662
Björn Svensson [Thu, 23 Feb 2023 20:06:43 +0000 (20:06 +0000)]
[clang-tidy][doc] Remove unused variable
Remove mention of a variable that is not used in the example for checker:
cppcoreguidelines-avoid-non-const-global-variables
Differential Revision: https://reviews.llvm.org/D143996
Leonard Chan [Thu, 23 Feb 2023 19:58:29 +0000 (19:58 +0000)]
[SCEV] Ensure SCEV does not replace aliases with their aliasees
Passes in general shouldn't replace an alias with the aliasee (see
https://reviews.llvm.org/D66606). This can lead to situations where a
linkonce_odr symbol (which could be interposable if lowered to weak
linkage) can be replaced with a local aliasee which won't be
interposable. SVEC does this when the function is invoked by
FunctionPass Manager -> Loop Pass Manager -> Induction Variable Users in
the codegen pipeline. This was found in hwasan instrumented code where a
linonce_odr alias was replaced with its private aliasee.
This fixes the bug descriped at
https://github.com/llvm/llvm-project/issues/60668.
Differential Revision: https://reviews.llvm.org/D144035
Advenam Tacet [Thu, 23 Feb 2023 19:45:57 +0000 (20:45 +0100)]
[ASan][libcxx] Annotating std::vector with all allocators
This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection
capabilities by adding annotations, similar to those existing
in std::vector, to std::string and std::deque collections.
These changes allow ASan to detect cases when the instrumented
program accesses memory which is internally allocated by
the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).
The motivation for the research and those changes was a bug,
found by Trail of Bits, in a real code where an out-of-bounds read
could happen as two strings were compared via a std::equals function
that took iter1_begin, iter1_end, iter2_begin iterators
(with a custom comparison function).
When object iter1 was longer than iter2, read out-of-bounds on iter2
could happen. Container sanitization would detect it.
In revision D132522, support for non-aligned memory buffers (sharing
first/last granule with other objects) was added, therefore the
check for standard allocator is not necessary anymore.
This patch removes the check in std::vector annotation member
function (__annotate_contiguous_container) to support
different allocators.
Additionally, this revision fixes unpoisoning in std::vector.
It guarantees that __alloc_traits::deallocate may access returned memory.
Originally suggested in D144155 revision.
If you have any questions, please email:
- advenam.tacet@trailofbits.com
- disconnect3d@trailofbits.com
Reviewed By: #libc, #sanitizers, philnik, vitalybuka
Spies: hans, EricWF, philnik, #sanitizers, libcxx-commits
Differential Revision: https://reviews.llvm.org/D136765
Matthias Braun [Wed, 22 Feb 2023 23:25:11 +0000 (15:25 -0800)]
[clangd/index/remote]NFC: Adapt code to newer grpc/protobuf versions
It seems newer grpc / protobuf versions renamed
`Status::error_message()` and `Status::error_code()` to `message()` and
`code()` to prepare for replacement with `absl::Status` with the same
names.
As far as I can tell the new names are already available in the
grpc-1.36 version mentioned in the `README` file.
Differential Revision: https://reviews.llvm.org/D144599
Joseph Huber [Thu, 23 Feb 2023 19:24:40 +0000 (13:24 -0600)]
[Libomptarget] Adjust the info.c test now that printing is common
Summary:
Ever since the change to the new plugins the information messages are
common between the major plugins. This allows us to test the info.c file
generically.
Joseph Huber [Thu, 23 Feb 2023 19:22:54 +0000 (13:22 -0600)]
[Libomptarget] Add the CUDA feature to the packager
Summary:
Internally we need to know the feature that was used to build the CUDA.
This used to be added when the deviceRTL was build via the OpenMP
interface, but ever since it was moved to call the packager explicitly
it was not being added. This causes failured if the user attempts to use
the library without LTO enabled.