Richard Smith [Fri, 12 Jun 2020 17:27:48 +0000 (10:27 -0700)]
Don't diagnose a redeclaration of a deduction guide if the prior
declaration is not visible.
In passing, add a test for a similar case of conflicting redeclarations
of internal-linkage structured bindings. (This case already works).
peter klausler [Fri, 12 Jun 2020 17:05:04 +0000 (10:05 -0700)]
[flang] Dodge bogus uninitialized data warning from gcc 10.1 via code cleanup
G++ 10.1 emits inappropriate "use of uninitialized data" warnings when
compiling f18. The warnings stem from two sites in templatized code
whose multiple instantiations magnified the number of warnings.
These changes dodge those warnings by making some innocuous changes to
the code. In the parser, the idiom defaulted(cut >> x), which yields a
parser that always succeeds, has been replaced with a new equivalent
pass<T>() parser that returns a default-constructed value T{} in an
arguably more readable fashion. This idiom was the only attestation of
the basic parser cut, so it has been removed and the remaining code
simplified. In Evaluate/traverse.h, a return {}; was replaced with a
return of a default-constructed member.
Differential Revision: https://reviews.llvm.org/D81747
Jacques Pienaar [Fri, 12 Jun 2020 16:48:49 +0000 (09:48 -0700)]
[analyzer] Avoid unused variable warning in opt build
Jessica Paquette [Fri, 5 Jun 2020 23:59:27 +0000 (16:59 -0700)]
[AArch64][GlobalISel] Allow G_DUP for elements smaller than 32 B.
We select all of these via patterns now, so there's no reason to disallow this.
Update select-dup.mir to show that we correctly select the smaller types.
Differential Revision: https://reviews.llvm.org/D81322
Jessica Paquette [Tue, 9 Jun 2020 18:27:28 +0000 (11:27 -0700)]
[AArch64][GlobalISel] Set hasSideEffects = 0 on custom shuffle opcodes
This was making it so that the instructions weren't eliminated in
select-rev.mir and select-trn.mir despite not being used.
Update the tests accordingly.
Differential Revision: https://reviews.llvm.org/D81492
Jonas Devlieghere [Fri, 12 Jun 2020 16:30:25 +0000 (09:30 -0700)]
[lldb/SymbolFile] Don't parse the whole line table for the support files
Prior to my patch of using the LLVM line table parsing code,
SymbolFileDWARF::ParseSupportFiles would only parse the line table
prologues to get the file list for any files that could be in the line
table.
With the old behavior, if we found the file that someone is setting the
breakpoint in in the support files list, we would get a valid index. If
we didn't, we would not look any further. So someone sets a breakpoint
one "MyFile.cpp:12" and if we find "MyFile.cpp" in the support file list
for the compile unit, then and only then would we get the entire line
table for that compile unit.
With the current behavior, no matter what, we always fully parse the
line table for all compile units any time any file and line breakpoint
is set. This creates a serious problem when debugging a large DWARF in
.o file project.
This patch re-instates the old behavior. Unfortunately it means we might
end up parsing to prologue twice, but I don't think that outweighs the
cost of trying to cache/reuse it.
Differential revision: https://reviews.llvm.org/D81589
Stephen Neuendorffer [Fri, 12 Jun 2020 05:54:05 +0000 (22:54 -0700)]
[MLIR][cmake] use add_mlir_interface() wherever possible
Differential Revision: https://reviews.llvm.org/D81715
Erich Keane [Fri, 12 Jun 2020 16:13:48 +0000 (09:13 -0700)]
Fix non-determinism issue with implicit lambda captures.
We were using llvm::SmallPtrSet for our ODR-use set which was also used
for instantiating the implicit lambda captures. The order in which the
captures are added depends on this, so the lambda's layout ended up
changing. The test just uses floats, but this was noticed with other
types as well.
This test replaces the short-lived SmallPtrSet (it lasts only for an
expression, which, though is a long time for lambdas, is at least not
forever) with a SmallSetVector.
Louis Dionne [Fri, 12 Jun 2020 16:01:47 +0000 (12:01 -0400)]
[libc++] Parse commands inside _executeScriptInternal to remove duplication
Instead of parsing the command each time prior to calling _executeScriptInternal,
do it once inside _executeScriptInternal.
Huihui Zhang [Fri, 12 Jun 2020 15:53:04 +0000 (08:53 -0700)]
[NFC] Silence compiler warning [-Wmissing-braces].
llvm/lib/Target/AArch64/AArch64SLSHardening.cpp:146:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
"__llvm_slsblr_thunk_x0", "__llvm_slsblr_thunk_x1",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
llvm/lib/Target/AArch64/AArch64SLSHardening.cpp:168:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
AArch64::X0, AArch64::X1, AArch64::X2, AArch64::X3, AArch64::X4,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
Adam Balogh [Fri, 12 Jun 2020 15:07:47 +0000 (17:07 +0200)]
[Analyzer] Replace `assert` with `ASSERT_TRUE` in a unit test to silence warnings
Louis Dionne [Fri, 12 Jun 2020 14:55:30 +0000 (10:55 -0400)]
[libc++] Remove redundant UNSUPPORTED annotation for the GDB pretty-printer tests
That test is already only enabled if LIBCXX_TEST_GDB_PRETTY_PRINTERS is
enabled, which isn't the default. If someone turns on that option on
Windows, they should be able to run the test and see whatever failure
happens.
Jacques Pienaar [Fri, 12 Jun 2020 14:38:12 +0000 (07:38 -0700)]
[mlir] Add Adaptor alias
Summary:
Add Adaptor alias alongside OperandAdaptor to make next renaming more
mechanical. OperandAdaptor's are no longer just about operands.
Considered OpAdaptor too, but then noticed we'd mostly end up with
XOp::OpAdaptor which seems redundant.
Differential Revision: https://reviews.llvm.org/D81741
Matt Arsenault [Fri, 12 Jun 2020 14:20:07 +0000 (10:20 -0400)]
GlobalISel: Fix not erasing old instruction in sitofp/uitofp lowering
Louis Dionne [Fri, 12 Jun 2020 14:28:19 +0000 (10:28 -0400)]
[libc++] Make executor scripts executable
This allows running the scripts directly, without running them through
Python.
Sam McCall [Tue, 9 Jun 2020 13:46:35 +0000 (15:46 +0200)]
Reland [clangd] Parse std::make_unique, and emit template diagnostics at expansion.
This was originally
658af9435071 and reverted in
665dbe91f2ed.
The clang bug this triggered was fixed in
05ed3efc2ac.
Raphael Isemann [Fri, 12 Jun 2020 14:12:04 +0000 (16:12 +0200)]
[lldb] Test creating persistent variables with $[digit] names
Sam McCall [Tue, 9 Jun 2020 15:13:34 +0000 (17:13 +0200)]
Handle delayed-template-parsing functions imported into a non-dtp TU
Summary:
DelayedTemplateParsing is marked as BENIGN_LANGOPT, so we are allowed to
use a delayed template in a non-delayed TU.
(This is clangd's default configuration on windows: delayed-template-parsing
is on for the preamble and forced off for the current file)
However today clang fails to parse implicit instantiations in a non-dtp
TU of templates defined in a dtp PCH file (and presumably module?).
In this case the delayed parser is not registered, so the function is
simply marked "delayed" again. We then hit an assert:
end of TU template instantiation should not create more late-parsed templates
Reviewers: rsmith
Subscribers: ilya-biryukov, usaxena95, cfe-commits, kadircet
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81474
Raphael Isemann [Fri, 12 Jun 2020 14:05:36 +0000 (16:05 +0200)]
[lldb][NFC] Modernize TestPersistentVariables
Kai Sasaki [Fri, 12 Jun 2020 13:57:35 +0000 (15:57 +0200)]
[mlir][doc] Fix typos in tutorial chapters
Summary:
Fix several typos in Toy tutorial chapters.
- Chapter 2
- Chapter 5
Differential Revision: https://reviews.llvm.org/D80909
Masoud Ataei [Fri, 12 Jun 2020 14:02:16 +0000 (10:02 -0400)]
DAGCombiner optimization for pow(x,0.75) and pow(x,0.25) on double and single precision even in case massv function is asked
Here, I am proposing to add an special case for massv powf4/powd2 function (SIMD counterpart of powf/pow function in MASSV library) in MASSV pass to get later optimizations like conversion from pow(x,0.75) and pow(x,0.25) for double and single precision to sequence of sqrt's in the DAGCombiner in vector float case. My reason for doing this is: the optimized pow(x,0.75) and pow(x,0.25) for double and single precision to sequence of sqrt's is faster than powf4/powd2 on P8 and P9.
In case MASSV functions is called, and if the exponent of pow is 0.75 or 0.25, we will get the sequence of sqrt's and if exponent is not 0.75 or 0.25 we will get the appropriate MASSV function.
Reviewed By: steven.zhang
Tags: #LLVM #PowerPC
Differential Revision: https://reviews.llvm.org/D80744
Simon Pilgrim [Fri, 12 Jun 2020 13:46:18 +0000 (14:46 +0100)]
[DAG] foldAddSubOfSignBit - add support for non-uniform vector constants
Simon Pilgrim [Fri, 12 Jun 2020 13:32:36 +0000 (14:32 +0100)]
[X86] Add non-uniform vector signbit test cases
Jacques Pienaar [Fri, 12 Jun 2020 13:50:06 +0000 (06:50 -0700)]
[mlir] Mark CastOp class's shape constraint
These ops have the same operands and result shapes.
Differential Revision: https://reviews.llvm.org/D81664
Haojian Wu [Fri, 12 Jun 2020 13:42:29 +0000 (15:42 +0200)]
Get rid of -Wunused warnings in release build, NFC.
Joel E. Denny [Fri, 12 Jun 2020 13:27:03 +0000 (09:27 -0400)]
[lit] Fix handling of various keyword parse errors
In TestRunner.py, D78589 extracts a `_parseKeywords` function from
`parseIntegratedTestScript`, which then expects `_parseKeywords` to
always return a list of keyword/value pairs. However, the extracted
code sometimes returns an unresolved `lit.Test.Result` on a keyword
parsing error, which then produces a stack dump instead of the
expected diagnostic.
This patch fixes that, makes the style of those diagnostics more
consistent, and extends the lit test suite to cover them.
Reviewed By: ldionne
Differential Revision: https://reviews.llvm.org/D81665
Marco Elver [Fri, 12 Jun 2020 12:58:00 +0000 (14:58 +0200)]
[ASan][NFC] Refactor redzone size calculation
Refactor redzone size calculation. This will simplify changing the
redzone size calculation in future.
Note that AddressSanitizer.cpp violates the latest LLVM style guide in
various ways due to capitalized function names. Only code related to the
change here was changed to adhere to the style guide.
No functional change intended.
Reviewed By: andreyknvl
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81367
Haojian Wu [Thu, 23 Apr 2020 09:14:01 +0000 (11:14 +0200)]
[AST][RecoveryExpr] Build recovery expressions by default for C++.
Reland https://reviews.llvm.org/D76696
All known crashes have been fixed, another attemption.
We have rolled out this to all internal users for a while, didn't see
big issues, we consider it is stable enough.
Reviewed By: sammccall
Subscribers: rsmith, hubert.reinterpretcast, ebevhan, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78350
Xing GUO [Fri, 12 Jun 2020 13:10:14 +0000 (21:10 +0800)]
[ObjectYAML][DWARF] Add one helper function `writeInitialLength()`. NFC.
Kirstóf Umann [Wed, 27 May 2020 10:27:32 +0000 (12:27 +0200)]
[analyzer][NFC] Don't allow dependency checkers to emit diagnostics
The thrilling conclusion to the barrage of patches I uploaded lately! This is a
big milestone towards the goal set out in http://lists.llvm.org/pipermail/cfe-dev/2019-August/063070.html.
I hope to accompany this with a patch where the a coreModeling package is added,
from which package diagnostics aren't allowed either, is an implicit dependency
of all checkers, and the core package for the first time can be safely disabled.
Differential Revision: https://reviews.llvm.org/D78126
Erich Keane [Thu, 28 May 2020 17:25:53 +0000 (10:25 -0700)]
(PR46111) Properly handle elaborated types in an implicit deduction guide
As reported in PR46111, implicit instantiation of a deduction guide
causes us to have an elaborated type as the parameter, rather than the
dependent type.
After review and feedback from @rsmith, this patch solves this problem
by wrapping the value in an uninstantiated typedef/type-alias that is
instantiated when required later.
Differential Revision: https://reviews.llvm.org/D80743
Kirstóf Umann [Wed, 27 May 2020 10:29:47 +0000 (12:29 +0200)]
[analyzer] Introduce weak dependencies to express *preferred* checker callback evaluation order
Checker dependencies were added D54438 to solve a bug where the checker names
were incorrectly registered, for example, InnerPointerChecker would incorrectly
emit diagnostics under the name MallocChecker, or vice versa [1]. Since the
system over the course of about a year matured, our expectations of what a role
of a dependency and a dependent checker should be crystallized a bit more --
D77474 and its summary, as well as a variety of patches in the stack
demonstrates how we try to keep dependencies to play a purely modeling role. In
fact, D78126 outright forbids diagnostics under a dependency checkers name.
These dependencies ensured the registration order and enabling only when all
dependencies are satisfied. This was a very "strong" contract however, that
doesn't fit the dependency added in D79420. As its summary suggests, this
relation is directly in between diagnostics, not modeling -- we'd prefer a more
specific warning over a general one.
To support this, I added a new dependency kind, weak dependencies. These are not
as strict of a contract, they only express a preference in registration order.
If a weak dependency isn't satisfied, the checker may still be enabled, but if
it is, checker registration, and transitively, checker callback evaluation order
is ensured.
If you are not familiar with the TableGen changes, a rather short description
can be found in the summary of D75360. A lengthier one is in D58065.
[1] https://www.youtube.com/watch?v=eqKeqHRAhQM
Differential Revision: https://reviews.llvm.org/D80905
Simon Pilgrim [Fri, 12 Jun 2020 10:30:00 +0000 (11:30 +0100)]
[X86][SSE] combineX86ShuffleChain - combine INSERT_VECTOR_ELT patterns to INSERTPS
Noticed while trying to cleanup D66004 - if a shuffle operand came from a scalar, we're better off using INSERTPS vs UNPCKLPS as this is more likely to load fold later on. It also matches our existing BUILD_VECTOR lowering.
We can extend this to other PINSRB/D/Q/W cases in the future as the need arises.
Frederik Gossen [Fri, 12 Jun 2020 10:53:15 +0000 (10:53 +0000)]
[MLIR] Add missing traits and assembly format to `shape.from/to_extent_tensor`
Add `NoSideEffect` trait to `shape.to_extent_tensor` and
`shape.from_extent_tensor` and defined custom assembly format for the
operations.
Differential Revision: https://reviews.llvm.org/D81158
Florian Hahn [Fri, 12 Jun 2020 10:15:26 +0000 (11:15 +0100)]
[BreakCritEdges] Add option to opt-out of perserving loop-simplify.
This patch adds a new option to CriticalEdgeSplittingOptions to control
whether loop-simplify form must be preserved. It is them used by GVN to
indicate that loop-simplify form does not have to be preserved.
This fixes a crash exposed by
189efe295b6e.
If the critical edge we are splitting goes from a block inside a loop to
a block outside the loop, splitting the edge will create a new exit
block. As a result, the new block will branch to the original exit
block, which will add a non-loop predecessor, breaking loop-simplify
form. To preserve loop-simplify form, the predecessor blocks of the
original exit are split, but that does not work for blocks with
indirectbr terminators. If preserving loop-simplify form is requested,
bail out , before making any changes.
Reviewers: reames, hfinkel, davide, efriedma
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D81582
Kirstóf Umann [Sun, 31 May 2020 20:26:37 +0000 (22:26 +0200)]
[analyzer][NFC] Change checker dependency unit tests to check for the registration order
Exactly what it says on the tin! "Strong" dependencies are mentioned in contrast
to a new kind of dependency introduced in a followup patch.
Differential Revision: https://reviews.llvm.org/D80901
Xing GUO [Fri, 12 Jun 2020 09:55:27 +0000 (17:55 +0800)]
[ObjectYAML][test] Use a single test file to test the empty 'DWARF' entry.
This patch addresses comments in [D81450](https://reviews.llvm.org/D81450#inline-748745)
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D81529
Alex Bradbury [Fri, 12 Jun 2020 09:26:53 +0000 (10:26 +0100)]
[CodeGen] Increase applicability of ffine-grained-bitfield-accesses for targets with limited native integer widths
As pointed out in PR45708, -ffine-grained-bitfield-accesses doesn't
trigger in all cases you think it might for RISC-V. The logic in
CGRecordLowering::accumulateBitFields checks OffsetInRecord is a legal
integer according to the datalayout. RISC targets will typically only
have the native width as a legal integer type so this check will fail
for OffsetInRecord of 8 or 16 when you would expect the transformation
is still worthwhile.
This patch changes the logic to check for an OffsetInRecord of a at
least 1 byte, that fits in a legal integer, and is a power of 2. We
would prefer to query whether native load/store operations are
available, but I don't believe that is possible.
Differential Revision: https://reviews.llvm.org/D79155
Raphael Isemann [Fri, 12 Jun 2020 09:18:38 +0000 (11:18 +0200)]
Add missing IRBuilder include to IndirectThunks.h
This file didn't build with enabled modules.
Florian Hahn [Fri, 12 Jun 2020 09:16:03 +0000 (10:16 +0100)]
[VPlan] Reject loops without computable backedge taken counts
getOrCreateTripCount is used to generate code for the outer loop, but it
requires a computable backedge taken counts. Check that in the VPlan
native path.
Reviewers: Ayal, gilr, rengolin, sguggill
Reviewed By: sguggill
Differential Revision: https://reviews.llvm.org/D81088
Sebastian Neubauer [Wed, 25 Mar 2020 07:38:22 +0000 (08:38 +0100)]
[AMDGPU] Add G16 support to image instructions
Add G16 feature for GFX10 and support A16 and G16 in GlobalISel.
Differential Revision: https://reviews.llvm.org/D76836
Georgii Rymar [Thu, 11 Jun 2020 20:18:40 +0000 (23:18 +0300)]
[yaml2obj][MachO] - Fix PubName/PubType handling.
`PubName` and `PubType` are optional fields since D80722.
They are defined as:
Optional<PubSection> PubNames;
Optional<PubSection> PubTypes;
And initialized in the following way:
IO.mapOptional("debug_pubnames", DWARF.PubNames);
IO.mapOptional("debug_pubtypes", DWARF.PubTypes);
But problem is that because of the issue in `YAMLTraits.cpp`,
when there are no `debug_pubnames`/`debug_pubtypes` keys in a YAML description,
they are not initialized to `Optional::None` as the code expects, but they
are initialized to default `PubSection()` instances.
Because of this, the `if` condition in the following code is always true:
if (Obj.DWARF.PubNames)
Err = DWARFYAML::emitPubSection(OS, *Obj.DWARF.PubNames,
Obj.IsLittleEndian);
What means `emitPubSection` is always called and it writes few values.
This patch fixes the issue. I've reduced `sizeofcmds` by size of data
previously written because of this bug.
Differential revision: https://reviews.llvm.org/D81686
Raphael Isemann [Fri, 12 Jun 2020 08:08:08 +0000 (10:08 +0200)]
[lldb] Don't print IRForTarget errors directly to the console
Summary:
When we get an error back from IRForTarget we directly print that error to the
debugger output stream instead of putting it in the result object. The result
object only gets a vague "The expression could not be prepared to run in the
target" error message that doesn't actually tell the user what went wrong.
This patch just puts the IRForTarget errors into the status object that is
returned to the caller instead of directly printing it to the debugger. Also
updates one test that now can actually check for the error message it is
supposed to check for (instead of the default error which is all we had before).
Reviewers: JDevlieghere
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D81654
Chen Zheng [Fri, 12 Jun 2020 06:58:34 +0000 (02:58 -0400)]
[PowerPC] refactor convertToImmediateForm - NFC
This is a NFC patch to make convertToImmediateForm a light wrapper
for converting xform and imm form instructions on PowerPC.
Reviewed By: Steven.zhang
Differential Revision: https://reviews.llvm.org/D80907
Rainer Orth [Fri, 12 Jun 2020 07:56:42 +0000 (09:56 +0200)]
[cmake] Don't pass -z discard-unused to Illumos ld
I'm currently working to port `libc++` to Solaris. There exists a slightly
bitrotten port already, which was done on Illumos, an OpenSolaris
derivative. In order not to break that port with my work, I need to test
the result on both Solaris and Illumos. While doing so, it turned out that
Illumos `ld` doesn't support the `-z discard-sections=unused` option
currently used on SunOS unconditionally.
While there exists a patch
<https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/developer/clang-90/patches/02-cmake_modules_AddLLVM.cmake.patch>
for LLVM 9.0 in the OpenIndiana repository, it apparently hasn't been
submitted upstream and is completely wrong: it replaces
`-z discard-sections=unused` with `-z ignore`. In terms of the equivalent
`gld` options, this means replacing `--gc-sections` with `--as-needed`.
This patch instead tests if the linker actually supports the option before
using it.
Tested on `amd64-pc-solaris2.11` (all of Solaris 11.4, 11.3 and OpenIndiana
2020.04).
Differential Revision: https://reviews.llvm.org/D81545
Martin Boehme [Mon, 8 Jun 2020 13:37:44 +0000 (15:37 +0200)]
[clang] Rename Decl::isHidden() to isUnconditionallyVisible().
Also invert the sense of the return value.
As pointed out by the FIXME that this change resolves, isHidden() wasn't
a very accurate name for this function.
I haven't yet changed any of the strings that are output in
ASTDumper.cpp / JSONNodeDumper.cpp / TextNodeDumper.cpp in response to
whether isHidden() is set because
a) I'm not sure whether it's actually desired to change these strings
(would appreciate feedback on this), and
b) In any case, I'd like to get this pure rename out of the way first,
without any changes to tests. Changing the strings that are output in
the various ...Dumper.cpp files will require changes to quite a few
tests, and I'd like to make those in a separate change.
Differential Revision: https://reviews.llvm.org/D81392
Reviewed By: rsmith
EgorBo [Fri, 12 Jun 2020 07:08:17 +0000 (10:08 +0300)]
[InstCombine] "X - (X / C) * C == 0" to "X & C-1 == 0"
Summary:
"X % C == 0" is optimized to "X & C-1 == 0" (where C is a power-of-two)
However, "X % Y" can also be represented as "X - (X / Y) * Y" so if I rewrite the initial expression:
"X - (X / C) * C == 0" it's not currently optimized to "X & C-1 == 0", see godbolt: https://godbolt.org/z/KzuXUj
This is my first contribution to LLVM so I hope I didn't mess things up
Reviewers: lebedev.ri, spatel
Reviewed By: lebedev.ri
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79369
EgorBo [Fri, 12 Jun 2020 07:01:21 +0000 (10:01 +0300)]
[NFC][InstCombine] Tests for "X - (X / C) * C == 0" pattern
See https://reviews.llvm.org/D79369
Jonas Devlieghere [Fri, 12 Jun 2020 07:01:54 +0000 (00:01 -0700)]
[llvm/Object] Reimplment basic_symbol_iterator in TapiFile
Use indices into the Symbols vector instead of casting the objects in
the vector and dereferencing std::vector::end().
This change is NFC modulo the Windows failure reported by
llvm-clang-x86_64-expensive-checks-win.
Differential revision: https://reviews.llvm.org/D81717
Kristof Beyls [Thu, 11 Jun 2020 08:23:15 +0000 (09:23 +0100)]
[AArch64] Extend AArch64SLSHardeningPass to harden BLR instructions.
To make sure that no barrier gets placed on the architectural execution
path, each
BLR x<N>
instruction gets transformed to a
BL __llvm_slsblr_thunk_x<N>
instruction, with __llvm_slsblr_thunk_x<N> a thunk that contains
__llvm_slsblr_thunk_x<N>:
BR x<N>
<speculation barrier>
Therefore, the BLR instruction gets split into 2; one BL and one BR.
This transformation results in not inserting a speculation barrier on
the architectural execution path.
The mitigation is off by default and can be enabled by the
harden-sls-blr subtarget feature.
As a linker is allowed to clobber X16 and X17 on function calls, the
above code transformation would not be correct in case a linker does so
when N=16 or N=17. Therefore, when the mitigation is enabled, generation
of BLR x16 or BLR x17 is avoided.
As BLRA* indirect calls are not produced by LLVM currently, this does
not aim to implement support for those.
Differential Revision: https://reviews.llvm.org/D81402
Mehdi Amini [Fri, 12 Jun 2020 05:00:47 +0000 (05:00 +0000)]
Revert "[mlir][spirv] Enhance structure type member decoration handling"
This reverts commit
5d74df5b03e46b7bd3700e3595c7008a6905b288.
This broke the MSVC build: <bits/stdint-uintn.h> isn't available on Windows
Yevgeny Rouban [Fri, 12 Jun 2020 04:55:15 +0000 (11:55 +0700)]
[JumpThreading] Handle zero !prof branch_weights
Avoid division by zero in updatePredecessorProfileMetadata().
Reviewers: yamauchi
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81499
Craig Topper [Fri, 12 Jun 2020 04:14:45 +0000 (21:14 -0700)]
[X86] Add a helper lambda to getIntelProcessorTypeAndSubtype to select feature bits from the correct 32-bit feature variable.
We have three 32 bit variables containing feature bits. But our
enum is a flat 96 bit space. So we need to pick which of the
variables to use based on the bit value. We used to do this
manually by mentioning the correct variable and subtracting an
offset from the enum. But this is error prone.
Vitaly Buka [Fri, 12 Jun 2020 01:56:20 +0000 (18:56 -0700)]
[StackSafety] Fix byval handling
We don't need process paramenters which marked as
byval as we are not going to pass interested allocas
without copying.
If we pass value into byval argument, we just handle that
as Load of corresponding type and stop that branch of analysis.
Alexander Shaposhnikov [Fri, 12 Jun 2020 02:55:04 +0000 (19:55 -0700)]
[llvm-objcopy][MachO] Fix cmdsize of LC_RPATH
Fix the calculation of the field cmdsize (in the function buildRPathLoadCommand)
to account for the null byte terminator.
Patch by Sameer Arora!
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D81575
Jonas Devlieghere [Fri, 12 Jun 2020 02:29:26 +0000 (19:29 -0700)]
[lldb/Test] Fix ASan/TSan workaround for Xcode Python 3
The Python 3 interpreter in Xcode has a relative RPATH and dyld fails to
load it when we copy it into the build directory.
This patch adds an additional check that the copied binary can be
executed. If it doesn't, we assume we're dealing with the Xcode python
interpreter and return the path to the real executable. That is
sufficient for the sanitizers because only system binaries need to be
copied to work around SIP.
This patch also moves all that logic out of LLDBTest and into the lit
configuration so that it's executed only once per test run, instead of
once for every test. Although I didn't benchmark the difference this
should result in a mild speedup.
Differential revision: https://reviews.llvm.org/D81696
Yonghong Song [Thu, 11 Jun 2020 02:13:37 +0000 (19:13 -0700)]
[BPF] fix incorrect type in BPFISelDAGToDAG readonly load optimization
In BPF Instruction Selection DAGToDAG transformation phase,
BPF backend had an optimization to turn load from readonly data
section to direct load of the values. This phase is implemented
before libbpf has readonly section support and before alu32
is supported.
This phase however may generate incorrect type when alu32 is
enabled. The following is an example,
-bash-4.4$ cat ~/tmp2/t.c
struct t {
unsigned char a;
unsigned char b;
unsigned char c;
};
extern void foo(void *);
int test() {
struct t v = {
.b = 2,
};
foo(&v);
return 0;
}
The compiler will turn local variable "v" into a readonly section.
During instruction selection phase, the compiler generates two
loads from readonly section, one 2 byte load or 1 byte load, e.g., for 2 loads,
t8: i32,ch = load<(dereferenceable load 2 from `i8* getelementptr inbounds
(%struct.t, %struct.t* @__const.test.v, i64 0, i32 0)`, align 1),
anyext from i16> t3, GlobalAddress:i64<%struct.t* @__const.test.v> 0, undef:i64
t9: ch = store<(store 2 into %ir.v1.sub1), trunc to i16> t3, t8,
FrameIndex:i64<0>, undef:i64
BPF backend changed t8 to i64 = Constant<2> and eventually the generated machine IR:
t10: i64 = MOV_ri TargetConstant:i64<2>
t40: i32 = SLL_ri_32 t10, TargetConstant:i32<8>
t41: i32 = OR_ri_32 t40, TargetConstant:i64<0>
t9: ch = STH32<Mem:(store 2 into %ir.v1.sub1)> t41, TargetFrameIndex:i64<0>,
TargetConstant:i64<0>, t3
Note that t10 in the above is not correct. The type should be i32 and instruction
should be MOV_ri_32. The reason for incorrect insn selection is BPF insn selection
generated an i64 constant instead of an i32 constant as specified in the original
load instruction. Such incorrect insn sequence eventually caused the following
fatal error when a COPY insn tries to copy a 64bit register to a 32bit subregister.
Impossible reg-to-reg copy
UNREACHABLE executed at ../lib/Target/BPF/BPFInstrInfo.cpp:42!
This patch fixed the issue by using the load result type instead of always i64
when doing readonly load optimization.
Differential Revision: https://reviews.llvm.org/D81630
Esme-Yi [Fri, 12 Jun 2020 02:23:52 +0000 (02:23 +0000)]
Revert "[PowerPC][NFC] Testing ROTL of v1i128."
This reverts commit
174192af0106be9764aeda34988f27dc2c1bd4c4.
Cyndy Ishida [Fri, 12 Jun 2020 01:32:45 +0000 (18:32 -0700)]
[llvm][llvm-nm] add TextAPI/MachO support
Summary:
This completes the needed glueing to support reading tbd files from nm.
This includes specifying which slice filtering with `--arch` and a new
option specifically for tbd files `--add-inlinedinfo` which will show
the reexported libraries that are appended in the tbd file.
Reviewers: ributzka, steven_wu, JDevlieghere, jhenderson
Reviewed By: JDevlieghere
Subscribers: hiraditya, MaskRay, dexonsmith, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81614
Alina Sbirlea [Fri, 12 Jun 2020 01:16:33 +0000 (18:16 -0700)]
Verify MemorySSA after all updates.
Verify after completing all updates.
Resolves PR46275.
Stella Laurenzo [Thu, 11 Jun 2020 21:01:52 +0000 (14:01 -0700)]
Install the MLIRTableGen static library.
Summary: * This library is special because of its dependencies so seems to have been inadvertently left out of installs.
Reviewers: antiagainst
Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D81693
Mehdi Amini [Fri, 12 Jun 2020 00:34:35 +0000 (00:34 +0000)]
Enable FileCheck -enable-var-scope by default in MLIR test
This option avoids to accidentally reuse variable across -LABEL match,
it can be explicitly opted-in by prefixing the variable name with $
Differential Revision: https://reviews.llvm.org/D81531
Wen-Heng (Jack) Chung [Fri, 12 Jun 2020 00:15:16 +0000 (19:15 -0500)]
Use python3 in generate-test-checks.py.
Summary: Upgrade to python3 in generate-test-checks.py .
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes
Tags: #mlir
Differential Revision: https://reviews.llvm.org/D81701
HazemAbdelhafez [Wed, 10 Jun 2020 23:15:55 +0000 (19:15 -0400)]
[mlir][spirv] Enhance structure type member decoration handling
Modify structure type in SPIR-V dialect to support:
1) Multiple decorations per structure member
2) Key-value based decorations (e.g., MatrixStride)
This commit kept the Offset decoration separate from members'
decorations container for easier implementation and logical clarity.
As such, all references to Structure layoutinfo are now offsetinfo,
and any member layout defining decoration (e.g., RowMajor for Matrix)
will be add to the members' decorations container along with its
value if any.
Differential Revision: https://reviews.llvm.org/D81426
Eric Christopher [Thu, 11 Jun 2020 23:42:23 +0000 (16:42 -0700)]
Tidy up unsigned -> Register fixups.
Jacques Pienaar [Thu, 11 Jun 2020 23:45:37 +0000 (16:45 -0700)]
[mlir] Add additional header
Fix gcc10 build and closes: https://bugs.llvm.org/show_bug.cgi?id=45680
Eric Christopher [Thu, 11 Jun 2020 23:34:31 +0000 (16:34 -0700)]
Add a diagnostic string to an assert.
Matt Arsenault [Thu, 11 Jun 2020 23:19:13 +0000 (19:19 -0400)]
AMDGPU/GlobalISel: Fix select of private <2 x s16> load
Sanjay Patel [Thu, 11 Jun 2020 20:50:03 +0000 (16:50 -0400)]
[VectorCombine] remove unused parameters; NFC
Vitaly Buka [Thu, 11 Jun 2020 20:47:50 +0000 (13:47 -0700)]
[StackSafety,NFC] Fix use of CallBase API
Code does not need iterate arguments and can get ArgNo from
CallBase::getArgOperandNo.
Matt Arsenault [Thu, 11 Jun 2020 12:54:00 +0000 (08:54 -0400)]
AMDGPU/GlobalISel: Fix select of <8 x s64> scalar load
Akira Hatanaka [Wed, 3 Jun 2020 23:41:50 +0000 (16:41 -0700)]
[CodeGen] Simplify the way lifetime of block captures is extended
Rather than pushing inactive cleanups for the block captures at the
entry of a full expression and activating them during the creation of
the block literal, just call pushLifetimeExtendedDestroy to ensure the
cleanups are popped at the end of the scope enclosing the block
expression.
rdar://problem/
63996471
Differential Revision: https://reviews.llvm.org/D81624
Jonas Devlieghere [Thu, 11 Jun 2020 22:39:49 +0000 (15:39 -0700)]
[lldb/Test] Unify DYLD_INSERT_LIBRARIES solution for ASan and TSan
Add the same fix for loading the sanitizer runtime for TSan as we
currently have for ASan and unify the code with a helper function.
Matt Arsenault [Thu, 11 Jun 2020 22:28:31 +0000 (18:28 -0400)]
AMDGPU/GlobalISel: Set insert point when emitting control flow pseudos
This was implicitly assuming the branch instruction was the next after
the pseudo. It's possible for another non-terminator instruction to be
inserted between the intrinsic and the branch, so adjust the insertion
point. Fixes a non-terminator after terminator verifier error (which
without the verifier, manifested itself as an infinite loop in
analyzeBranch much later on).
George Mitenkov [Thu, 11 Jun 2020 22:46:09 +0000 (18:46 -0400)]
[MLIR][SPIRVToLLVM] Added conversion for SPIR-V comparison ops
Implemented `FComparePattern` and `IComparePattern` classes
that provide conversion of SPIR-V comparison ops (such as
`spv.FOrdGreaterThanEqual` and others) to LLVM dialect.
Also added tests in `comparison-ops-to-llvm.mlir`.
Differential Revision: https://reviews.llvm.org/D81487
Kirill Naumov [Thu, 11 Jun 2020 20:24:14 +0000 (20:24 +0000)]
[InlineCost] Preparational patch for creation of Printer pass.
- Renaming the printer class, flag
- Refactoring
- Changing some tests
This patch is a preparational stage for introducing a new printing pass and new
functionality to the existing Annotation Writer. I plan to extend
this functionality for this tool to be more useful when looking at the inline
process.
Fangrui Song [Thu, 11 Jun 2020 22:19:05 +0000 (15:19 -0700)]
[Support] Don't tie errs() to outs() by default
This reverts part of D81156.
Accessing errs() concurrently was safe before and racy after D81156.
(`errs() << 'a'` is always racy)
Accessing outs() and errs() concurrently was safe before and racy after D81156.
Don't tie errs() to outs() by default to fix the fallout.
llvm-dwarfdump is single-threaded and opting in the tie behavior is safe.
John McCall [Thu, 11 Jun 2020 22:09:36 +0000 (18:09 -0400)]
Set the LLVM FP optimization flags conservatively.
Functions can have local pragmas that override the global settings.
We set the flags eagerly based on global settings, but if we emit
an expression under the influence of a pragma, we clear the
appropriate flags from the function.
In order to avoid doing a ton of redundant work whenever we emit
an FP expression, configure the IRBuilder to default to global
settings, and only reconfigure it when we see an FP expression
that's not using the global settings.
Patch by Michele Scandale!
https://reviews.llvm.org/D80462
Stanislav Mekhanoshin [Thu, 11 Jun 2020 17:45:42 +0000 (10:45 -0700)]
Fixed assertion in SROA if block has ho successors
BasicBlock::isLegalToHoistInto() asserts if block does not
have successors. The case is degenarate but assertion still
needs to be avoided.
https://bugs.llvm.org/show_bug.cgi?id=46280
Differential Revision: https://reviews.llvm.org/D81674
Craig Topper [Thu, 11 Jun 2020 21:54:41 +0000 (14:54 -0700)]
[X86] Remove unnecessary #if around call to isCpuIdSupported in getHostCPUName.
The exact same #if is already inside isCpuIdSupported and causes
it to return true. The definition of isCpuIdSupported isn't
conditional so we should be able just rely on its body doing
the right thing.
Thomas Lively [Thu, 11 Jun 2020 22:11:45 +0000 (15:11 -0700)]
[WebAssembly] Make BR_TABLE non-duplicable
Summary:
After their range checks were removed in
7f50c15be5c0, br_tables
started being duplicated into their predecessors by tail
folding. Unfortunately, when the br_tables were in loops this
transformation introduced bad irreducible control flow which was later
expanded into even more br_tables. This commit abuses the
`isNotDuplicable` property to prevent this irreducible control flow
from being introduced. This change saves a few dozen bytes of code
size and has a negligible affect on performance for most of the large
Emscripten benchmarks, but can improve performance significantly on
microbenchmarks of switches in loops.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81628
Ilya Bukonkin [Thu, 11 Jun 2020 21:59:19 +0000 (14:59 -0700)]
[lldb] Check if thread was suspended during previous stop added.
Encountered the following situation: Let we started thread T1 and it hit
breakpoint on B1 location. We suspended T1 and continued the process.
Then we started thread T2 which hit for example the same location B1.
This time in a breakpoint callback we decided not to stop returning
false.
Expected result: process continues (as if T2 did not hit breakpoint) its
workflow with T1 still suspended. Actual result: process do stops (as if
T2 callback returned true).
Solution: We need invalidate StopInfo for threads that was previously
suspended just because something that is already inactive can not be the
reason of stop. Thread::GetPrivateStopInfo() may be appropriate place to
do it, because it gets called (through Thread::GetStopInfo()) every time
before process reports stop and user gets chance to change
m_resume_state again i.e if we see m_resume_state == eStateSuspended
it definitely means it was set during previous stop and it also means
this thread can not be stopped again (cos' it was frozen during
previous stop).
Differential revision: https://reviews.llvm.org/D80112
Diego Caballero [Thu, 11 Jun 2020 21:39:44 +0000 (14:39 -0700)]
[mlir][Affine] Revisit fusion candidates after successful fusion
This patch changes the fusion algorithm so that after fusing two loop nests
we revisit previously visited nodes so that they are considered again for
fusion in the context of the new fused loop nest.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D81609
Reid Kleckner [Thu, 11 Jun 2020 20:00:54 +0000 (13:00 -0700)]
Re-land "Migrate the rest of COFFObjectFile to Error"
This reverts commit
101fbc01382edd89ea7b671104c68b30b2446cc0.
Remove leftover debugging attribute.
Update LLDB as well, which was missed before.
Kadir Cetinkaya [Thu, 11 Jun 2020 20:49:52 +0000 (22:49 +0200)]
[clangd] Set CWD in semaCodeComplete
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D81691
Alex Richardson [Thu, 11 Jun 2020 21:23:27 +0000 (22:23 +0100)]
Fix incorrect call to ExprResult::get()
Res is already a ExprResult, so if we call .get(), we will convert an
ExprError() result into an unset result. I discovered this in our downstream
CHERI target where this resulted in a crash due to a NULL-dereference.
It appears that this was introduced in SVN revision 201788 (
8690a6860a45ba36e39b4ff0dbe434195e125d11)
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D81608
Fangrui Song [Thu, 11 Jun 2020 20:50:56 +0000 (13:50 -0700)]
[GlobalISel][test] Add REQUIRES: asserts after D76934
Jacques Pienaar [Thu, 11 Jun 2020 20:45:09 +0000 (13:45 -0700)]
[mlir] Remove Broadcastable ODS trait
Alias to ResultsBroadcastableShape ODS trait which matches C++ class.
Louis Dionne [Thu, 11 Jun 2020 19:41:38 +0000 (15:41 -0400)]
[libc++] Allow specifying arbitrary custom executors with the new format
The integration between CMake and executor selection in the new format
wasn't very flexible -- only the default executor and SSH executors were
supported.
This patch makes it possible to specify arbitrary executors with the new
format. With the new testing format, a custom executor is just a script
that gets called with a command-line to execute, and some arguments like
--env, --codesign_identity and --execdir. As such, the default executor
is just run.py.
Remote execution with the SSH executor can be achived by specifying
LIBCXX_EXECUTOR="<path-to-ssh.py> --host <host>". Similarly, arbitrary
scripts can be provided.
Alexander Belyaev [Thu, 11 Jun 2020 17:22:48 +0000 (19:22 +0200)]
[mlir] Fix some of the warnings in MLIR code.
Summary:
* extra ';' in the following files:
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
mlir/lib/Dialect/Shape/IR/Shape.cpp
* base class ‘mlir::ConvertVectorToSCFBase<ConvertVectorToSCFPass>’
should be explicitly initialized in the copy constructor [-Wextra] in
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
* warning: ‘bool Expression::operator==(const Expression&) const’
defined but not used [-Wunused-function] in
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
Differential Revision: https://reviews.llvm.org/D81673
Craig Topper [Thu, 11 Jun 2020 19:45:54 +0000 (12:45 -0700)]
[X86] Force VIA PadLock crypto instructions to emit a 0xF3 prefix when they encode to match what GNU as does.
The spec for these says they need 0xf3 but also mentions REP
before the mnemonic. But I don't think its fair to users to make
them write REP first. And gas doesn't make them. objdump seems to
disassemble with or without the prefix and just prints any 0xf3
as REP.
Aditya Nandakumar [Thu, 11 Jun 2020 19:29:12 +0000 (12:29 -0700)]
[GISel][NFC]: Add unit test for clarifying CSE behavior
Add a unit test that shows how CSE works if we install an observer
at the machine function level and not use the CSEMIRBuilder to build
instructions.
https://reviews.llvm.org/D81625
Erich Keane [Mon, 1 Jun 2020 19:14:34 +0000 (12:14 -0700)]
Add to the Coding Standard our that single-line bodies omit braces
This is a rule that seems to have been enforced for the better part of
the decade, so we should document it for new contributors.
Differential Revision: https://reviews.llvm.org/D80947
Bruno Ricci [Thu, 11 Jun 2020 16:36:28 +0000 (17:36 +0100)]
[clang] TextNodeDumper: Dump the trait spelling of {Type,ArrayType,Expression}TraitExpr
nodes using the new helper functions introduced
in
78e636b3f2f0b0487130b31fade4f95ab179a18c.
Bruno Ricci [Thu, 11 Jun 2020 16:29:15 +0000 (17:29 +0100)]
[clang][NFC] Assert that the enumerator value of {Type,ArrayType,UnaryExprOrType,Expression}Traits
is valid and does not overflow in the bit-field for its storage in more places.
This is a follow-up to
78e636b3f2f0b0487130b31fade4f95ab179a18c. NFC.
Bruno Ricci [Thu, 11 Jun 2020 16:24:04 +0000 (17:24 +0100)]
[clang][NFC] Remove two hard-coded lists of ArrayTypeTrait and ExpressionTrait
These two were missed in
78e636b3f2f0b0487130b31fade4f95ab179a18c.
Siva Chandra Reddy [Tue, 2 Jun 2020 21:04:57 +0000 (14:04 -0700)]
[libc] Add implementation of few floating point manipulation functions.
Implementations of copysign[f], frexp[f], logb[f], and modf[f] are added.
Reviewers: asteinhauser
Differential Revision: https://reviews.llvm.org/D81134
Craig Topper [Thu, 11 Jun 2020 19:18:52 +0000 (12:18 -0700)]
[X86] Replace TB with PS on instructions that are documented in the SDM with 'NP'
'NP' means that the instruction is not recognized with a 66, F2 or F3
prefix. It will either #UD or decode to a different instruction.
All of the cases are here should fall into the #UD variety since
we should be detecting the collision with other instructions when
we build the disassembler tables.
Eli Friedman [Thu, 11 Jun 2020 19:13:18 +0000 (12:13 -0700)]
[AArch64] Regenerate SVE test llvm-ir-to-intrinsic.ll.
Louis Dionne [Thu, 11 Jun 2020 17:50:40 +0000 (13:50 -0400)]
[libc++abi] Simplify the logic for finding libc++ from libc++abi
Since we have the monorepo, libc++abi's build requires a sibling checkout
of the libc++ sources. Hence, the logic for finding libc++ can be greatly
simplified.