Joseph Huber [Tue, 20 Jul 2021 20:07:52 +0000 (16:07 -0400)]
[Libomptarget] Introduce new main thread ID runtime function
This patch introduces `__kmpc_is_generic_main_thread_id` which splits the old
comparison into its own runtime function. The purpose of this is so we can fold
this part independently, so when both this and `is_spmd_mode` are folded the
final function will be folded as well.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106437
Joseph Huber [Wed, 21 Jul 2021 16:48:39 +0000 (12:48 -0400)]
[OpenMP] Add new execution mode for SPMD execution with Generic semantics
Qualified kernels can be transformed from generic-mode to SPMD mode using an
optimization in OpenMPOpt. This patch introduces a new execution mode to
indicate kernels that have been transformed from generic-mode to SPMD-mode.
These kernels have SPMD-mode execution, but need generic-mode semantics for
scheduling the blocks and threads. Without this far too few blocks will be
scheduled for a generic region as SPMD mode expects the trip count to be
divided by the number of threads.
Reviewed By: ggeorgakoudis
Differential Revision: https://reviews.llvm.org/D106460
Joseph Huber [Wed, 21 Jul 2021 21:13:46 +0000 (17:13 -0400)]
[OpenMP] Change `__kmpc_free_shared` to include the paired allocation size
This patch changes `__kmpc_free_shared` to take an additional argument
corresponding to the associated allocation's size. This makes it easier to
implement the allocator in the runtime.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106496
Lang Hames [Thu, 22 Jul 2021 00:45:24 +0000 (10:45 +1000)]
Re-re-revert "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."
This reverts commit
6b2a96285b9bbe92d2c5e21830f21458f8be976d.
The ccache builders are still failing. Looks like they need to be updated to
get the llvm-zorg config change in
490633945677656ba75d42ff1ca9d4a400b7b243.
I'll re-apply this as soon as the builders are updated.
David Blaikie [Mon, 19 Jul 2021 04:44:08 +0000 (21:44 -0700)]
Fix assigned-but-unused (except in an assert) warning with a void cast
Hedin Garca [Wed, 21 Jul 2021 18:12:29 +0000 (18:12 +0000)]
[libc] Rename FEnv.h and refactor subsequent files
Because Windows's pathnames are not case sensitive,
to avoid include conflicts between our header file FEnv.h and the
one from the C Standard library, <fenv.h>, the prior file was renamed.
The motive for the relabel came to fix this include error in
TestHelpers.cpp since a conflict arose with a file in the same
directory when #include <fenv.h> was being used.
Reviewed By: sivachandra, aeubanks
Differential Revision: https://reviews.llvm.org/D106470
Jacob Hegna [Fri, 16 Jul 2021 21:25:33 +0000 (21:25 +0000)]
[NFC] Code cleanups in InlineCost.cpp.
- annotate const functions with "const"
- replace C-style casts with static_cast
Differential Revision: https://reviews.llvm.org/D105362
Lang Hames [Wed, 21 Jul 2021 07:38:35 +0000 (17:38 +1000)]
Re-re-apply "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."
This reapplies commit
a7733e9556b5a6334c910f88bcd037e84e17e3fc ("Re-apply
[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."), and
d4abdefc998a1ee19d5edc79ec233774cbf64f6a ("[ORC-RT] Rename macho_tlv.x86-64.s
to macho_tlv.x86-64.S (uppercase suffix)").
These patches were reverted in
48aa82cacbff10e1c5395a03f86488bf449ba4da while I
investigated bot failures (e.g.
https://lab.llvm.org/buildbot/#/builders/109/builds/18981). The fix was to
disable building of the ORC runtime on buliders using ccache (which is the same
fix used for other compiler-rt projects containing assembly code). This fix was
commited to llvm-zorg in
490633945677656ba75d42ff1ca9d4a400b7b243.
Thomas Lively [Wed, 21 Jul 2021 23:45:54 +0000 (16:45 -0700)]
[WebAssembly] Replace @llvm.wasm.popcnt with @llvm.ctpop.v16i8
Use the standard target-independent intrinsic to take advantage of standard
optimizations.
Differential Revision: https://reviews.llvm.org/D106506
Fangrui Song [Wed, 21 Jul 2021 23:16:20 +0000 (16:16 -0700)]
[mlir] Add workaround for false positive in -Wfree-nonheap-object
Restore
499571ea835daf786626a0db1e12f890b6cd8f8d
reverted by
0082764605cc0e7e0363a41ffa77d214c3157aa6.
A compiler slightly older than
"[clang][Sema] removes -Wfree-nonheap-object reference param false positive"
may report the false positive.
We need to retain the workaround a bit longer so that such compilers
can be used to compile MLIR in a warning-free way.
Thomas Lively [Wed, 21 Jul 2021 23:11:00 +0000 (16:11 -0700)]
[WebAssembly] Remove clang builtins for extract_lane and replace_lane
These builtins were added to capture the fact that the underlying Wasm
instructions return i32s and implicitly sign or zero extend the extracted lanes
in the case of the i8x16 and i16x8 variants. But we do sufficient optimizations
during code gen that these low-level details do not need to be exposed to users.
This commit replaces the use of the builtins in wasm_simd128.h with normal
target-independent vector code. As a result, we can switch the relevant
intrinsics to use functions rather than macros and can use more user-friendly
return types rather than trying to precisely expose the underlying Wasm types.
Note, however, that the generated LLVM IR is no different after this change.
Differential Revision: https://reviews.llvm.org/D106500
John Ericson [Sat, 3 Jul 2021 05:18:37 +0000 (05:18 +0000)]
Remove `LIBC_INSTALL_PREFIX`
This matches the decision made in D99697.
It also shouldn't reintroduce the issue fixed in D99636.
The variable was originally introduced in
b22f448c21e718a3b6219df89169f38d436189c6 but is not essential to that
change.
Once we finish adding `GnuInstallDirs` support in D100810 and D99484,
setting `CMAKE_INSTALL_LIBDIR` would also work to change the
installation directory (though for more than libc).
`GnuInstallDirs` support also brings up an issue which is avoided if
variables like `LIBC_INSTALL_PREFIX` don't exist. Because the
`GnuInstallDirs` variables can be absolute paths, it is a bit unclear
how the per-project prefixes would work: does the project-agnostic
role-specific variable (e.g. `CMAKE_INSTALL_LIBDIR`), or project-specfic
role-agnostic (e.g. `LIBC_INSTALL_PREFIX`) take priority? Each is more
specific than the other on one axis, but not the other.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D105740
Mehdi Amini [Wed, 21 Jul 2021 22:28:45 +0000 (22:28 +0000)]
Add verifier for insert/extract element/value on type match between container and inserted/extracted value, and fix vector.shuffle lowering
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D106398
Stanislav Mekhanoshin [Tue, 20 Jul 2021 20:53:14 +0000 (13:53 -0700)]
Prevent dead uses in register coalescer after rematerialization
The coalescer does not check if register uses are available
at the point of rematerialization. If it attempts to rematerialize
an instruction with such uses it can end up with use without a def.
LiveRangeEdit does such check during rematerialization, so just
call LiveRangeEdit::allUsesAvailableAt() to avoid the problem.
Differential Revision: https://reviews.llvm.org/D106396
Nicolas Vasilache [Wed, 21 Jul 2021 22:01:51 +0000 (22:01 +0000)]
[mlir][LLVM] Revert bareptr calling convention handling as an argument materialization.
Type conversion and argument materialization are context-free: there is no available information on which op / branch is currently being converted.
As a consequence, bare ptr convention cannot be handled as an argument materialization: it would apply irrespectively of the parent op.
This doesn't typecheck in the case of non-funcOp and we would see cases where a memref descriptor would be inserted in place of the pointer in another memref descriptor.
For now the proper behavior is to revert to a specific BarePtrFunc implementation and drop the blanket argument materialization logic.
This reverts the relevant piece of the conversion to LLVM to what it was before https://reviews.llvm.org/D105880 and adds a relevant test and documentation to avoid the mistake by whomever attempts this again in the future.
Reviewed By: arpith-jacob
Differential Revision: https://reviews.llvm.org/D106495
Jessica Paquette [Wed, 21 Jul 2021 21:57:31 +0000 (14:57 -0700)]
[AArch64][GlobalISel] Change | -> || in an if
I wrote the wrong type of OR by mistake.
LLVM GN Syncbot [Wed, 21 Jul 2021 21:45:33 +0000 (21:45 +0000)]
[gn build] Port
74fd3cb8cd3e
Stanislav Mekhanoshin [Thu, 15 Jul 2021 23:17:02 +0000 (16:17 -0700)]
[AMDGPU] Mark relevant rematerializable VOP3 instructions
Differential Revision: https://reviews.llvm.org/D106110
Omar Emara [Wed, 21 Jul 2021 21:39:59 +0000 (14:39 -0700)]
[LLDB][GUI] Add required property to text fields
This patch adds a required property to text fields and their
derivatives. Additionally, the Process Name and PID fields in the attach
form were marked as required.
Differential Revision: https://reviews.llvm.org/D106458
Omar Emara [Wed, 21 Jul 2021 21:34:40 +0000 (14:34 -0700)]
[LLDB][GUI] Add Process Plugin Field
This patch adds a new Process Plugin Field. It is a choices field that
lists all the available process plugins and can retrieve the name of the
selected plugin or an empty string if the default is selected.
The Attach form now uses that field instead of manually creating a
choices field.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D106467
Christopher Di Bella [Thu, 8 Jul 2021 21:01:19 +0000 (21:01 +0000)]
[libcxx][ranges] implements dangling, borrowed_iterator_t, borrowed_subrange_t
* Implements part of P0896 'The One Ranges Proposal'
* Implements http://wg21.link/range.dangling
Reviewed By: zoecarver
Differential Revision: https://reviews.llvm.org/D105205
Christopher Di Bella [Wed, 21 Jul 2021 21:29:24 +0000 (21:29 +0000)]
Revert "Add workaround for false positive in -Wfree-nonheap-object"
This reverts commit
499571ea835daf786626a0db1e12f890b6cd8f8d.
Christopher Di Bella [Tue, 13 Jul 2021 02:02:17 +0000 (02:02 +0000)]
[clang][Sema] removes -Wfree-nonheap-object reference param false positive
Taking the address of a reference parameter might be valid, and without
CFA, false positives are going to be more trouble than they're worth.
Differential Revision: https://reviews.llvm.org/D102728
Stanislav Mekhanoshin [Thu, 15 Jul 2021 23:10:36 +0000 (16:10 -0700)]
[AMDGPU] Mark relevant rematerializable VOP2 instructions
Differential Revision: https://reviews.llvm.org/D106023
Bill Wendling [Thu, 8 Jul 2021 09:08:45 +0000 (02:08 -0700)]
[llvm-diff] Check for recursive initialiers
We need to check for recursive initializers in the "ConstantStruct"
case.
Differential Revision: https://reviews.llvm.org/D105616
David Green [Wed, 21 Jul 2021 21:11:09 +0000 (22:11 +0100)]
[ARM] Pass SelectionDAG to methods that dont require DCI. NFC
In these methods DCI is never used, only the DAG from it. Pass the DAG
directly, cleaning up the code a little.
Walter Erquinigo [Wed, 21 Jul 2021 21:09:25 +0000 (14:09 -0700)]
[intel pt] fix builds
https://reviews.llvm.org/D105649 broke intel pt builds. Fortunately the
fix is super easy.
Stanislav Mekhanoshin [Tue, 13 Jul 2021 17:47:30 +0000 (10:47 -0700)]
[AMDGPU] Mark all relevant VOP1 instructions rematerializable
Differential Revision: https://reviews.llvm.org/D105919
Fangrui Song [Wed, 21 Jul 2021 21:03:26 +0000 (14:03 -0700)]
[sanitizer] Place module_ctor/module_dtor in llvm.used
This removes an abuse of ELF linker behaviors while keeping Mach-O/COFF linker
behaviors unchanged.
ELF: when module_ctor is in a comdat, this patch removes reliance on a linker
abuse (an SHT_INIT_ARRAY in a section group retains the whole group) by using
SHF_GNU_RETAIN. No linker behavior difference when module_ctor is not in a comdat.
Mach-O: module_ctor gets `N_NO_DEAD_STRIP`. No linker behavior difference
because module_ctor is already referenced by a `S_MOD_INIT_FUNC_POINTERS`
section (GC root).
PE/COFF: no-op. SanitizerCoverage already appends module_ctor to `llvm.used`.
Other sanitizers: llvm.used for local linkage is not implemented in
`TargetLoweringObjectFileCOFF::emitLinkerDirectives` (once implemented or
switched to a non-local linkage, COFF can use module_ctor in comdat (i.e.
generalize ELF-specific rL301586)).
There is no object file size difference.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D106246
Peter Steinfeld [Mon, 19 Jul 2021 18:22:45 +0000 (11:22 -0700)]
[flang] Implement the runtime portion of the CSHIFT intrinsic
This change fixes a bug in the runtime portion of the CSHIFT intrinsic
that happens when the value of the SHIFT argument is negative.
Differential Revision: https://reviews.llvm.org/D106292
Alex Langford [Wed, 7 Jul 2021 18:51:16 +0000 (11:51 -0700)]
[LLDB] Move Trace-specific classes into separate library
These two classes, TraceSessionFileParser and ThreadPostMortemTrace,
seem to be useful primarily for tracing. Currently it looks like
intel-pt is the sole user of these, but that other tracing plugins could
be written in the future that take advantage of these. Unfortunately
with them in Target, there is a dependency on PluginProcessUtility. I'd
like to sever that dependency, so I moved them into a `TraceCommon`
plugin.
Differential Revision: https://reviews.llvm.org/D105649
Nikita Popov [Wed, 21 Jul 2021 20:22:26 +0000 (22:22 +0200)]
[SimplifyCFG] Fix if conversion with opaque pointers
We need to make sure that the value types are the same. Otherwise
we both may not have the necessary dereferenceability implication,
nor can we directly form the desired select pattern.
Without opaque pointers this is enforced implicitly through the
pointer comparison.
Nikita Popov [Wed, 21 Jul 2021 20:17:46 +0000 (22:17 +0200)]
[SimplifyCFG] Regenerate test checks (NFC)
Stanislav Mekhanoshin [Thu, 8 Jul 2021 18:00:57 +0000 (11:00 -0700)]
[AMDGPU] Move perfhint analysis
This is SCC pass, moving it to the end of SCC PM saves one
Function PM. This needs the analysis to take into account
memory access width since it is now places after the
load/store optimizer (D105651).
Differential Revision: https://reviews.llvm.org/D105652
Jessica Paquette [Wed, 21 Jul 2021 00:28:45 +0000 (17:28 -0700)]
[AArch64][GlobalISel] Widen s2 and s4 G_IMPLICIT_DEF + G_FREEZE
These had
```
.clampScalar(0, s1, 64)
.widenScalarToNextPow2(0, 8)
```
If you have s2 or s4, then `widenScalarToNextPow2` does nothing.
This changes the `widenScalarToNextPow2` rule to use s8 as the minimum type
instead, allowing us to correctly widen s2 and s4.
This does not impact s1, since it's marked as legal already.
Differential Revision: https://reviews.llvm.org/D106413
Douglas Yung [Wed, 21 Jul 2021 19:51:05 +0000 (12:51 -0700)]
Change requires line from arm to aarch64 since the test uses arm64_32 which is AArch64.
John McCall [Wed, 21 Jul 2021 19:39:42 +0000 (15:39 -0400)]
Fix a bug in OptimizedStructLayout when filling gaps before
fixed fields with highly-aligned flexible fields.
The code was not considering the possibility that aligning
the current offset to the alignment of a queue might push
us past the end of the gap. Subtracting the offsets to
figure out the maximum field size for the gap then overflowed,
making us think that we had nearly unbounded space to fill.
Fixes PR 51131.
Alex Lorenz [Wed, 21 Jul 2021 19:46:11 +0000 (12:46 -0700)]
[clang][sema] NFC, include DarwinSDKInfo header instead of using the forward reference
This fixes a build issue with an older libc++ on some bots: clang-cmake-x86_64-avx2-linux and clang-ppc64be-linux
Stanislav Mekhanoshin [Thu, 8 Jul 2021 19:23:52 +0000 (12:23 -0700)]
[AMDGPU] Tune perfhint analysis to account access width
A function with less memory instructions but wider access
is the same as a function with more but narrower accesses
in terms of memory boundness. In fact the pass would give
different answers before and after vectorization without
this change.
Differential Revision: https://reviews.llvm.org/D105651
Craig Topper [Wed, 21 Jul 2021 19:35:31 +0000 (12:35 -0700)]
[RISCV] Cleanup comment around vector tail policy handling. NFC
vmv.x.s and reductions don't ignore tail policy anymore.
Sanjay Patel [Wed, 21 Jul 2021 19:15:47 +0000 (15:15 -0400)]
[SROA] avoid crash on memset with constant expression length
https://llvm.org/PR50888
Yaxun (Sam) Liu [Thu, 15 Jul 2021 15:14:02 +0000 (11:14 -0400)]
[HIP] Remove workaround in __clang_hip_runtime_wrapper.h
Remove the workaround for -fopenmp in __clang_hip_runtime_wrapper.h
since it causes device functions in HIP wrapper headers disabled when
compiling HIP program with -fopenmp.
Reviewed by: Aaron Enye Shi, Jon Chesterfield
Differential Revision: https://reviews.llvm.org/D106070
Gulfem Savrun Yeniceri [Wed, 21 Jul 2021 19:08:58 +0000 (19:08 +0000)]
Revert "[profile] Add binary id into profiles"
Revert "[profile] Change linkage type of a compiler-rt func"
This reverts commits
f984ac2715f71c38a7872fa2c2ad535b3d4fa285 and
467c7191249b76abff33853b1692a77f327c2422 because it broke some builds.
Jon Roelofs [Wed, 21 Jul 2021 18:45:40 +0000 (11:45 -0700)]
[Sanitizers][darwin] Fix a -Wcast-qual
Alex Lorenz [Wed, 14 Jul 2021 04:55:08 +0000 (21:55 -0700)]
[clang][darwin] add support for remapping macOS availability to Mac Catalyst availability
This commit adds supports for clang to remap macOS availability attributes that have introduced,
deprecated or obsoleted versions to appropriate Mac Catalyst availability attributes. This
mapping is done using the version mapping provided in the macOS SDK, in the SDKSettings.json file.
The mappings in the SDKSettings json file will also be used in the clang driver for the driver
Mac Catalyst patch, and they could also be used in the future for other platforms as well.
Differential Revision: https://reviews.llvm.org/D105257
Eli Friedman [Wed, 21 Jul 2021 18:21:21 +0000 (11:21 -0700)]
[AArch64] Regenerate and add more tests for i128 atomics.
Generating these tests unfortunately means a lot of junk, but it's hard
to write/update these tests by hand.
Added tests focus on atomic orderings for cmpxchg.
Actually writing out these tests showed some potentially dubious
results; we should probably consider using casp for 128-bit atomic
load/store/rmw.
Giorgis Georgakoudis [Tue, 13 Jul 2021 03:41:33 +0000 (20:41 -0700)]
[Attributor] Preserve BBs and instructions added in AA manifests
Manifesting AbstractAttributes may add new BBs in the IR. This patch provides an interface to register those BBs in the Attributor so that those BBs and containing instructions are not deleted as dead.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106383
Gulfem Savrun Yeniceri [Wed, 21 Jul 2021 18:11:33 +0000 (18:11 +0000)]
[profile] Change linkage type of a compiler-rt func
This patch changes the linkage type of a compiler-rt func
(__llvm_write_binary_ids) to fix the sanitizer-windows bot
build issue introduced in change
f984ac271.
The issue is as the following:
C:\b\slave\sanitizer-windows\llvm-project\compiler-rt\lib\profile\InstrProfilingInternal.h(201):
error C2496: '__llvm_write_binary_ids': 'selectany' can only be applied
to data items with external linkage
Eli Friedman [Thu, 8 Jul 2021 23:14:33 +0000 (16:14 -0700)]
[SelectionDAG] Fix the representation of ISD::STEP_VECTOR.
The existing rule about the operand type is strange. Instead, just say
the operand is a TargetConstant with the right width. (Legalization
ignores TargetConstants, so it doesn't matter if that width is legal.)
Highlights:
1. I had to substantially rewrite the AArch64 isel patterns to expect a
TargetConstant. Nothing too exotic, but maybe a little hairy. Maybe
worth considering a target-specific node with some dagcombines instead
of this complicated nest of isel patterns.
2. Our behavior on RV32 for vectors of i64 has changed slightly. In
particular, we correctly preserve the width of the arithmetic through
legalization. This changes the DAG a bit. Maybe room for
improvement here.
3. I explicitly defined the behavior around overflow. This is necessary
to make the DAGCombine transforms legal, and I don't think it causes any
practical issues.
Differential Revision: https://reviews.llvm.org/D105673
Gulfem Savrun Yeniceri [Thu, 6 May 2021 16:09:12 +0000 (16:09 +0000)]
[profile] Add binary id into profiles
This patch adds binary id into profiles to easily associate binaries
with the corresponding profiles. There is an RFC that discusses
the motivation, design and implementation in more detail:
https://lists.llvm.org/pipermail/llvm-dev/2021-June/151154.html
Differential Revision: https://reviews.llvm.org/D102039
Nancy Wang [Wed, 21 Jul 2021 17:42:22 +0000 (13:42 -0400)]
[SystemZ][z/OS][libcxx]: add the missing comment for patch D106153 and D106151
This patch is to add the missing comments in https://reviews.llvm.org/D106153 and https://reviews.llvm.org/D106151 to address comments.
Differential Revision: https://reviews.llvm.org/D106404
Jacques Pienaar [Wed, 21 Jul 2021 17:34:27 +0000 (10:34 -0700)]
[mlir] Add alias for input to shaped type op interface
Range type that allows for wrapping different value & shape ranges with
correspondence to Shape's ValueShape type - initially aliased to
ValueRange (which corresponds to the trivial mapping from a ShapedType's
Value's shape to shape). Just plain alias, before expanding.
Differential Revision: https://reviews.llvm.org/D99133
Giorgis Georgakoudis [Wed, 21 Jul 2021 01:50:05 +0000 (18:50 -0700)]
[Attributor][NFC] Modify isAssumedHeapToStack for const argument
There is no need for a non-const argument interface and the const argument modification covers existing and upcoming use cases.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106418
Giorgis Georgakoudis [Wed, 21 Jul 2021 07:18:38 +0000 (00:18 -0700)]
[OpenMP] Expose libomptarget function to get HW thread id
The patch exposes the libomptarget runtime function that gets the hardware thread id through the kmpc API. This is to be used in SPMDization for checking the thread id to execute regions by a single thread in a block.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106323
Walter Erquinigo [Wed, 21 Jul 2021 16:49:15 +0000 (09:49 -0700)]
[trace] [intel pt] Create a "thread trace dump stats" command
When the user types that command 'thread trace dump info' and there's a running Trace session in LLDB, a raw trace in bytes should be printed; the command 'thread trace dump info all' should print the info for all the threads.
Original Author: hanbingwang
Reviewed By: clayborg, wallace
Differential Revision: https://reviews.llvm.org/D105717
Jon Chesterfield [Wed, 21 Jul 2021 16:35:40 +0000 (17:35 +0100)]
Revert "[OpenMP][AMDGCN] Initial math headers support"
This reverts commit
968899ad9cf17579f9867dafb35c4d97bad0863f.
Jon Chesterfield [Wed, 21 Jul 2021 16:28:07 +0000 (17:28 +0100)]
[libomptarget][amdgpu][nfc] Refactor #includes
Create a hsa_api.h header that includes the ROCr headers in use
Drop some unused headers and _cplusplus macros
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106455
Thomas Lively [Wed, 21 Jul 2021 16:02:12 +0000 (09:02 -0700)]
[WebAssembly] Codegen for v128.load{32,64}_zero
Replace the experimental clang builtins and LLVM intrinsics for these
instructions with normal instruction selection patterns. The wasm_simd128.h
intrinsics header was already using portable code for the corresponding
intrinsics, so now it produces the correct instructions.
Differential Revision: https://reviews.llvm.org/D106400
Quinn Pham [Wed, 21 Jul 2021 15:47:52 +0000 (10:47 -0500)]
[PowerPC] Removing a REQUIRES line from llvm test
The test has been moved to the correct directory so this
`REQUIRES` line is not needed.
Eric Astor [Wed, 21 Jul 2021 15:46:23 +0000 (11:46 -0400)]
[ms] [llvm-ml] Restrict implicit RIP-relative addressing to named-variable references
ML64.EXE applies implicit RIP-relative addressing only to memory references that include a named-variable reference.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D105372
Arthur Eubanks [Tue, 20 Jul 2021 21:51:12 +0000 (14:51 -0700)]
[NewPM][Inliner] Check if deleted function is in current SCC
In weird cases, the inliner will inline internal recursive functions,
sometimes causing them to have no more uses, in which case the
inliner will mark the function to be deleted. The function is
actually deleted after the call to
updateCGAndAnalysisManagerForCGSCCPass(). In
updateCGAndAnalysisManagerForCGSCCPass(), UR.UpdatedC may be set to
the SCC containing the function to be deleted. Then the inliner calls
CG.removeDeadFunction() which can cause that SCC to be deleted, even
though it's still stored in UR.UpdatedC.
We could potentially check in the wrappers/pass managers if UR.UpdatedC
is in UR.InvalidatedSCCs before doing anything with it, but it's safer
to do this as close to possible to the call to CG.removeDeadFunction()
to avoid issues with allocating a new SCC in the same address as
the deleted one.
It's hard to find a small test case since we need to have recursive
internal functions be reachable from non-internal functions, yet they
need to become non-recursive and not referenced by other functions when
inlined.
Similar to https://reviews.llvm.org/D106306.
Fixes PR50788.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D106405
Jon Roelofs [Wed, 21 Jul 2021 15:23:17 +0000 (08:23 -0700)]
[MachineVerifier] Make INSERT_SUBREG diagnostic respect operand 2 subregs
This came out of post-commit review: https://reviews.llvm.org/D105953#inline-1012919
Thanks uabelho!
Eric Astor [Wed, 21 Jul 2021 15:43:25 +0000 (11:43 -0400)]
[ms] [llvm-ml] Support built-in text macros
Add support for all built-in text macros supported by ML64:
@Date, @Time, @FileName, @FileCur, and @CurSeg.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D104965
Eric Astor [Wed, 21 Jul 2021 15:39:41 +0000 (11:39 -0400)]
[ms] [llvm-ml] Add support for numeric built-in symbols
Support @Version and @Line as built-in symbols. For now, resolves @Version to 1427 (the same as for the VS 2019 release of ML.EXE).
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D104964
Geoffrey Martin-Noble [Wed, 21 Jul 2021 15:37:38 +0000 (08:37 -0700)]
[Bazel] Remove deprecated td_relative_includes
This has been deprecated for a while and there are no in-tree usages.
I'm not aware of any out-of-tree usages either.
Pushpinder Singh [Wed, 21 Jul 2021 15:15:38 +0000 (16:15 +0100)]
[OpenMP][AMDGCN] Initial math headers support
With this patch, OpenMP on AMDGCN will use the math functions
provided by ROCm ocml library. Linking device code to the ocml will be
done in the next patch.
Reviewed By: JonChesterfield, jdoerfert, scchan
Differential Revision: https://reviews.llvm.org/D104904
Peter Steinfeld [Mon, 19 Jul 2021 18:41:47 +0000 (11:41 -0700)]
[flang] Implement the runtime portion of the UNPACK intrinsic
I'd previously merged this into the fir-dev branch. This change is to
do the same thing to the main branch of llvm-project.
Differential Revision: https://reviews.llvm.org/D106294
Uday Bondhugula [Wed, 21 Jul 2021 14:50:59 +0000 (20:20 +0530)]
[MLIR] Add folder for zero trip count affine.for
AffineForOp's folding hook is expected to fold away trivially empty
affine.for. This allows simplification to happen as part of the
canonicalizer and from wherever the folding hook is used. While more
complex analysis based zero trip count detection is available from other
passes in analysis and transforms, simple and inexpensive folding had
been missing.
Also, update/improve affine.for op documentation clarifying semantics of
the result values for zero trip count loops.
Differential Revision: https://reviews.llvm.org/D106123
Marek Kurdej [Wed, 21 Jul 2021 13:58:17 +0000 (15:58 +0200)]
[libc++] Add `__libcpp_copysign` conditionally constexpr overloads.
This is a spin-off from D79555 review, that with this patch will be able to use `__libcpp_copysign` instead of adhoc `__copysign_constexpr` helper.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D106364
Uday Bondhugula [Sun, 18 Jul 2021 04:37:23 +0000 (10:07 +0530)]
[MLIR] Introduce a new rewrite driver to simplify supplied list of ops
Introduce a new rewrite driver (MultiOpPatternRewriteDriver) to rewrite
a supplied list of ops and other ops. Provide a knob to restrict
rewrites strictly to those ops or also to affected ops (but still not to
completely related ops).
This rewrite driver is commonly needed to run any simplification and
cleanup at the end of a transforms pass or transforms utility in a way
that only simplifies relevant IR. This makes it easy to write test cases
while not performing unrelated whole IR simplification that may
invalidate other state at the caller.
The introduced utility provides more freedom to developers of transforms
and transform utilities to perform focussed and local simplification. In
several cases, it provides greater efficiency as well as more
simplification when compared to repeatedly calling
`applyOpPatternsAndFold`; in other cases, it avoids the need to
undesirably call `applyPatternsAndFoldGreedily` to do unrelated
simplification in a FuncOp.
Update a few transformations that were earlier using
applyOpPatternsAndFold (SimplifyAffineStructures,
affineDataCopyGenerate, a linalg transform).
TODO:
- OpPatternRewriteDriver can be removed as it's a special case of
MultiOpPatternRewriteDriver, i.e., both can be merged.
Differential Revision: https://reviews.llvm.org/D106232
Quinn Pham [Wed, 21 Jul 2021 14:31:35 +0000 (09:31 -0500)]
[PowerPC] Move backend test to fix non PPC bots
Moving `llvm/test/CodeGen/builtins-ppc-xlcompat-fp.ll` to
`llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fp.ll`
David Spickett [Wed, 21 Jul 2021 14:18:39 +0000 (14:18 +0000)]
[PowerPC] Require power-pc target for new builtin test
The llvm test added in
e002d251dd34fc1855e3a17feafd358d55d92ed8
was missing a REQUIRES. Failed to run on our AArch64 only bot:
https://lab.llvm.org/buildbot/#/builders/171/builds/1262
Kerry McLaughlin [Wed, 21 Jul 2021 13:49:13 +0000 (14:49 +0100)]
Revert "[LV] Use lookThroughAnd with logical reductions"
Reverting patch due to buildbot failures.
This reverts commit
e22a59967251294ccdac6b43a06f48c1b7075240.
Simon Pilgrim [Wed, 21 Jul 2021 13:50:18 +0000 (14:50 +0100)]
[LoopVectorize] Regenerate sve-vector-reverse.ll test checks
Kazu Hirata [Wed, 21 Jul 2021 14:07:53 +0000 (07:07 -0700)]
[InstCombine] Remove CreateOverflowTuple (NFC)
The last use was removed On Jun 3, 2020 in commit
2a6c871596ce8bdd23501a96fd22f0f16d3cfcad.
Quinn Pham [Wed, 21 Jul 2021 12:46:22 +0000 (07:46 -0500)]
[PowerPC] Floating Point Builtins for XL Compat.
This patch is in a series of patches to provide
builtins for compatibility with the XL compiler.
This patch adds builtins related to floating point
operations
Reviewed By: #powerpc, nemanjai, amyk, NeHuang
Differential Revision: https://reviews.llvm.org/D103986
Jakub Kuderski [Tue, 20 Jul 2021 21:31:14 +0000 (17:31 -0400)]
[ADT] Add initializer_list constructor to SmallDenseMap
Make it easier to initialize small maps inline. Note that DenseMap already has an initializer_list constructor.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D106363
Simon Pilgrim [Wed, 21 Jul 2021 13:29:20 +0000 (14:29 +0100)]
[InstCombine] Regenerate gep-custom-dl.ll test checks
Hedin Garca [Tue, 20 Jul 2021 20:25:24 +0000 (20:25 +0000)]
[libc] Include nextafter's functions to Windows's entrypoints
Incorporated the varied functions for nextafter and refactored
NextAfterTest.h to correctly define bitWidthOfType for both
Linux and Windows; by letting FloatProperties take care
of the directives' logic based on the platform being used.
This allows to successfully run nextafter's tests.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106395
Sebastian Neubauer [Wed, 21 Jul 2021 13:20:10 +0000 (15:20 +0200)]
[AMDGPU] Improve killed check for vgpr optimization
The killed flag is not always set. E.g. when a variable is used in a
loop, it is never marked as killed, although it is unused in following
basic blocks. Also, we try to deprecate kill flags and not use them.
Check if the register is live in the endif block. If not, consider it
killed in the then and else blocks.
The vgpr-liverange tests have two new tests with loops
(pre-committed, so the diff is visible).
I also needed to change the subtarget to gfx10.1, otherwise calls
are not working.
Differential Revision: https://reviews.llvm.org/D106291
Sebastian Neubauer [Wed, 21 Jul 2021 13:15:46 +0000 (15:15 +0200)]
[AMDGPU] Precommit vgpr-liverange tests
Hedin Garca [Tue, 20 Jul 2021 19:58:05 +0000 (19:58 +0000)]
[libc] Append math functions to Window's entrypoints
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106391
Hedin Garca [Tue, 20 Jul 2021 19:00:19 +0000 (19:00 +0000)]
[libc] Exclude few unused bits from x86 state for Windows
Windows fenv_t does not include the MXCSR register and
the unused bits at the end of the x87 status. So we
exclude them in our struct definitions to make it
easy to read/write the state. getEnv and setEnv
were also excluded to avoid using MXCSR, but a
forthcoming patch will handle these functions.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D106386
Deep Majumder [Wed, 21 Jul 2021 12:49:57 +0000 (18:19 +0530)]
[analyzer] Fix for faulty namespace test in SmartPtrModelling
This patch:
- Fixes how the std-namespace test is written in SmartPtrModelling
(now accounts for functions with no Decl available)
- Adds the smart pointer checker flag check where it was missing
Differential Revision: https://reviews.llvm.org/D106296
Kirill Bobyrev [Wed, 21 Jul 2021 12:50:40 +0000 (14:50 +0200)]
[clangd] Cleanup FuzzyFindRequest serialization and dex benchmark
* Due to the LLVM's JSON library changes (?), FuzzyFindRequest serialization is
no longer valid since arrays are serialized as llvm::json::Array already.
Hence, current implementation creates a nested array.
* YAML format is no longer the default, mention this for the benchmark.
* FIXME is no longer relevant. I ran benchmarks that showed no improvement with
priority_queue years ago.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D106432
Guillaume Chatelet [Wed, 21 Jul 2021 12:48:09 +0000 (12:48 +0000)]
[llvm] Add enum iteration to Sequence
This patch allows iterating typed enum via the ADT/Sequence utility.
It also changes the original design to better separate concerns:
- `StrongInt` only deals with safe `intmax_t` operations,
- `SafeIntIterator` presents the iterator and reverse iterator
interface but only deals with safe `StrongInt` internally.
- `iota_range` only deals with `SafeIntIterator` internally.
This design ensures that operations are always valid. In particular,
"Out of bounds" assertions fire when:
- the `value_type` is not representable as an `intmax_t`
- iterator operations make internal computation underflow/overflow
- the internal representation cannot be converted back to `value_type`
Differential Revision: https://reviews.llvm.org/D106279
Simon Pilgrim [Wed, 21 Jul 2021 12:40:41 +0000 (13:40 +0100)]
[InstCombine] Add multiuse test for D106352
David Spickett [Wed, 21 Jul 2021 12:37:28 +0000 (12:37 +0000)]
[compiler-rt][hwasan] Update register-dump-read.c test
Since
d564cfb53c71dbbbd46b6719f5fe53d70313de45 moved
__hwasan_tag_mismatch4 this test has been reporting
a frame 0 of __hwasan_tag_mismatch_v2.
This failure can be seen on our bots:
https://lab.llvm.org/buildbot/#/builders/185/builds/170
Before the change:
#0 0xaaaaba100e40 in main <...>/register-dump-read.c:21:10
After the change:
#0 0xaaaab8494bec in __hwasan_tag_mismatch_v2 <...>/hwasan/hwasan_tag_mismatch_aarch64.S:147
#1 0xaaaab84b4df8 in main <..>/register-dump-read.c:14:10
Update the test to check for a main frame as either frame
0 or frame 1.
Roman Lebedev [Wed, 21 Jul 2021 12:21:37 +0000 (15:21 +0300)]
[NFC][VectorCombine] Load widening: add a few more negative tests
Simon Pilgrim [Wed, 21 Jul 2021 10:59:08 +0000 (11:59 +0100)]
IFSStub.cpp - consistently use default case to silence 'not all control paths return' MSVC warnings. NFCI.
David Green [Wed, 21 Jul 2021 10:34:30 +0000 (11:34 +0100)]
[LV] Make use of PatternMatchers in getReductionPatternCost. NFC
Pulled out of D106166, this modifies getReductionPatternCost to use
PatternMatchers, hopefully simplifying the code a little.
Jay Foad [Tue, 13 Jul 2021 16:03:57 +0000 (17:03 +0100)]
[AMDGPU] NFC refactoring in isel for buffer access intrinsics
Rename getBufferOffsetForMMO to updateBufferMMO and pass in the MMO to
be updated, in preparation for the bug fix in D106284.
Call updateBufferMMO consistently for all buffer intrinsics, even the
ones that use setBufferOffsets to decompose a combined offset
expression.
Add a getIdxEn helper function.
Differential Revision: https://reviews.llvm.org/D106354
Gabor Marton [Tue, 20 Jul 2021 15:34:02 +0000 (17:34 +0200)]
[Analyzer][solver][NFC] Add explanatory comments to trivial eq classes
Differential Revision: https://reviews.llvm.org/D106370
Simon Tatham [Wed, 21 Jul 2021 08:17:33 +0000 (09:17 +0100)]
[clang] Introduce SourceLocation::[U]IntTy typedefs.
This is part of a patch series working towards the ability to make
SourceLocation into a 64-bit type to handle larger translation units.
NFC: this patch introduces typedefs for the integer type used by
SourceLocation and makes all the boring changes to use the typedefs
everywhere, but for the moment, they are unconditionally defined to
uint32_t.
Patch originally by Mikhail Maltsev.
Reviewed By: tmatheson
Differential Revision: https://reviews.llvm.org/D105492
Sam McCall [Wed, 21 Jul 2021 09:31:52 +0000 (11:31 +0200)]
[clangd] Remove big PreambleData constructor. NFC
Rosie Sumpter [Thu, 15 Jul 2021 13:08:30 +0000 (14:08 +0100)]
[LoopFlatten][LoopInfo] Use Loop to identify latch compare instruction
Make getLatchCmpInst non-static and use it in LoopFlatten as a more
robust way of identifying the compare.
Differential Revision: https://reviews.llvm.org/D106256
Sven van Haastregt [Wed, 21 Jul 2021 09:01:19 +0000 (10:01 +0100)]
[OpenCL] Add cl_khr_extended_bit_ops
Add the builtins defined by Section 40 "Extended Bit Operations" in
the OpenCL Extension Specification.
Differential Revision: https://reviews.llvm.org/D106267
Kerry McLaughlin [Mon, 19 Jul 2021 12:32:11 +0000 (13:32 +0100)]
[LV] Use lookThroughAnd with logical reductions
If a reduction Phi has a single user which `AND`s the Phi with a type mask,
`lookThroughAnd` will return the user of the Phi and the narrower type represented
by the mask. Currently this is only used for arithmetic reductions, whereas loops
containing logical reductions will create a reduction intrinsic using the widened
type, for example:
for.body:
%phi = phi i32 [ %and, %for.body ], [ 255, %entry ]
%mask = and i32 %phi, 255
%gep = getelementptr inbounds i8, i8* %ptr, i32 %iv
%load = load i8, i8* %gep
%ext = zext i8 %load to i32
%and = and i32 %mask, %ext
...
^ this will generate an and reduction intrinsic such as the following:
call i32 @llvm.vector.reduce.and.v8i32(<8 x i32>...)
The same example for an add instruction would create an intrinsic of type i8:
call i8 @llvm.vector.reduce.add.v8i8(<8 x i8>...)
This patch changes AddReductionVar to call lookThroughAnd for other integer
reductions, allowing loops similar to the example above with reductions such
as and, or & xor to vectorize.
Reviewed By: david-arm, dmgreen
Differential Revision: https://reviews.llvm.org/D105632
Jan Kratochvil [Wed, 21 Jul 2021 08:41:44 +0000 (10:41 +0200)]
[nfc] [lldb] Rename GetRnglist() to GetRnglistTable()
My D99653 implemented a getter GetRnglist() for m_rnglist_table.
That was confusing as the getter returns DWARFDebugRnglistTable which
contains DWARFDebugRnglist as its elements.
Cullen Rhodes [Wed, 21 Jul 2021 08:35:34 +0000 (08:35 +0000)]
[AArch64][SME] Support .arch and .arch_extension assembler directives
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D105566