Jon Roelofs [Tue, 6 Jul 2021 15:28:11 +0000 (08:28 -0700)]
[GlobalISel] Tail call memcpy/memmove/memset even in the presence of copies
Differentail revision: https://reviews.llvm.org/D105382
Jon Roelofs [Fri, 2 Jul 2021 20:08:57 +0000 (13:08 -0700)]
[GlobalISel] Mark memcpy/memmove/memset as thisreturn
https://clang.godbolt.org/z/9az64j8W6
rdar://
77466123
Differential revision: https://reviews.llvm.org/D105370
Hanhan Wang [Wed, 21 Jul 2021 00:03:26 +0000 (17:03 -0700)]
[mlir][Linalg] Update signatures of the callback functions.
This allows caller to use non-const functions, e.g., `getOperandNumber`, etc. It
is expected that OpOperand is not modified in a callback function.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D106322
Geoffrey Martin-Noble [Tue, 20 Jul 2021 23:23:33 +0000 (16:23 -0700)]
[Bazel] Remove explicit relative_to_caller_repository
This is the default and the argument is deprecated. The documentation
indicating it's the default is only since 4.0
(https://docs.bazel.build/versions/4.0.0/skylark/lib/Label.html#Label),
but looking at the code it has been the default since its introduction
in https://bazel.googlesource.com/bazel/+/
6f15335dea with Bazel 0.2.1
(https://bazel.googlesource.com/bazel/+show/0.2.1/CHANGELOG.md)
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D106411
Walter Erquinigo [Sat, 17 Jul 2021 02:16:03 +0000 (19:16 -0700)]
[intel pt] Add TSC timestamps
Differential Revision: https://reviews.llvm.org/D106328
Lang Hames [Tue, 20 Jul 2021 23:22:55 +0000 (09:22 +1000)]
Revert "[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform."
Reverts commit
fe1fa43f16beac1506a2e73a9f7b3c81179744eb while I investigate
failures on Linux.
Lang Hames [Tue, 20 Jul 2021 06:41:34 +0000 (16:41 +1000)]
[ORC][ORC-RT] Add initial native-TLV support to MachOPlatform.
Adds code to LLVM (MachOPlatform) and the ORC runtime to support native MachO
thread local variables. Adding new TLVs to a JITDylib at runtime is supported.
On the LLVM side MachOPlatform is updated to:
1. Identify thread local variables in the LinkGraph and lower them to GOT
accesses to data in the __thread_data or __thread_bss sections.
2. Merge and report the address range of __thread_data and thread_bss sections
to the runtime.
On the ORC runtime a MachOTLVManager class introduced which records the address
range of thread data/bss sections, and creates thread-local instances from the
initial data on demand. An orc-runtime specific tlv_get_addr implementation is
included which saves all register state then calls the MachOTLVManager to get
the address of the requested variable for the current thread.
Lang Hames [Tue, 20 Jul 2021 08:16:39 +0000 (18:16 +1000)]
[JITLink][MachO] Detect MachO::S_THREAD_LOCAL_ZEROFILL sections as zero-fill.
This will be used in upcoming MachO native TLV support patches to LLVM and
the ORC runtime.
Lang Hames [Tue, 20 Jul 2021 10:28:29 +0000 (20:28 +1000)]
[JITLink] Add support for moving blocks and symbols between sections.
LinkGraph::transferBlock can be used to move a block and all associated symbols
from one section to another.
LinkGraph::mergeSections moves all blocks and sections from a source section to
a destination section.
Albion Fung [Tue, 20 Jul 2021 21:58:20 +0000 (16:58 -0500)]
[PowerPC] Implemented mtmsr, mfspr, mtspr Builtins
Implemented builtins for mtmsr, mfspr, mtspr on PowerPC;
the patch is intended for XL Compatibility.
Differential revision: https://reviews.llvm.org/D106130
Aditya Nandakumar [Tue, 20 Jul 2021 22:44:59 +0000 (15:44 -0700)]
[NFC][AssemblyWriter] Allow AssemblyWriter::printBasicBlock() to print blocks that don't have parents.
Remove the assert in AssemblyWriter::printBasicBlock() and
in BasicBlock::isEntryBlock() that require blocks to have parents.
Instead, have BasicBlock::isEntryBlock() return false for unattached
blocks. This allows us to call these functions for blocks that are
not yet added to a module which is a useful debugging capability.
Committing for xiaoqing_wu
https://reviews.llvm.org/D106127k
Jon Roelofs [Tue, 20 Jul 2021 22:37:16 +0000 (15:37 -0700)]
[tests] Move new tests into the PowerPC folder
That way they get marked as UNSUPPORTED by LIT when the ppc backend has not
been built.
Jon Roelofs [Tue, 20 Jul 2021 18:01:54 +0000 (11:01 -0700)]
[AArch64][GlobalISel] Legalize ctpop for v2s64, v2s32, v4s32, v4s16, v8s16
https://llvm.godbolt.org/z/nTTK6M5qe
Differential revision: https://reviews.llvm.org/D106388
Fangrui Song [Tue, 20 Jul 2021 22:27:51 +0000 (15:27 -0700)]
[ELF][test] Add -DAG
The guid of a local linkage variable has the module path encoded, so the
order between a local linkage variable and a non-local linkage variable
isn't guaranteed.
Sanjay Patel [Tue, 20 Jul 2021 22:23:20 +0000 (18:23 -0400)]
[ConstantFolding] avoid crashing on a fake math library call
https://llvm.org/PR50960
peter klausler [Tue, 20 Jul 2021 18:39:21 +0000 (11:39 -0700)]
[flang] Don't require newline at EOF in unformatted sequential runtime input
F18 was sigalling an end-of-file error condition when reading an
unformatted sequential input file without an ultimate newline
(or CR-LF). Other Fortran implementations can handle it, so change
the runtime to support it.
Differential Revision: https://reviews.llvm.org/D106321
peter klausler [Mon, 19 Jul 2021 18:53:20 +0000 (11:53 -0700)]
[flang] Run-time derived type initialization and destruction
Use derived type information tables to drive default component
initialization (when needed), component destruction, and calls to
final subroutines. Perform these operations automatically for
ALLOCATE()/DEALLOCATE() APIs for allocatables, automatics, and
pointers. Add APIs for use in lowering to perform these operations
for non-allocatable/automatic non-pointer variables.
Data pointer component initialization supports arbitrary constant
designators, a F'2008 feature, which may be a first for Fortran
implementations.
Differential Revision: https://reviews.llvm.org/D106297
Rob Suderman [Tue, 20 Jul 2021 22:07:04 +0000 (15:07 -0700)]
[mlir][tosa] Added tosa to linalg lowering to unstrided transposed conv
The unstrided transposed conv can be represented as a regular convolution.
Lower to this variant to handle the basic case. This includes transitioning from
the TC defined convolution operation and a yaml defined one.
Reviewed By: NatashaKnk
Differential Revision: https://reviews.llvm.org/D106389
Geoffrey Martin-Noble [Tue, 20 Jul 2021 21:33:50 +0000 (14:33 -0700)]
[Bazel] Fix Exegesis target reference and remove stray visibility
LLVM GN Syncbot [Tue, 20 Jul 2021 21:53:24 +0000 (21:53 +0000)]
[gn build] Port
808bbc2c4702
Alex Lorenz [Tue, 20 Jul 2021 21:52:58 +0000 (14:52 -0700)]
[clang] Fix the capitalization of the DarwinSDKInfoTest unittest filename to avoid case-sensitive FS build errors
Matheus Izvekov [Mon, 19 Jul 2021 19:35:18 +0000 (21:35 +0200)]
[clang] fix oops: enable implicit moves in MSVC compatibility mode
When disabling simpler implicit moves in MSVC compatibility mode as
a workaround in D105518, we forgot to make the opposite change and
enable regular (P1825) implicit moves in the same mode.
As a result, we were not doing any implicit moves at all. OOPS!
This fixes it and adds test for this.
This is a fix to a temporary workaround, there is ongoing
work to replace this, applying the workaround only to
system headers and the ::stl namespace.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D106303
Alex Lorenz [Wed, 14 Jul 2021 04:49:56 +0000 (21:49 -0700)]
[clang][darwin] Add support for macOS -> Mac Catalyst
version remapping to the Darwin SDK Info
Differential Revision: https://reviews.llvm.org/D105958
Roman Lebedev [Tue, 20 Jul 2021 21:24:47 +0000 (00:24 +0300)]
[NFC][VectorCombine] Add tests for widening of partial vector load
Eli Friedman [Tue, 20 Jul 2021 20:49:10 +0000 (13:49 -0700)]
[AArch64] Add tests for 128-bit atomic loads with casp available.
We currently don't use casp; maybe we should?
Sami Tolvanen [Tue, 20 Jul 2021 20:56:35 +0000 (13:56 -0700)]
Revert "ThinLTO: Fix inline assembly references to static functions with CFI"
This reverts commit
700d07f8ce6f2879610fd6b6968b05c6f17bb915.
Reverting due to a ThinLTO+CFI breakage on -msvc targets.
Martin Storsjö [Tue, 20 Jul 2021 20:56:00 +0000 (23:56 +0300)]
[LLD] [COFF] Add a couple "MinGW only" comments re linking against DLLs. NFC.
This was requested in the post-commit review of D104530.
LLVM GN Syncbot [Tue, 20 Jul 2021 20:51:01 +0000 (20:51 +0000)]
[gn build] Port
05a6d74c4845
Albion Fung [Tue, 20 Jul 2021 20:20:03 +0000 (15:20 -0500)]
[PowerPC] Store, load, move from and to registers related builtins
This patch implements store, load, move from and to registers related
builtins, as well as the builtin for stfiw. The patch aims to provide
feature parady with xlC on AIX.
Differential revision: https://reviews.llvm.org/D105946
Vincent Lee [Tue, 20 Jul 2021 01:52:45 +0000 (18:52 -0700)]
Recommit "[lld-macho] Use DO_BIND_ADD_ADDR_IMM_SCALED for bind opcodes"
Implement pass 3 of bind opcodes from ld64 (which supports both 32-bit and 64-bit).
Pass 3 implementation condenses BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB opcode
to BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED. This change is already behind an
O2 flag so it shouldn't impact current performance. I verified ld64's output with x86_64 LLD
and they were both emitting the same optimized bind opcodes (although in a slightly different
order). Tested with arm64_32 LLD and compared that with x86 LLD that the order of the bind
opcodes are the same (offset values are different which should be expected).
Reviewed By: int3, #lld-macho, MaskRay
Differential Revision: https://reviews.llvm.org/D106128
Melanie Blower [Tue, 20 Jul 2021 20:40:55 +0000 (16:40 -0400)]
Revert "[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly"
This reverts commit
ce8024e8ff76e7be8b9ffa1a39d1dc9310bf74c7.
There are a couple buildbot problems
Sterling Augustine [Tue, 20 Jul 2021 17:29:22 +0000 (10:29 -0700)]
Consolidate string types into ptr and length representations.
After rGbbbc4f110e35ac709b943efaa1c4c99ec073da30, we can move
any string type that has convenient pointer and length fields
into the PtrAndLengthKind, reducing the amount of code.
Differential Revision: https://reviews.llvm.org/D106381
Jessica Paquette [Tue, 20 Jul 2021 01:30:07 +0000 (18:30 -0700)]
[AArch64][GlobalISel] Select llvm.aarch64.neon.st2 intrinsics
Add manual selection code similar to the code in AArch64ISelDAGToDAG, and add
`createTuple` helpers similar to the code there as well.
This accounted for around 111 fallbacks while building clang for AArch64 with
GlobalISel.
This also should make it easy to add selection code for other store
intrinsics.
As a minor cleanup, this uses `createQTuple` in the other place where we use
REG_SEQUENCE.
Differential Revision: https://reviews.llvm.org/D106332
Eli Friedman [Tue, 20 Jul 2021 20:20:02 +0000 (13:20 -0700)]
[AArch64] Use the CMP_SWAP_128 variants added in
843c6140.
Accidentally forgot to flip the opcode... and I didn't notice because it
was working fine for the GlobalISel.
Alex Lorenz [Wed, 30 Jun 2021 14:44:42 +0000 (07:44 -0700)]
[clang] NFC, move DarwinSDKInfo to lib/Basic
This is a preparation commit for https://reviews.llvm.org/D105958
Fangrui Song [Tue, 20 Jul 2021 20:22:00 +0000 (13:22 -0700)]
[LTO] Add SelectionKind to IRSymtab and use it in ld.lld/LLVMgold
In PGO, a C++ external linkage function `foo` has a private counter
`__profc_foo` and a private `__profd_foo` in a `comdat nodeduplicate`.
A `__attribute__((weak))` function `foo` has a weak hidden counter `__profc_foo`
and a private `__profd_foo` in a `comdat nodeduplicate`.
In `ld.lld a.o b.o`, say a.o defines an external linkage `foo` and b.o
defines a weak `foo`. Currently we treat `comdat nodeduplicate` as `comdat any`,
ld.lld will incorrectly consider `b.o:__profc_foo` non-prevailing. In the worst
case when `b.o:__profd_foo` is retained and `b.o:__profc_foo` isn't, there will
be dangling reference causing an `undefined hidden symbol` error.
Add SelectionKind to `Comdat` in IRSymtab and let linkers ignore nodeduplicate comdat.
Differential Revision: https://reviews.llvm.org/D106228
Melanie Blower [Tue, 20 Jul 2021 20:01:51 +0000 (16:01 -0400)]
[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly
The Intel compiler ICC supports the option "-fp-model=(source|double|extended)"
which causes the compiler to use a wider type for intermediate floating point
calculations. Also supported is a way to embed this effect in the source
program with #pragma float_control(source|double|extended).
This patch extends pragma float_control syntax, and also adds support
for a new floating point option "-ffp-eval-method=(source|double|extended)".
source: intermediate results use source precision
double: intermediate results use double precision
extended: intermediate results use extended precision
Reviewed By: Aaron Ballman
Differential Revision: https://reviews.llvm.org/D93769
Rob Suderman [Mon, 28 Jun 2021 21:36:47 +0000 (14:36 -0700)]
[mlir][tosa] Add quantized lowering for matmul and fully_connected
Added the named op variants for quantized matmul and quantized batch matmul
with the necessary lowerings/tests from tosa's matmul/fully connected ops.
Current version does not use the contraction op interface as its verifiers
are not compatible with scalar operations.
Differential Revision: https://reviews.llvm.org/D105063
Alex Lorenz [Wed, 30 Jun 2021 14:34:26 +0000 (07:34 -0700)]
[clang][darwin] add support for Mac Catalyst availability
This commit adds support for Mac Catalyst availability attribute, as
supported by the Apple clang compiler. A follow-up commit will provide
additional support for inferring Mac Catalyst availability from macOS
availability using the mapping in the SDKSettings.json.
Differential Revision: https://reviews.llvm.org/D105052
Fangrui Song [Tue, 20 Jul 2021 19:51:44 +0000 (12:51 -0700)]
[AArch64] Delete unused Opcode after D106039
Fangrui Song [Tue, 20 Jul 2021 19:47:10 +0000 (12:47 -0700)]
[IR] Rename `comdat noduplicates` to `comdat nodeduplicate`
In the textual format, `noduplicates` means no COMDAT/section group
deduplication is performed. Therefore, if both sets of sections are retained, and
they happen to define strong external symbols with the same names,
there will be a duplicate definition linker error.
In PE/COFF, the selection kind lowers to `IMAGE_COMDAT_SELECT_NODUPLICATES`.
The name describes the corollary instead of the immediate semantics. The name
can cause confusion to other binary formats (ELF, wasm) which have implemented/
want to implement the "no deduplication" selection kind. Rename it to be clearer.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D106319
Shilei Tian [Tue, 20 Jul 2021 19:45:26 +0000 (15:45 -0400)]
[OpenMP][deviceRTLs] Update return type of function __kmpc_parallel_level
In `deviceRTLs`, the parallel level is stored in a shared variable of type `uint8_t`.
`__kmpc_parallel_level` currently returns a 16-bit interger. This patch first
changes the return type of the function to `uint8_t`, same as the shared variable,
and then corrects function type which was updated in D105955.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106384
Shilei Tian [Tue, 20 Jul 2021 19:39:08 +0000 (15:39 -0400)]
[NFC][OpenMP] Fix an issue that no CHECK in test cases
This fixes the complaint from FileCheck.
Reviewed By: abhinavgaba, jdoerfert
Differential Revision: https://reviews.llvm.org/D106387
Eli Friedman [Tue, 20 Jul 2021 19:35:49 +0000 (12:35 -0700)]
[AArch64] Fix i128 cmpxchg using ldxp/stxp.
Basically two parts to this fix:
1. Stop using AtomicExpand to expand cmpxchg i128
2. Fix AArch64ExpandPseudoInsts to use a correct expansion.
From ARM architecture reference:
To atomically load two 64-bit quantities, perform a Load-Exclusive
pair/Store-Exclusive pair sequence of reading and writing the same value
for which the Store-Exclusive pair succeeds, and use the read values
from the Load-Exclusive pair.
Fixes https://bugs.llvm.org/show_bug.cgi?id=51102
Differential Revision: https://reviews.llvm.org/D106039
Sam Clegg [Tue, 20 Jul 2021 18:49:37 +0000 (11:49 -0700)]
[lld][WebAssembly] Error on import of TLS symbols in shared libraries
In https://reviews.llvm.org/D102044 we made exporting a TLS symbol
into an error, but we also want to error on import.
See https://github.com/emscripten-core/emscripten/issues/14461
Differential Revision: https://reviews.llvm.org/D106385
Nikita Popov [Tue, 20 Jul 2021 18:21:08 +0000 (20:21 +0200)]
[AttrBuilder] Assert correct attribute kind
Make sure that addAttribute() is only used with simple enum
attributes. Integer and type attributes need to provide an
additional value/type.
Albion Fung [Tue, 20 Jul 2021 18:35:24 +0000 (13:35 -0500)]
[PowerPC] Extra test case for LDARX
An extra test case added for the builtin __LDARX.
Differential revision: https://reviews.llvm.org/D105926
Sam Clegg [Thu, 15 Jul 2021 00:16:15 +0000 (17:16 -0700)]
Reland "[lld][WebAssembly] Cleanup duplicate fields in Symbols.h. NFC"
This avoids duplication and simplifies the code in several places
without increasing the size of the symbol union (at least not
above the assert'd limit of 120 bytes).
Originally commit:
9b965b37c75d626c01951184088314590e38d299
Reverted in:
16aac493e59519377071e900d119ba2e7e5b525d.
Differential Revision: https://reviews.llvm.org/D106026
Nikita Popov [Tue, 20 Jul 2021 19:05:07 +0000 (21:05 +0200)]
[BitcodeReader] Handle type attributes more explicitly (NFCI)
For attributes in legacy bitcode that are now typed, explicitly
create a type attribute with nullptr type, the same as we do
for the attribute group representation. This is so we can assert
use of the correct constructor in the future.
Nikita Popov [Tue, 20 Jul 2021 18:45:18 +0000 (20:45 +0200)]
[Orc] Fix sret/byval attributes in test (NFC)
This was placing sret/byval attributes without type argument on
non-pointer arguments. Make this valid IR by using pointer
arguments and passing the corresponding attribute type argument.
peter klausler [Tue, 20 Jul 2021 17:20:47 +0000 (10:20 -0700)]
[flang] Fix legitimate warning from latest GCC
A rank-0 static descriptor needs to be a vector; it's for
"v-list" values in defined derived type formatted I/O.
(Pushed without pre-review due to high confidence and an
unwell buildbot.)
Graham Yiu [Tue, 20 Jul 2021 16:14:21 +0000 (09:14 -0700)]
[NFC] Update code owners file
- Replace Pete with Mark as owner of ARC backend
- Re-order Philip to be sorted by first name
Nikita Popov [Tue, 20 Jul 2021 17:57:11 +0000 (19:57 +0200)]
[ThinTLOBitcodeWriter] Fix unused variable warning (NFC)
Nikita Popov [Mon, 12 Jul 2021 20:30:37 +0000 (22:30 +0200)]
[Verifier] Check byval/etc type when comparing ABI attributes
For musttail calls, ABI attributes between the function and the
musttail call must match. The current check discards the type of
type attributes like byval, which means that it will consider
byval(i32) and byval(i64) (or similar) as compatible.
I assume this is a leftover from before these attributes had a
type argument. Ran into this while trying to tighten an assertion
in AttrBuilder.
Differential Revision: https://reviews.llvm.org/D105841
Alex Lorenz [Thu, 15 Jul 2021 20:52:38 +0000 (13:52 -0700)]
[clang-scan-deps] ignore top-level module dependencies that aren't actually imported
Whenever -fmodule-name=top_level_module name is parsed, and clang actually tries to
import top_level_module, the headers are imported textually and the module isn't actually
built. However, the dependency scanner could still record it as a potential dependency
if the module was reimported and thus recorded by the preprocessor callbacks.
This change avoids collecting this kind of module as a dependency by verifying that we don't
collect top level modules without actual PCM files.
Differential Revision: https://reviews.llvm.org/D106100
Victor Huang [Tue, 20 Jul 2021 16:51:42 +0000 (11:51 -0500)]
[PowerPC] Add PowerPC cmpb builtin and emit target indepedent code for XL compatibility
This patch is in a series of patches to provide builtins for compatibility
with the XL compiler. This patch add the builtin and emit target independent
code for __cmpb.
Reviewed By: nemanjai, #powerpc
Differential revision: https://reviews.llvm.org/D105194
Jacob Hegna [Tue, 20 Jul 2021 02:55:10 +0000 (02:55 +0000)]
Fix Threshold overwrite bug in the Oz inlining model features.
Differential Revision: https://reviews.llvm.org/D106336
Zequan Wu [Mon, 19 Jul 2021 21:26:00 +0000 (14:26 -0700)]
[Utils] Add -compilation-dir flag to prepare-code-coverage-artifact.py
Differential Revision: https://reviews.llvm.org/D106314
Nikita Popov [Sun, 18 Jul 2021 16:33:32 +0000 (18:33 +0200)]
[Inline] Fix noalias addition on simplified instructions (PR50589)
When adding noalias/alias.scope metadata, we analyze the instructions
of the original callee, and then place metadata on the corresponding
inlined instructions in the caller as provided by VMap. However, this
assumes that this actually a clone of the instruction, rather than
the result of simplification. If simplification occurred, the
instruction that VMap points to may not have any relationship as far
as ModRef behavior is concerned.
Fix this by tracking simplified instructions during cloning and then
only processing instructions that have not been simplified. This is
done with an additional map form original to cloned instruction,
into which we only insert if no simplification is performed. The
mapping in VMap can then be compared to this map. If they're the
same, the instruction hasn't been simplified. (I originally wanted
to only track a set of simplified instructions, but that wouldn't
work if the instruction only gets simplified afterwards, e.g. based
on rewritten phis.)
Fixes https://bugs.llvm.org/show_bug.cgi?id=50589.
Differential Revision: https://reviews.llvm.org/D106242
Fangrui Song [Tue, 20 Jul 2021 17:50:11 +0000 (10:50 -0700)]
[PowerPC][test] Don't write to srcdir
Mark de Wever [Tue, 20 Jul 2021 17:48:16 +0000 (19:48 +0200)]
[libc++][doc] Fixes a broken link.
Jacques Pienaar [Tue, 20 Jul 2021 17:44:48 +0000 (10:44 -0700)]
[mlir][ods] Add nested OpTrait
Allows for grouping OpTraits with list of OpTrait to make it easier to group OpTraits together without needing to use list concats (e.g., enable using `[Traits, ..., UsefulGroupOfTraits, Others, ...]` instead of `[Traits, ...] # UsefulGroupOfTraits # [Others, ...]`). Flatten in construction of Operation. This recurses here as the expectation is that these aren't expected to be deeply nested (most likely only 1 level of nesting).
Differential Revision: https://reviews.llvm.org/D106223
Sami Tolvanen [Fri, 16 Jul 2021 22:53:52 +0000 (15:53 -0700)]
ThinLTO: Fix inline assembly references to static functions with CFI
Create an internal alias with the original name for static functions
that are renamed in promoteInternals to avoid breaking inline
assembly references to them. This version uses module inline assembly
to avoid issues with LowerTypeTestsModule.
Relands commmit
8e3b5cb39eef462943ed7556469604ce25c07a1d with arch
specific tests fixed.
Link: https://github.com/ClangBuiltLinux/linux/issues/1354
Reviewed By: nickdesaulniers, pcc
Differential Revision: https://reviews.llvm.org/D104058
Arthur Eubanks [Mon, 19 Jul 2021 17:32:12 +0000 (10:32 -0700)]
[NewPM] Print pre-transformation IR name in --print-after-all
Sometimes a transformation can change the name of some IR (e.g. an SCC
with functions added/removed). This can be confusing when debug logging
doesn't match the post-transformation name. The specific example I came
across was that --print-after-all said the inliner was working on an SCC
that only contained one function, but calls in multiple functions were
getting inlined. After all inlining, the current SCC only contained one
function.
Piggyback off of the existing logic to handle invalidated IR +
--print-module-scope. Simply always store the IR description and use
that.
Reviewed By: jamieschmeiser
Differential Revision: https://reviews.llvm.org/D106290
Nancy Wang [Tue, 20 Jul 2021 17:02:05 +0000 (13:02 -0400)]
[SystemZ][z/OS][libcxx]: fix libcxx test cases related to codecvt class UTF8
This PR to fix a few test cases related to class https://en.cppreference.com/w/cpp/locale/codecvt , as mentioned in document, class is converting UTF16 and UTF8 or UTF32 and UTF8, character type is deprecated in c++20 and it needs explicitly specify it is UTF8 string literal. Current test cases assume 1 byte character is ASCII or Unicode character which is not true on z/OS platform. UTF8/16/32 information can be found in https://naveenr.net/unicode-character-set-and-utf-8-utf-16-utf-32-encoding/ and EBCDIC and ASCII character value can be found in http://www.simotime.com/asc2ebc1.htm
Differential Revision: https://reviews.llvm.org/D106153
Nancy Wang [Tue, 20 Jul 2021 16:54:20 +0000 (12:54 -0400)]
[SystemZ][z/OS][libcxx]: fix libcxx test cases related to codecvt class UTF16/32
This PR is to fix a few UTF16 and UTF32 related test cases that are testing member functions for https://en.cppreference.com/w/cpp/locale/codecvt class , functions are converting from UTF16, UTF32 to UTF8 or vise visa. Test cases need to explicitly specify it is UNICODE character for UTF16/32 type in order to be valid tests to match type in documentation. it assumes it will be ASCII or UTF8 type for 1 byte character ( value range from 1 to 127 ), which is not true on z/OS in EBCDIC mode. For information related to UTF16/32 , please see https://naveenr.net/unicode-character-set-and-utf-8-utf-16-utf-32-encoding/ , and EBCDIC/ASCII character value can be found in http://www.simotime.com/asc2ebc1.htm
Differential Revision: https://reviews.llvm.org/D106151
Giorgis Georgakoudis [Tue, 20 Jul 2021 02:18:29 +0000 (19:18 -0700)]
[OpenMP] Set RequiresFullRuntime false in SPMDization
SPMDization in D102307 does not change the RequiresFullRuntime argument of kmpc_target_init/deinit calls. However, the constraints of SPMDization detection for converting a target region to SPMD mode should guarantee that the region does not require full runtime support. Hence, this patch sets RequiresFullRuntime to false for improved execution performance.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D105556
Joseph Huber [Tue, 20 Jul 2021 16:52:00 +0000 (12:52 -0400)]
[OpenMP] Change AMDGCN to AMDGPU in the Cmake Module
Summary:
Change the name for targeting AMD offloading.
Rahul Joshi [Tue, 20 Jul 2021 15:56:35 +0000 (08:56 -0700)]
[MLIR][NFC] Minor cleanup for BufferDeallocation pass.
- Change walkReturnOperations() to be a non-template and look at block terminator
for ReturnLike trait.
- Clarify description of validateSupportedControlFlow
- Eliminate unused argument in Backedges::recurse.
- Eliminate repeated calls to getFunction()
- Fix wording for non-SCF loop failure
Differential Revision: https://reviews.llvm.org/D106373
Joseph Huber [Tue, 20 Jul 2021 16:04:13 +0000 (12:04 -0400)]
[OpenMP][Documentation] Fix hyperlink location
Fixes the documentation hyperlinks not showing the header.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106374
Fangrui Song [Tue, 20 Jul 2021 16:34:35 +0000 (09:34 -0700)]
[test] Avoid llvm-symbolizer/llvm-addr2line one-dash long options
Shimin Cui [Tue, 20 Jul 2021 16:27:26 +0000 (12:27 -0400)]
This patch extends the OptimizeGlobalAddressOfMalloc to handle the null check of global pointer variables. It is disabled with https://reviews.llvm.org/rGb7cd291c1542aee12c9e9fde6c411314a163a8ea. This PR is to reenable it while fixing the original problem reported. The fix is to set the store value correctly when creating store for the new created global init bool symbol.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D102711
Craig Topper [Tue, 20 Jul 2021 16:10:45 +0000 (09:10 -0700)]
[RISCV] Teach RISCVMatInt about cases where it can use LUI+SLLI to replace LUI+ADDI+SLLI for large constants.
If we need to shift left anyway we might be able to take advantage
of LUI implicitly shifting its immediate left by 12 to cover part
of the shift. This allows us to use more bits of the LUI immediate
to avoid an ADDI.
isDesirableToCommuteWithShift now considers compressed instruction
opportunities when deciding if commuting should be allowed.
I believe this is the same or similar to one of the optimizations
from D79492.
Reviewed By: luismarques, arcbbb
Differential Revision: https://reviews.llvm.org/D105417
Craig Topper [Tue, 20 Jul 2021 16:09:46 +0000 (09:09 -0700)]
[RISCV] Add -mattr=+c command lines to add-before-shl.ll to prepare for D105417. NFC
Fangrui Song [Tue, 20 Jul 2021 16:18:24 +0000 (09:18 -0700)]
[Driver] Detect libstdc++ include paths for native gcc on 32-bit non-Debian Linux
Fixes https://bugs.llvm.org/show_bug.cgi?id=50303
Differential Revision: https://reviews.llvm.org/D106119
Quinn Pham [Tue, 20 Jul 2021 14:42:14 +0000 (09:42 -0500)]
[PowerPC] Semachecking for XL compat builtin icbt
This patch is in a series of patches to provide builtins for compatibility with the XL compiler.
This patch adds semachecking for an already implemented builtin, `__icbt`. `__icbt` is only
valid for Power8 and up.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D105834
Craig Topper [Tue, 20 Jul 2021 15:46:21 +0000 (08:46 -0700)]
[RISCV] Add custom isel to select (and (srl X, C1), C2) and (and (shl X, C1), C2)
Replace some existing isel patterns that are covered by the new
code. SLLIUWPat has been removed in favor of folding its root case
into the new code. The other uses in isel patterns for shXadd.uw
have been switched to using hardcoded AND masks.
This is based on the original version of D49585 from ARM. The final
version of that was made a DAG combine, but I've chosen to keep it
as custom isel. I'm not convinced DAG combine is as good with
shift pairs as it is with and+shift. I saw some issues optimizing
the shifts created by vscale lowering if an and isn't created for
from a shift pair.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D106230
Stefan Pintilie [Mon, 12 Jul 2021 17:47:44 +0000 (12:47 -0500)]
[PowerPC] Inefficient register allocation of ACC registers results in many copies.
ACC registers are a combination of four consecutive vector registers.
If the vector registers are assigned first this often forces a number
of copies to appear just before the ACC register is created. If the ACC
register is assigned first then fewer copies are generated when the vector
registers are assigned.
This patch tries to force the register allocator to assign the ACC registers first
and then the UACC registers and then the vector pair registers. It does this
by changing the priority of the register classes.
This patch also adds hints to help the register allocator assign UACC registers from
known ACC registers and vector pair registers from known UACC registers.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D105854
Sterling Augustine [Fri, 16 Jul 2021 20:17:16 +0000 (13:17 -0700)]
Avoid keeping internal string_views in Twine.
This is a follow-up to https://reviews.llvm.org/D103935
A Twine's internal layout should not depend on which version of the
C++ standard is in use. Dynamically linking binaries compiled with two
different layouts (eg, --std=c++14 vs --std=c++17) ends up
problematic.
This change avoids that issue by immediately converting a
string_view to a pointer-and-length at the cost of an extra eight-bytes
in Twine.
Differential Revision: https://reviews.llvm.org/D106186
Craig Topper [Tue, 20 Jul 2021 15:32:15 +0000 (08:32 -0700)]
[RISCV] Use unordered indexed loads for MGATHER.
I don't think the semantics of the llvm masked gather intrinsic care
about the order the elements are loaded. For example, type legalization
by splitting will chain them in parallel. This is different than
scatter which we do chain in order.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D106025
David Green [Tue, 20 Jul 2021 15:44:50 +0000 (16:44 +0100)]
[LV] Change interface of getReductionPatternCost to return Optional
Currently the Instruction cost of getReductionPatternCost returns an
Invalid cost to specify "did not find the pattern". This changes that to
return an Optional with None specifying not found, allowing Invalid to
mean an infinite cost as is used elsewhere.
Differential Revision: https://reviews.llvm.org/D106140
Geoffrey Martin-Noble [Tue, 20 Jul 2021 15:33:51 +0000 (08:33 -0700)]
[Bazel] Update for
bc1a2979fc
Update Bazel build configuration for
https://github.com/llvm/llvm-project/commit/
bc1a2979fc70
by adding missing dep to clang tooling unit tests.
Joel E. Denny [Tue, 20 Jul 2021 15:17:56 +0000 (11:17 -0400)]
[UpdateCCTestChecks] Implement --global-hex-value-regex
For example, in OpenMP offload codegen tests, global variables like
`.offload_maptypes*` are much easier to read in hex.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D104743
Joel E. Denny [Tue, 20 Jul 2021 15:17:50 +0000 (11:17 -0400)]
[UpdateCCTestChecks] Implement --global-value-regex
`--check-globals` activates checks for all global values, and
`--global-value-regex` filters them. For example, I'd like to use it
in OpenMP offload codegen tests to check only global variables like
`.offload_maptypes*`.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D104742
LLVM GN Syncbot [Tue, 20 Jul 2021 15:13:51 +0000 (15:13 +0000)]
[gn build] Port
1a29403d2f8a
zoecarver [Thu, 27 May 2021 16:23:19 +0000 (09:23 -0700)]
[libcxx][ranges] Add common_iterator.
Differential Revision: https://reviews.llvm.org/D103335
Kazu Hirata [Tue, 20 Jul 2021 15:07:04 +0000 (08:07 -0700)]
[SampleProfile] Remove ProfileIsValid (NFC)
The last use was removed on Jan 22, 2021 in commit
c9cd9a006632419ce7346e50564e6347a93181cc.
Rahul Joshi [Tue, 20 Jul 2021 00:19:29 +0000 (17:19 -0700)]
[NFC] Fix some comments and only look at terminators when looking for ReturnLike ops
Differential Revision: https://reviews.llvm.org/D106326
Melanie Blower [Tue, 20 Jul 2021 14:56:33 +0000 (10:56 -0400)]
[clang][patch][NFC] Refactor calculation of FunctionDecl to avoid duplicate code
Caroline Concatto [Wed, 5 May 2021 14:20:16 +0000 (15:20 +0100)]
[NFC][LoopVectorizer] Remove VF.isScalable() assertion from collectInstsToScalarize and getInstructionCost
This patch removes the assertion when VF is scalable and replaces
getKnownMinValue() by getFixedValue(), so it still guards the code against
scalable vector types.
The assertions were used to guarantee that getknownMinValue were not used for
scalable vectors.
Differential Revision: https://reviews.llvm.org/D106359
Anirudh Prasad [Tue, 20 Jul 2021 14:50:18 +0000 (10:50 -0400)]
[SystemZ][z/OS] Add GOFF support to file magic identification
- This patch adds in the GOFF format to the file magic identification logic in LLVM
- Currently, for the object file support, GOFF is marked as having as an error
- However, this is only temporary until https://reviews.llvm.org/D98437 is merged in
Reviewed By: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D105993
Quinn Pham [Tue, 20 Jul 2021 13:57:18 +0000 (08:57 -0500)]
[PowerPC] Restore FastMathFlags of Builder for Vector FDiv Builtins
This patch fixes `__builtin_ppc_recipdivf`, `__builtin_ppc_recipdivd`,
`__builtin_ppc_rsqrtf`, and `__builtin_ppc_rsqrtd`. FastMathFlags are
set to fast immediately before emitting these builtins. Now the flags
are restored to their previous values after the builtins are emitted.
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D105984
Simon Pilgrim [Tue, 20 Jul 2021 14:31:24 +0000 (15:31 +0100)]
[CostModel] Templatize EntryCost::Cost to allow custom cost metrics
We currently use an unsigned value for our CostTblEntry and TypeConversionCostTblEntry cost tables which is limiting depending on how the target wishes to handle various CostKinds etc.
For instance, targets might wish to store separate instruction count, latency or throughput values etc. On D46276 we have been investigating storing a code snippet to improve latency/throughput cost calculations.
There is a slight problem in that template argument deduction was struggling to match the now templatized Costs[] tables in a ArrayRef constructor - I've added helper wrappers for CostTableLookup/ConvertCostTableLookup which avoids us having to update all existing calls with a template hint.
Differential Revision: https://reviews.llvm.org/D106351
Johannes Doerfert [Tue, 20 Jul 2021 14:16:56 +0000 (09:16 -0500)]
[Attributor] Initialize effectively unused value to appease UBSAN
Bradley Smith [Tue, 13 Jul 2021 14:42:36 +0000 (14:42 +0000)]
[AArch64][SVE] Move instcombine like transforms out of SVEIntrinsicOpts
Instead move them to the instcombine that happens in AArch64TargetTransformInfo.
Differential Revision: https://reviews.llvm.org/D106144
Florian Hahn [Tue, 20 Jul 2021 14:15:59 +0000 (16:15 +0200)]
[VPlan] Fix formatting glitch from
d2a73fb44ea0b8.
Florian Hahn [Tue, 20 Jul 2021 10:06:31 +0000 (12:06 +0200)]
[VPlan] Add recipe for first-order rec phis, make splicing explicit.
This patch adds a VPFirstOrderRecurrencePHIRecipe, to further untangle
VPWidenPHIRecipe into distinct recipes for distinct use cases/lowering.
See D104989 for a new recipe for reduction phis.
This patch also introduces a new `FirstOrderRecurrenceSplice`
VPInstruction opcode, which is used to make the forming of the vector
recurrence value explicit in VPlan. This more accurately models def-uses
in VPlan and also simplifies code-generation. Now, the vector recurrence
values are created at the right place during VPlan-codegeneration,
rather than during post-VPlan fixups.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D105008
Nico Weber [Tue, 20 Jul 2021 14:13:39 +0000 (10:13 -0400)]
[gn build] remove stray character in a comment
Jamie Schmeiser [Tue, 20 Jul 2021 14:12:20 +0000 (10:12 -0400)]
Reland Produce warning for performing pointer arithmetic on a null pointer.
Summary:
Test and produce warning for subtracting a pointer from null or subtracting
null from a pointer.
This reland adds the functionality that the warning is no longer reusing an
existing warning, it has different wording for C vs C++ to refect the fact
that nullptr-nullptr has defined behaviour in C++, it is suppressed
when the warning is triggered by a system header and adds
-Wnull-pointer-subtraction to allow the warning to be controlled. -Wextra
implies -Wnull-pointer-subtraction.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: efriedma (Eli Friedman), nickdesaulniers (Nick Desaulniers)
Differential Revision: https://reviews.llvm.org/D98798
Stefan Pintilie [Wed, 16 Jun 2021 13:36:25 +0000 (08:36 -0500)]
[PowerPC][Builtins] Added a number of builtins for compatibility with XL.
Added a number of different builtins that exist in the XL compiler. Most of
these builtins already exist in clang under a different name.
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D104386