Ties Stuij [Wed, 1 Dec 2021 12:04:08 +0000 (12:04 +0000)]
[clang][ARM] removing branch protection error cmdline test
This test which was just introduced in the PACBTI-M frontend
patch (https://reviews.llvm.org/D112421) is currently failing on some
platforms. Removing temporarily.
Simon Pilgrim [Wed, 1 Dec 2021 12:03:30 +0000 (12:03 +0000)]
[X86] Add some basic fptosi/fptoui saturate vector tests
Nikita Popov [Wed, 1 Dec 2021 11:40:40 +0000 (12:40 +0100)]
[LICM] Support opaque pointers in scalar promotion
Make sure that all pointers have the same load/store access type,
rather than comparing pointer element types.
Bradley Smith [Mon, 29 Nov 2021 16:54:01 +0000 (16:54 +0000)]
[DAGCombiner] When combining REM ensure optimized div nodes are unique
The REM DAG combine uses the visitDivLike functions to try and get an
optimized DIV node to provide better codegen, however in some cases this
visitDivLike call ends up in the BuildSDIVPow2 target hook, which in
turn sometimes will return the same node passed in to indicate not to
change it. The REM DAG combine does not anticipate this and creates a
cycle in the DAG because of it.
Fix this by ensuring any such optimized div node returned is distinct
from the node being combined.
Differential Revision: https://reviews.llvm.org/D114716
Simon Pilgrim [Wed, 1 Dec 2021 11:23:47 +0000 (11:23 +0000)]
[DAG] Apply clang-format to visitMSTORE + visitMLOAD. NFC.
Reduce diff in D114582
David Green [Wed, 1 Dec 2021 11:11:09 +0000 (11:11 +0000)]
[ARM] Strengthen fpclamptosat.ll triple to attempt to fix buildbot errors. NFC
Ties Stuij [Wed, 1 Dec 2021 10:52:31 +0000 (10:52 +0000)]
[ARM] emit PACBTI-M build attributes
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Victor Campos
- Ties Stuij
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D112425
Manuel Klimek [Wed, 1 Dec 2021 10:56:51 +0000 (11:56 +0100)]
Fix segfault in clang-format.
Fix bug where we'd read past the end of the tokens after merging _T
macro strings.
Nikita Popov [Wed, 1 Dec 2021 10:53:17 +0000 (11:53 +0100)]
[IRBuilder] Remove deprecated methods
Remove deprecated methods that are incompatible with opaque
pointers. These have all been deprecated at some point prior to
the LLVM 13 release.
Nikita Popov [Wed, 1 Dec 2021 10:41:59 +0000 (11:41 +0100)]
[IR] Remove deprecated GetElementPtrInst constructors
Remove deprecated constructors that are incompatible with opaque
pointers. These have been deprecated since before the LLVM 13
release.
Ties Stuij [Wed, 1 Dec 2021 10:48:30 +0000 (10:48 +0000)]
[ARM] add common parts for PACBTI-M support in the backend
This patch encapsulates decision logic about when and how to generate
PAC/BTI related code. It's a part shared by PAC-RET, BTI placement,
build attribute emission, etc, so it make sense committing it
separately in order to unblock the aforementioned parts, which can
proceed concurrently.
This patch adds a few member functions to `ARMFunctionInfo`, which are currently
unused, therefore there is no testing for them at the moment. This code is
tested in follow-up PAC/BTI code gen patches.
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Momchil Velikov
- Ties Stuij
Reviewed By: danielkiss
Differential Revision: https://reviews.llvm.org/D112423
Ties Stuij [Wed, 1 Dec 2021 10:39:23 +0000 (10:39 +0000)]
[clang][ARM] emit PACBTI-M feature defines
emit __ARM_FEATURE_BTI_DEFAULT and __ARM_FEATURE_PAC_DEFAULT defines when those
features have been enabled
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Victor Campos
- Ties Stuij
Reviewed By: ostannard
Differential Revision: https://reviews.llvm.org/D112422
Nikita Popov [Wed, 1 Dec 2021 10:33:52 +0000 (11:33 +0100)]
[IR] Assert on getPointerElementType() on opaque pointer (NFC)
Previously this simply crashed.
Ties Stuij [Wed, 1 Dec 2021 10:22:19 +0000 (10:22 +0000)]
[clang][ARM] PACBTI-M frontend support
Handle branch protection option on the commandline as well as a function
attribute. One patch for both mechanisms, as they use the same underlying
parsing mechanism.
These are recorded in a set of LLVM IR module-level attributes like we do for
AArch64 PAC/BTI (see https://reviews.llvm.org/D85649):
- command-line options are "translated" to module-level LLVM IR
attributes (metadata).
- functions have PAC/BTI specific attributes iff the
__attribute__((target("branch-protection=...))) was used in the function
declaration.
- command-line option -mbranch-protection to armclang targeting Arm,
following this grammar:
branch-protection ::= "-mbranch-protection=" <protection>
protection ::= "none" | "standard" | "bti" [ "+" <pac-ret-clause> ]
| <pac-ret-clause> [ "+" "bti"]
pac-ret-clause ::= "pac-ret" [ "+" <pac-ret-option> ]
pac-ret-option ::= "leaf" ["+" "b-key"] | "b-key" ["+" "leaf"]
b-key is simply a placeholder to make it consistent with AArch64's
version. In Arm, however, it triggers a warning informing that b-key is
unsupported and a-key will be selected instead.
- Handle _attribute_((target(("branch-protection=..."))) for AArch32 with the
same grammer as the commandline options.
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Momchil Velikov
- Victor Campos
- Ties Stuij
Reviewed By: vhscampos
Differential Revision: https://reviews.llvm.org/D112421
David Green [Wed, 1 Dec 2021 10:25:52 +0000 (10:25 +0000)]
[ARM] Teach getIntImmCostInst about the cost of saturating fp converts
Given a min(max(fptosi, INT_MIN), INT_MAX) with the correct constants,
we can now generate a fptosi.sat. But in the arm backend, the constant
can be treated as high cost, pulling it out of the basic block in a way
that the DAG combine can no longer see it. This teaches it again that it
is a low cost constant, not worth hoisting out.
Differential Revision: https://reviews.llvm.org/D114380
Manuel Klimek [Wed, 1 Dec 2021 10:19:19 +0000 (11:19 +0100)]
Fix clang-format bug when handling conflict markers.
Previously, clang-format would not correctly identify preprocessor
directives directly following a conflict marker, which would result in
violating the formatter's invariants.
The provided test fails in assert mode before this change.
Jeroen Dobbelaere [Wed, 1 Dec 2021 10:18:30 +0000 (11:18 +0100)]
Revert "[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation"
This reverts commit
0c047a8e13320fb8e9dabbf7a3c6a00fe81198c7.
A number of buildbots started failing. Reverting for now.
Florian Hahn [Wed, 1 Dec 2021 10:06:20 +0000 (10:06 +0000)]
[BuildLibCalls] Add argmemonly, writeonly, nounwind to memset_chk.
The memset_chk library function should match memset's attributes with
respect of memory effects (argmemonly, writeonly). It also does not
raise exceptions. It may not return, in case it aborts the program.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D114793
David Green [Wed, 1 Dec 2021 10:08:37 +0000 (10:08 +0000)]
[ARM] Fix some identing in ARMAsmPrinter::emitInstruction, NFC
Jeroen Dobbelaere [Tue, 30 Nov 2021 09:40:33 +0000 (10:40 +0100)]
[Sema] check PseudoObject when rebuilding CXXOperatorCallExpr in template instantiation
The invocation of a unary or binary operator for type-dependent expressions is represented as a CXXOperatorCallExpr. Upon template instantiation, TreeTransform::RebuildCXXOperatorCallExpr checks for the case of an overloaded operator, but not for a (non-ObjC) PseudoObject, and will directly create a UnaryOperator or BinaryOperator.
Generalizing commit
0f99537ecac40 from @akyrtzi to handle non-ObjC pseudo objects (and also handle the case of unary pseudo object inc/dec).
This fixes https://bugs.llvm.org/show_bug.cgi?id=51855
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D111639
Matthias Springer [Wed, 1 Dec 2021 09:45:27 +0000 (18:45 +0900)]
[mlir][linalg][bufferize] CallOps do not bufferize to memory writes
However, since CallOps have no aliasing OpResults, their OpOperands always bufferize out-of-place.
This change removes `bufferizesToMemoryWrite` from `CallOpInterface`. This method was called, but its return value did not matter.
Differential Revision: https://reviews.llvm.org/D114616
Shraiysh Vaishay [Wed, 1 Dec 2021 07:52:56 +0000 (13:22 +0530)]
[OpenMP][IRBuilder] Fix createSections
Fix for the case when there are no instructions in the entry basic block before the call
to `createSections`
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D114143
Nikita Popov [Wed, 1 Dec 2021 09:32:37 +0000 (10:32 +0100)]
[LoopUnrollRuntime] Remove unnecessary pointer BECount check (NFC)
BECounts are guaranteed to be integers nowadays.
Nikita Popov [Mon, 29 Nov 2021 20:02:37 +0000 (21:02 +0100)]
[SCEV] Track backedge taken count users (NFCI)
Track which SCEVs are used as ExactNotTaken counts in
BackedgeTakenInfo structures, so we can directly determine which
loops need to be invalidated, rather than iterating over all BECounts.
This gives a small compile-time improvement on average, but the
motivation here is more to ensure there are no degenerate cases,
if the number of backedge taken counts is large.
Differential Revision: https://reviews.llvm.org/D114784
Dylan McKay [Wed, 1 Dec 2021 08:33:31 +0000 (21:33 +1300)]
Add 'LLVM_DEFAULT_TARGET_TRIPLE' to the documented list of CMake variables
I always forget this variable, and the distinction between
'LLVM_TARGET_ARCH', and this variable is only documented on the 'cross
compiling' page, which I never spot and always end up searching through
the codebase for.
This patch adds the variable to the Sphinx CMake documentation so that
it is easily findable in the official LLVM docs.
Reviewed By: probinson
Differential Revision: https://reviews.llvm.org/D96014
Alexander Belyaev [Wed, 1 Dec 2021 08:29:45 +0000 (09:29 +0100)]
[mlir] Add a helper for TiledLoopOp to get an operand tied to the bbArg.
Differential Revision: https://reviews.llvm.org/D114852
Florian Hahn [Wed, 1 Dec 2021 08:29:23 +0000 (08:29 +0000)]
[DSE] Allow DSE to optimize MemorySSA by default.
This allows for better optimization of 'stores-of-existing-values' and
possibly helps passes further down the pipeline.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D113712
Guillaume Chatelet [Wed, 1 Dec 2021 08:19:32 +0000 (08:19 +0000)]
[libc] Add _64 element to aarch64
Kiran Chandramohan [Wed, 1 Dec 2021 08:10:27 +0000 (08:10 +0000)]
[Flang] Replace notifyMatchFailure with TODO hard failures
For unimplemented patterns we revert to using TODO hard failures instead of
notifyMatchFailure.
For fir.select_type revert to using mlir::emiterror.
For the fir.embox TODO on a type with len params we cannot add a test since the type cannot be converted to llvm.
Adding negative tests using not and checking for the error message.
TODO exits with an error in a build without assertion but aborts in a
build with assertions. Abort requires using not with the --crash
option. The two different usages of not is handled by using a custom
command %not_todo_cmd which is converted to not or not --crash
depending on the presence or absence of assertions. Using llvm-config
to check the presence of assertions.
Reviewed By: clementval, awarzynski
Differential Revision: https://reviews.llvm.org/D114371
Chuanqi Xu [Wed, 1 Dec 2021 08:16:14 +0000 (16:16 +0800)]
[Coroutines] Make suspend_always in test noexcept (NFC)
Valentin Clement [Wed, 1 Dec 2021 07:59:52 +0000 (08:59 +0100)]
[fir] Add fir reduction builder
This patch introduces a bunch of builder functions
to create function calls to runtime reduction functions.
This patch is part of the upstreaming effort from fir-dev branch.
This patch failed previously because a macro was missing.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D114460
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
Markus Lavin [Wed, 1 Dec 2021 06:39:40 +0000 (07:39 +0100)]
[NPM] Fix LoopNestPasses in -print-pipeline-passes
Fix printing of LoopNestPasses when using the opt pipeline printer
option -print-pipeline-passes.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D114771
Thomas Raoux [Wed, 1 Dec 2021 06:51:12 +0000 (22:51 -0800)]
[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims
The new affine map generated by linearizeCollapsedDims should not drop
dimensions. We need to make sure we create a map with at least as many
dimensions as the source map. This prevents
FoldProducerReshapeOpByLinearization from generating invalid IR.
This solves regression in IREE due to https://github.com/llvm/llvm-project/commit/
e4e4da86aff5606ef792d987a3ec85639219228c
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D114838
This reverts commit
9a844c2a9b5c09b4c35d573394a99ab860621581.
MaheshRavishankar [Wed, 1 Dec 2021 06:43:46 +0000 (22:43 -0800)]
Revert "[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims"
This reverts commit
bc38673e4de50b995f4bc46d1a4b0ad95bef2356.
MaheshRavishankar [Wed, 1 Dec 2021 06:37:24 +0000 (22:37 -0800)]
[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims
The new affine map generated by linearizeCollapsedDims should not drop
dimensions. We need to make sure we create a map with at least as many
dimensions as the source map. This prevents
FoldProducerReshapeOpByLinearization from generating invalid IR.
This solves regression in IREE due to https://github.com/llvm/llvm-project/commit/
e4e4da86aff5606ef792d987a3ec85639219228c
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D114838
Sergey Dmitriev [Wed, 1 Dec 2021 04:23:00 +0000 (20:23 -0800)]
[clang-offload-bundler] Reuse original file extension for device archive member
This patch changes clang-offload-bundler to use the original file extension for
the device archive member when unbundling archives instead of printing a warning
and defaulting to ".o".
Differential Revision: https://reviews.llvm.org/D114776
Qiu Chaofan [Wed, 1 Dec 2021 04:22:21 +0000 (12:22 +0800)]
[Legalizer] Avoid expansion to BR_CC if illegal
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D110616
Vitaly Buka [Mon, 22 Nov 2021 05:54:08 +0000 (21:54 -0800)]
[sanitizer] Add delta compression stack depot
Compress by factor 4x, takes about 10ms per 8 MiB block.
Depends on D114498.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D114503
Snehasish Kumar [Tue, 30 Nov 2021 23:56:17 +0000 (15:56 -0800)]
[memprof] Align each rawprofile section to 8b.
The first 8b of each raw profile section need to be aligned to 8b since
the first item in each section is a u64 count of the number of items in
the section.
Summary of changes:
* Assert alignment when reading counts.
* Update test to check alignment, relax some size checks to allow padding.
* Update raw binary inputs for llvm-profdata tests.
Differential Revision: https://reviews.llvm.org/D114826
Jonas Devlieghere [Wed, 1 Dec 2021 04:11:12 +0000 (20:11 -0800)]
[lldb] Temporarily skip TestTsanBasic on Darwin
See ongoing discussion in https://reviews.llvm.org/D112603.
Phoebe Wang [Wed, 1 Dec 2021 03:51:43 +0000 (11:51 +0800)]
[X86] Pre-commit tests to show the problem of SQRT when `RefinementSteps` = 0. NFC
Jacques Pienaar [Wed, 1 Dec 2021 03:42:37 +0000 (19:42 -0800)]
[mlir] Update accessors prefixed form (NFC)
Vitaly Buka [Wed, 24 Nov 2021 00:31:26 +0000 (16:31 -0800)]
[sanitizer] Add compress_stack_depot flag
Depends on D114494.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D114495
Craig Topper [Wed, 1 Dec 2021 02:40:57 +0000 (18:40 -0800)]
[RISCV] Teach RISCVTargetLowering::shouldSinkOperands to handle udiv/sdiv/urem/srem.
The V extension supports .vx instructions for integer division and
remainder so we should sink splats for that operand.
Kent Ross [Wed, 1 Dec 2021 02:46:37 +0000 (18:46 -0800)]
[libcxx][doc] Document recent spaceship projects progress
Update a couple authors, differentials, and completed projects for operator<=> implementation
Reviewed By: #libc, Mordante, Quuxplusone, ldionne
Differential Revision: https://reviews.llvm.org/D114682
modimo [Wed, 1 Dec 2021 01:18:58 +0000 (17:18 -0800)]
Add toggling for -fnew-infallible/-fno-new-infallible
Allow toggling of -fnew-infallible so last instance takes precedence
Testing:
ninja check-all
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D113523
Mircea Trofin [Wed, 1 Dec 2021 00:55:40 +0000 (16:55 -0800)]
[test] Avoid dumping .o in source tree (expand-pseudos.ll)
Piping the input to llc avoids that (i.e. llc .... < %s vs llc ... %s)
Vitaly Buka [Wed, 24 Nov 2021 00:28:26 +0000 (16:28 -0800)]
[NFC][sanitizer] Add entry point for compression
Add Compression::Test type which just pretends packing,
but does nothing useful. It's only called from test for now.
Depends on D114493.
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D114494
Aart Bik [Tue, 30 Nov 2021 22:28:58 +0000 (14:28 -0800)]
[mlir][sparse] added sparse out element wise mult integration test
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D114822
wlei [Fri, 19 Nov 2021 21:57:05 +0000 (13:57 -0800)]
[llvm-profgen] Truncate the context with zero probe ID
Due to the debug info merging, there may have some contexts with zero probe id, we should truncate the context to avoid misleading pre-inliner.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D114284
Vincent Lee [Tue, 23 Nov 2021 03:56:56 +0000 (19:56 -0800)]
[ObjectYAML/obj2yaml/yaml2obj][MachO] Support indirect symbol table
Tools such as `llvm-objdump` or `llvm-readobj` support indirect symbol
tables. Here, support it for `obj2yaml` and `yaml2obj`.
Reviewed By: jhenderson, drodriguez
Differential Revision: https://reviews.llvm.org/D114410
wlei [Thu, 4 Nov 2021 07:08:37 +0000 (00:08 -0700)]
[FS-AFDO][llvm-profgen] Generate profile with FS-AFDO discriminator
In order to support generating profile with FS discriminator, three kind of changes are done in llvm-profgen:
1) Dissassemble .rodata section to check if FS discriminator var ('"__llvm_fs_discriminator__"') exists and set the corresponding flag in the binary.
2) Change the discriminator decoding in `getBaseDiscriminator` and `getDuplicationFactor`.
3) set true for `FunctionSamples::ProfileIsFS` to enable FS functionality in ProfileData.
Reviewed By: xur, hoy, wenlei
Differential Revision: https://reviews.llvm.org/D113296
Kazushi (Jam) Marukawa [Sun, 21 Nov 2021 16:01:50 +0000 (01:01 +0900)]
[runtimes][openmp] Change to not treat ARCH-unknown-linux-gnu as errors
When OpenMP is compiled as a part runtimes for multiple targets, openmp
is compiled under build/runtimes/runtimes-arch-unknown-linux-gnu-bins
directory. Old implementation treats this directory name as errors.
This patch adds a guard like "[Uu]known[^-]".
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D114346
Aart Bik [Tue, 30 Nov 2021 22:08:41 +0000 (14:08 -0800)]
[mlir][sparse] fix typos in integration tests
Reviewed By: bixia, wrengr
Differential Revision: https://reviews.llvm.org/D114820
Peter Klausler [Thu, 18 Nov 2021 19:48:42 +0000 (11:48 -0800)]
[flang] Rearrange prototype & code placement of IsCoarray()
A quick fix last week to the shared library build caused
the predicate IsCoarray(const Symbol &) to be moved from
Semantics to Evaluate. This patch completes that move in
a way that properly combines the existing IsCoarray() tests
for expressions and other object with the test for a symbol.
Differential Revision: https://reviews.llvm.org/D114806
Stephen Neuendorffer [Tue, 30 Nov 2021 22:37:30 +0000 (14:37 -0800)]
Revert "[MLIR] Update Vector To LLVM conversion to be aware of assume_alignment"
This reverts commit
29a50c5864ddab283c1ff38694fb5926ce37b39a.
After LLVM lowering, the original patch incorrectly moved alignment
information across an unconstrained GEP operation. This is only correct
for some index offsets in the GEP. It seems that the best approach is,
in fact, to rely on LLVM to propagate information from the llvm.assume()
to users.
Thanks to Thomas Raoux for catching this.
modimo [Tue, 30 Nov 2021 23:11:57 +0000 (15:11 -0800)]
[Clang] Add option to disable -mconstructor-aliases with -mno-constructor-aliases
We've found that when profiling, counts are only generated for the real definition of constructor aliases (C2 in mangled name). However, when compiling the C1 version is present at the callsite and leads to a lack of counts due to this aliasing. This causes us to miss out on inlining an otherwise hot constructor.
-mconstructor-aliases is AFAICT an optimization, so having a disabling flag if wanted seems valuable.
Testing:
ninja check-all
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D114130
Mircea Trofin [Tue, 30 Nov 2021 01:18:29 +0000 (17:18 -0800)]
[NFC][regalloc] Factor accesses to ExtraRegInfo
We'll move ExtraRegInfo to the RegAllocEvictionAdvisor subsequently.
This change prepares for that by factoring all accesses.
RFC: https://lists.llvm.org/pipermail/llvm-dev/2021-November/153639.html
Differential Revision: https://reviews.llvm.org/D114759
Tarique Islam [Tue, 30 Nov 2021 22:41:55 +0000 (22:41 +0000)]
Big-endian version of vpermxor
A big-endian version of vpermxor, named vpermxor_be, is added to LLVM
and Clang. vpermxor_be can be called directly on both the little-endian
and the big-endian platforms.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D114540
Julian Lettner [Tue, 30 Nov 2021 20:12:14 +0000 (12:12 -0800)]
[TSan][Darwin] Avoid crashes due to interpreting non-zero shadow content as a pointer
We would like to use TLS to store the ThreadState object (or at least a
reference ot it), but on Darwin accessing TLS via __thread or manually
by using pthread_key_* is problematic, because there are several places
where interceptors are called when TLS is not accessible (early process
startup, thread cleanup, ...).
Previously, we used a "poor man's TLS" implementation, where we use the
shadow memory of the pointer returned by pthread_self() to store a
pointer to the ThreadState object.
The problem with that was that certain operations can populate shadow
bytes unbeknownst to TSan, and we later interpret these non-zero bytes
as the pointer to our ThreadState object and crash on when dereferencing
the pointer.
This patch changes the storage location of our reference to the
ThreadState object to "real" TLS. We make this work by artificially
keeping this reference alive in the pthread_key destructor by resetting
the key value with pthread_setspecific().
This change also fixes the issue were the ThreadState object is
re-allocated after DestroyThreadState() because intercepted functions
can still get called on the terminating thread after the
THREAD_TERMINATE event.
Radar-Id: rdar://problem/
72010355
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D110236
Jonathan Peyton [Fri, 19 Nov 2021 22:22:21 +0000 (16:22 -0600)]
[OpenMP][libomp][doc] Add environment variables documentation
Add documentation for the environment variables for libomp
Differential Revision: https://reviews.llvm.org/D114269
Peter Klausler [Fri, 26 Nov 2021 19:39:31 +0000 (11:39 -0800)]
[flang] Define & implement a lowering support API IsContiguous() in runtime
Create a new flang/runtime/support.cpp module to hold miscellaneous
runtime APIs to support lowering, and define an API IsContiguous() to
wrap the member function predicate Descriptor::IsContiguous().
And do a little clean-up of other API headers that don't need to expose
Runtime/descriptor.h.
Differential Revision: https://reviews.llvm.org/D114752
Schuyler Eldridge [Tue, 30 Nov 2021 05:47:08 +0000 (00:47 -0500)]
[ADT] Remove 0-width Asserts in APInt.getZExtValue
Remove assertion that disallows getting a zero-extended value from a
zero-width APInt. This check is too restrictive and makes it difficult
to use APInt to model zero-width things, e.g., zero-width wires in the
CIRCT project.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Reviewed By: lattner, darthscsi, nikic
Differential Revision: https://reviews.llvm.org/D114768
Vitaly Buka [Mon, 29 Nov 2021 21:07:11 +0000 (13:07 -0800)]
[NFC][sanitizer] Fail test quickly
Srividya Karumuri [Tue, 30 Nov 2021 00:25:21 +0000 (16:25 -0800)]
[InstCombine] Allow fake vector insert folding to bit-logic only if the insert element is integer type
The below commit is causing assertion when insert element type is not integer
type such as half. This is because the transformation is creating zext before
doing bitwise OR, and the zext is supported only for integer types
https://github.com/llvm/llvm-project/commit/
80ab06c599a0f5a90951c36a57b2a9b492b19d61
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D114734
Greg Clayton [Thu, 18 Nov 2021 05:18:24 +0000 (21:18 -0800)]
[NFC] Refactor symbol table parsing.
Symbol table parsing has evolved over the years and many plug-ins contained duplicate code in the ObjectFile::GetSymtab() that used to be pure virtual. With this change, the "Symbtab *ObjectFile::GetSymtab()" is no longer virtual and will end up calling a new "void ObjectFile::ParseSymtab(Symtab &symtab)" pure virtual function to actually do the parsing. This helps centralize the code for parsing the symbol table and allows the ObjectFile base class to do all of the common work, like taking the necessary locks and creating the symbol table object itself. Plug-ins now just need to parse when they are asked to parse as the ParseSymtab function will only get called once.
This is a retry of the original patch https://reviews.llvm.org/D113965 which was reverted. There was a deadlock in the Manual DWARF indexing code during symbol preloading where the module was asked on the main thread to preload its symbols, and this would in turn cause the DWARF manual indexing to use a thread pool to index all of the compile units, and if there were relocations on the debug information sections, these threads could ask the ObjectFile to load section contents, which could cause a call to ObjectFileELF::RelocateSection() which would ask for the symbol table from the module and it would deadlock. We can't lock the module in ObjectFile::GetSymtab(), so the solution I am using is to use a llvm::once_flag to create the symbol table object once and then lock the Symtab object. Since all APIs on the symbol table use this lock, this will prevent anyone from using the symbol table before it is parsed and finalized and will avoid the deadlock I mentioned. ObjectFileELF::GetSymtab() was never locking the module lock before and would put off creating the symbol table until somewhere inside ObjectFileELF::GetSymtab(). Now we create it one time inside of the ObjectFile::GetSymtab() and immediately lock it which should be safe enough. This avoids the deadlocks and still provides safety.
Differential Revision: https://reviews.llvm.org/D114288
Peter Klausler [Thu, 25 Nov 2021 00:05:37 +0000 (16:05 -0800)]
[flang] Correct INQUIRE(POSITION= & PAD=)
INQUIRE(POSITION=)'s results need to reflect the POSITION=
specifier used for the OPEN statement until the unit has been
repositioned. Preserve the POSITION= from OPEN and used it
for INQUIRE(POSITION=) until is becomes obsolete.
INQUIRE(PAD=) is implemented here in the case of an unconnected unit
with Fortran 2018 semantics; i.e., "UNDEFINED", rather than Fortran 90's
"YES"/"NO" (see 4.3.6 para 2). Apparent failures with F'90-only tests
will persist with INQUIRE(PAD=); these discrepancies don't seem to warrant
an option or environment variable.
To make the implementation of INQUIRE more closely match the language
in the standard, rename IsOpen() to IsConnected(), and use it explicitly
for the various INQUIRE specifiers.
Differential Revision: https://reviews.llvm.org/D114755
Aart Bik [Tue, 30 Nov 2021 18:58:13 +0000 (10:58 -0800)]
[mlir][sparse] refine simply dynamic sparse tensor outputs
Proper test for sparse tensor outputs is a single condition throughout
the whole tensor index expression (not a general conjunction, since this
may include other conditions that cause cancellation).
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D114810
Peter Klausler [Tue, 23 Nov 2021 02:37:25 +0000 (18:37 -0800)]
[flang] Re-fold bounds expressions in DATA implied DO loops
To accommodate triangular implied DO loops in DATA statements, in which
the bounds of nested implied DO loops might depend on the values of the
indices of outer implied DO loops in the same DATA statement set, it
is necessary to run them through constant folding each time they are
encountered.
Differential Revision: https://reviews.llvm.org/D114754
Elizabeth Andrews [Tue, 30 Nov 2021 21:15:51 +0000 (13:15 -0800)]
[clang-repl][NFC] Fix calling convention mismatch in test
Test failed on x86 platforms due to a calling convention mismatch
when member function was called like a free function. In this patch,
member function is marked static to address this.
Jonas Devlieghere [Tue, 30 Nov 2021 20:54:31 +0000 (12:54 -0800)]
[lldb] Fix broken skipUnlessUndefinedBehaviorSanitizer decorator
727bd89b605b broke the UBSan decorator. The decorator compiles a custom
source code snippet that exposes UB and verifies the presence of a UBSan
symbol in the generated binary. The aforementioned commit broke both by
compiling a snippet without UB and discarding the result.
Peter Klausler [Tue, 23 Nov 2021 20:45:39 +0000 (12:45 -0800)]
[flang] Fix usage & catch errors for MAX/MIN with keyword= arguments
Max(), MIN(), and their specific variants are defined with an unlimited
number of dummy arguments named A1=, A2=, &c. whose names are almost never
used in practice but should be allowed for and properly checked for the
usual errors when they do appear. The intrinsic table's entries otherwise
have fixed numbers of dummy argument definitions, so add some special
case handling in a few spots for MAX/MIN/&c. checking and procedure
characteristics construction.
Differential Revision: https://reviews.llvm.org/D114750
Jonas Devlieghere [Tue, 30 Nov 2021 20:41:45 +0000 (12:41 -0800)]
[lldb] Fix TypeError: argument of type 'NoneType' is not iterable
Check if we have an apple_sdk before checking if it contains "internal".
Jonas Devlieghere [Tue, 30 Nov 2021 19:33:09 +0000 (11:33 -0800)]
[lldb] Mark TestTsanBasic and TestUbsanBasic as "no debug info" tests
Speed up testing by not rerunning the test for all debug info variants.
Nicolas Vasilache [Mon, 29 Nov 2021 16:22:45 +0000 (16:22 +0000)]
[mlir][tensor] InsertSliceOp verification.
This revision reintroduces tensor.insert_slice verification which seems
to have vanished over time: a verifier was initially introduced in
cf9503c1b752062d9abfb2c7922a50574d9c5de4
but for some reason the invalid.mlir was not properly updated; as time passed the verifier was not called anymore and later the code was deleted.
As a consequence, a non-negligible portion of tests has run astray using invalid
tensor.insert_slice semantics and needed to be fixed.
Also, extract isRankReducedType from TensorOps for better reuse
Originally, this facility was used by both tensor and memref forms but
it got copied around as dialects were split.
Differential Revision: https://reviews.llvm.org/D114715
MaheshRavishankar [Tue, 30 Nov 2021 15:46:21 +0000 (15:46 +0000)]
[mlir][MemRef] Fix SubViewOp canonicalization when a subset of unit-dims are dropped.
The canonical type of the result of the `memref.subview` needs to make
sure that the previously dropped unit-dimensions are the ones dropped
for the canonicalized type as well. This means the generic
`inferRankReducedResultType` cannot be used. Instead the current
dropped dimensions need to be querried and the same need to be dropped.
Reviewed By: nicolasvasilache, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D114751
Jameson Nash [Tue, 30 Nov 2021 19:59:49 +0000 (14:59 -0500)]
AArch64 GIsel: legalize lshr operands, even if it is poison
Previously, this caused GlobalISel to emit invalid IR (a gpr32 to gpr64
copy) and fail during verification.
While this shift is not defined (returns poison), it should not crash
codegen, as it may appear inside dead code (for example, a select
instruction), and it is legal IR input, as long as the value is unused.
Discovered while trying to build Julia with LLVM v13:
https://github.com/JuliaLang/julia/pull/42602.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D114389
Snehasish Kumar [Tue, 30 Nov 2021 20:19:27 +0000 (12:19 -0800)]
[memprof] Disallow memprof profile reader tests on non-x86 archs.
The memprof profile reader tests rely on binary data which is generated
from and meant to be interpreted on little endian architectures. Add a
REQUIRES: x86_64-linux clause to both tests to ensure they don't fail on big
endian targets such as ppc.
Nikita Popov [Tue, 30 Nov 2021 20:07:31 +0000 (21:07 +0100)]
[SCEV] Verify integrity of ValuesAtScopes and users (NFC)
Make sure that ValuesAtScopes and ValuesAtScopesUsers are
consistent during SCEV verification.
Zarko Todorovski [Tue, 30 Nov 2021 20:06:46 +0000 (15:06 -0500)]
[clang][docs] Inclusive language: remove use of sanity check in option description
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D114562
Zarko Todorovski [Tue, 30 Nov 2021 19:48:53 +0000 (14:48 -0500)]
[NFC][Clang]Inclusive language: Replace uses of whitelist in clang/test
Snehasish Kumar [Tue, 30 Nov 2021 19:48:53 +0000 (11:48 -0800)]
[memprof] Disable pedantic warnings, suppress variadic macro warning.
The memprof unit tests use an older version of gmock (included in the
repo) which does not build cleanly with -pedantic:
https://github.com/google/googletest/issues/2650
For now just silence the warning by disabling pedantic and add the
appropriate flags for gcc and clang.
not-jenni [Tue, 30 Nov 2021 19:56:23 +0000 (11:56 -0800)]
[mlir][tosa] Add tosa.conv2d as fully_connected canonicalization
For a 1x1 weight and stride of 1, the input/weight can be reshaped and passed into a fully connected op then reshaped back
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D114757
Jameson Nash [Thu, 25 Nov 2021 05:15:05 +0000 (00:15 -0500)]
fix inverted logic for HideUnrelatedOptions
It seems clearer to me that this would check for *any of* instead of
*all of* these option categories, as it looks to me like that was the
intent. But apparently this logic has always has been inverted, and
possibly never fully used?
Differential Revision: https://reviews.llvm.org/D114572
Michael Jones [Mon, 15 Nov 2021 23:03:30 +0000 (15:03 -0800)]
[libc][clang-tidy] fix namespace check for externals
Up until now, all references to `errno` were marked with `NOLINT`, since
it was technically calling an external function. This fixes the lint
rules so that `errno`, as well as `malloc`, `calloc`, `realloc`, and
`free` are all allowed to be called as external functions. All of the
relevant `NOLINT` comments have been removed, and the documentation has
been updated.
Reviewed By: sivachandra, lntue, aaron.ballman
Differential Revision: https://reviews.llvm.org/D113946
Snehasish Kumar [Tue, 30 Nov 2021 19:33:37 +0000 (11:33 -0800)]
[memprof] Fix unit test build after refactoring shared header.
The memprof unittest also needs to include the MemProfData.inc header
directly to have access to MEMPROF_RAW_MAGIC and MEMPROF_RAW_VERSION
globals.
Fangrui Song [Tue, 30 Nov 2021 19:33:16 +0000 (11:33 -0800)]
[ELF][PPC64] Remove unneeded PPC64PCRelLongBranchThunk
This reverts the PPC64PCRelLongBranchThunk part from D86706.
PPC64PCRelLongBranchThunk is the same as PPC64R12SetupStub.
Use `__gep_setup_` instead of `__long_branch_pcrel_` for the stub symbol name
as it more closely indicates the operation.
(Note: GNU ld uses `*.long_branch.*` and `*.plt_branch.*`).
Reviewed By: NeHuang, nemanjai
Differential Revision: https://reviews.llvm.org/D114656
Jonas Devlieghere [Tue, 30 Nov 2021 19:28:52 +0000 (11:28 -0800)]
[lldb] Fix indentation in builders/darwin.py
Jonas Devlieghere [Tue, 30 Nov 2021 19:28:19 +0000 (11:28 -0800)]
[lldb] Search PrivateFrameworks when using an internal SDK
Make sure to add the PrivateFrameworks directory to the frameworks path
when using an internal SDK. This is necessary for the "on-device" test
suite.
rdar://
84519268
Differential revision: https://reviews.llvm.org/D114742
Sanjay Patel [Tue, 30 Nov 2021 18:59:39 +0000 (13:59 -0500)]
[InstSimplify] add logic fold for 'or'
https://alive2.llvm.org/ce/z/4PaPDy
There's a related fold where the inner 'or' is replaced by 'and',
but that needs to be more careful about matching a 'not'.
Sanjay Patel [Tue, 30 Nov 2021 18:17:30 +0000 (13:17 -0500)]
[InstSimplify] reduce code duplication for 'or' logic folds; NFC
Sanjay Patel [Tue, 30 Nov 2021 18:08:12 +0000 (13:08 -0500)]
[InstSimplify] make 'or' test names more descriptive; NFC
Also, vary the types in a couple of tests for better coverage.
Fangrui Song [Tue, 30 Nov 2021 19:06:28 +0000 (11:06 -0800)]
[ELF] Change -z unknown from error to warning
There is a trend of having more optional options (usually security
hardening related) like -z cet-report=, -z bti-report=, -z force-bti.
If ld.lld 14.0.0 uses a warning, in 15/16/17/... timeframe when people
add new options to software, they can worry less about linker errors on ld.lld 14.0.0.
In some cases `-z foo` does essential work where a silent ignore can be
problematic, but the user has received a warning. From my observation, the
doing-essential-work `-z foo` is much fewer than the converse. In addition,
the user who cares can use `--fatal-warnings` (Note: GNU ld doesn't upgrade warnings to errors).
It is unclear whether we need something like `clang -Wunknown-warning-option`.
If we ever run into unfortunate transition like `-z start-stop-gc`, the
affected software (e.g. ldc is a compiler which passes linker options to the underlying ld)
can blindly add the `-z` option, without worrying it may cause a linker error to LLD 14.0.0.
Reviewed By: jrtc27, peter.smith
Differential Revision: https://reviews.llvm.org/D114748
LLVM GN Syncbot [Tue, 30 Nov 2021 18:46:43 +0000 (18:46 +0000)]
[gn build] Port
7cca33b40f77
Snehasish Kumar [Fri, 19 Nov 2021 22:02:41 +0000 (14:02 -0800)]
[memprof] Extend llvm-profdata to display MemProf profile summaries.
This commit adds initial support to llvm-profdata to read and print
summaries of raw memprof profiles.
Summary of changes:
* Refactor shared defs to MemProfData.inc
* Extend show_main to display memprof profile summaries.
* Add a simple raw memprof profile reader.
* Add a couple of tests to tools/llvm-profdata.
Differential Revision: https://reviews.llvm.org/D114286
Peter Klausler [Fri, 26 Nov 2021 20:40:11 +0000 (12:40 -0800)]
[flang] Address TODO from previous changes to IsSaved()
An earlier fix to evaluate::IsSaved() needed to preserve its
treatment of named constants in modules and main programs -- i.e.
they would appear to be saved -- until a correction was added
to the lowering code. This TODO can now be resolved.
Differential Revision: https://reviews.llvm.org/D114756
Hans Wennborg [Tue, 30 Nov 2021 18:26:50 +0000 (19:26 +0100)]
Typo fix
Alexey Bataev [Wed, 17 Nov 2021 19:14:38 +0000 (11:14 -0800)]
[SLP]Improve isFixedVectorShuffle and its use.
Extended support for undefined source vector/extract indices/non-fixed
vector types, also no need to check for the parent of the extractelement
instructions with the constant indicies.
Differential Revision: https://reviews.llvm.org/D114121
Sanjay Patel [Tue, 30 Nov 2021 17:45:09 +0000 (12:45 -0500)]
[InstSimplify] reduce code duplication for 'or' logic fold; NFC
Sanjay Patel [Tue, 30 Nov 2021 17:29:45 +0000 (12:29 -0500)]
[InstSimplify] adjust tests for 'or' of logic ops; NFC
Half of the tests had an extra instruction so were not testing the minimal patterns.