James Henderson [Fri, 5 Jul 2019 16:38:52 +0000 (16:38 +0000)]
[docs][llvm-readobj] Add a note to options that do nothing in GNU output
--section-data, --section-relocations and --section-symbols have no
effect for GNU style ouput. This patch changes the docs to point this
out, as it has caught me out on a couple of occasions.
See also https://bugs.llvm.org/show_bug.cgi?id=42522.
llvm-svn: 365221
Thomas Preud'homme [Fri, 5 Jul 2019 16:25:46 +0000 (16:25 +0000)]
[FileCheck] Share variable instance among uses
Summary:
This patch changes expression support to use one instance of
FileCheckNumericVariable per numeric variable rather than one per
variable and per definition. The current system was only necessary for
the last patch of the numeric expression support patch series in order
to handle a line using a variable defined earlier on the same line from
the input text. However this can be dealt more efficiently.
Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk
Subscribers: JonChesterfield, rogfer01, hfinkel, kristina, rnk, tra, arichardson, grimar, dblaikie, probinson, llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64229
llvm-svn: 365220
Thomas Preud'homme [Fri, 5 Jul 2019 16:25:33 +0000 (16:25 +0000)]
[FileCheck] Don't diagnose undef vars at parse time
Summary:
Diagnosing use of undefined variables takes place in
parseNumericVariableUse() and printSubstitutions() for numeric variables
but only takes place in printSubstitutions() for string variables. The
reason for the split location of diagnostics is that parsing is not
aware of the clearing of variables due to --enable-var-scope and thus
use of variables cleared in this way can only be catched by
printSubstitutions().
Beyond the code level inconsistency, there is also a user facing
inconsistency since diagnostics look different between the two
functions. While the diagnostic in printSubstitutions is more verbose,
doing the diagnostic there allows to diagnose all undefined variables
rather than just the first one and error out.
This patch create dummy variable definition when encountering a use of
undefined variable so that parsing can proceed and be diagnosed by
printSubstitutions() later. Tests that were testing whether parsing
fails in such case are thus modified accordingly.
Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk
Subscribers: JonChesterfield, rogfer01, hfinkel, kristina, rnk, tra, arichardson, grimar, dblaikie, probinson, llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64228
llvm-svn: 365219
Louis Dionne [Fri, 5 Jul 2019 16:05:26 +0000 (16:05 +0000)]
[pstl] Add missing includes
llvm-svn: 365218
Yaxun Liu [Fri, 5 Jul 2019 16:05:17 +0000 (16:05 +0000)]
[AMDGPU] Added a new metadata for multi grid sync implicit argument
Patch by Christudasan Devadasan.
Differential Revision: https://reviews.llvm.org/D63886
llvm-svn: 365217
Matt Arsenault [Fri, 5 Jul 2019 15:32:28 +0000 (15:32 +0000)]
ScheduleDAG: Fix incorrectly killing registers in bundles
When looking for uses/defs to add kill flags, the iterator was double
incremented, skipping the first instruction in the bundle. The use
register in the first bundle instruction was then incorrectly killed.
The "First" instruction should be the BUNDLE itself as the proper
reverse iterator endpoint.
llvm-svn: 365216
Eugene Leviant [Fri, 5 Jul 2019 15:25:05 +0000 (15:25 +0000)]
[ThinLTO] Attempt to recommit r365188 after alignment fix
llvm-svn: 365215
David Green [Fri, 5 Jul 2019 15:21:29 +0000 (15:21 +0000)]
[ARM] MVE patterns for VMVN, VORR and VBIC
This add simple Q register forms of bitwise not instructions.
Differential Revision: https://reviews.llvm.org/D63983
llvm-svn: 365214
Nico Weber [Fri, 5 Jul 2019 15:14:06 +0000 (15:14 +0000)]
gn build: Merge r365203
llvm-svn: 365213
Nico Weber [Fri, 5 Jul 2019 15:12:31 +0000 (15:12 +0000)]
Add a comment explaining why a function exists
llvm-svn: 365212
Jay Foad [Fri, 5 Jul 2019 14:52:48 +0000 (14:52 +0000)]
[AMDGPU] DPP combiner: recognize identities for more opcodes
Summary:
This allows the DPP combiner to kick in more often. For example the
exclusive scan generated by the atomic optimizer for a divergent atomic
add used to look like this:
v_mov_b32_e32 v3, v1
v_mov_b32_e32 v5, v1
v_mov_b32_e32 v6, v1
v_mov_b32_dpp v3, v2 wave_shr:1 row_mask:0xf bank_mask:0xf
s_nop 1
v_add_u32_dpp v4, v3, v3 row_shr:1 row_mask:0xf bank_mask:0xf bound_ctrl:0
v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
v_mov_b32_dpp v6, v3 row_shr:3 row_mask:0xf bank_mask:0xf
v_add3_u32 v3, v4, v5, v6
v_mov_b32_e32 v4, v1
s_nop 1
v_mov_b32_dpp v4, v3 row_shr:4 row_mask:0xf bank_mask:0xe
v_add_u32_e32 v3, v3, v4
v_mov_b32_e32 v4, v1
s_nop 1
v_mov_b32_dpp v4, v3 row_shr:8 row_mask:0xf bank_mask:0xc
v_add_u32_e32 v3, v3, v4
v_mov_b32_e32 v4, v1
s_nop 1
v_mov_b32_dpp v4, v3 row_bcast:15 row_mask:0xa bank_mask:0xf
v_add_u32_e32 v3, v3, v4
s_nop 1
v_mov_b32_dpp v1, v3 row_bcast:31 row_mask:0xc bank_mask:0xf
v_add_u32_e32 v1, v3, v1
v_add_u32_e32 v1, v2, v1
v_readlane_b32 s0, v1, 63
But now most of the dpp movs are combined into adds:
v_mov_b32_e32 v3, v1
v_mov_b32_e32 v5, v1
s_nop 0
v_mov_b32_dpp v3, v2 wave_shr:1 row_mask:0xf bank_mask:0xf
s_nop 1
v_add_u32_dpp v4, v3, v3 row_shr:1 row_mask:0xf bank_mask:0xf bound_ctrl:0
v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
v_mov_b32_dpp v1, v3 row_shr:3 row_mask:0xf bank_mask:0xf
v_add3_u32 v1, v4, v5, v1
s_nop 1
v_add_u32_dpp v1, v1, v1 row_shr:4 row_mask:0xf bank_mask:0xe
s_nop 1
v_add_u32_dpp v1, v1, v1 row_shr:8 row_mask:0xf bank_mask:0xc
s_nop 1
v_add_u32_dpp v1, v1, v1 row_bcast:15 row_mask:0xa bank_mask:0xf
s_nop 1
v_add_u32_dpp v1, v1, v1 row_bcast:31 row_mask:0xc bank_mask:0xf
v_add_u32_e32 v1, v2, v1
v_readlane_b32 s0, v1, 63
Reviewers: arsenm, vpykhtin
Subscribers: kzhuravl, nemanjai, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kbarton, MaskRay, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64207
llvm-svn: 365211
Hamza Sood [Fri, 5 Jul 2019 14:36:08 +0000 (14:36 +0000)]
NFC: Add an explicit return for safety and consistency
This case implicitly falls-through, which is fine now as it's at the end of the
function, but it seems like an accident waiting to happen.
llvm-svn: 365210
Kristof Umann [Fri, 5 Jul 2019 14:22:10 +0000 (14:22 +0000)]
Removed the test case added in D63538 due to windows buildbot failures
llvm-svn: 365209
Kristof Umann [Fri, 5 Jul 2019 14:00:08 +0000 (14:00 +0000)]
[analyzer] Add a debug analyzer config to place an event for each tracked condition
Differential Revision: https://reviews.llvm.org/D63642
llvm-svn: 365208
Kristof Umann [Fri, 5 Jul 2019 13:29:54 +0000 (13:29 +0000)]
[analyzer] Track terminator conditions on which a tracked expression depends
This patch is a major part of my GSoC project, aimed to improve the bug
reports of the analyzer.
TL;DR: Help the analyzer understand that some conditions are important,
and should be explained better. If an CFGBlock is a control dependency
of a block where an expression value is tracked, explain the condition
expression better by tracking it.
if (A) // let's explain why we believe A to be true
10 / x; // division by zero
This is an experimental feature, and can be enabled by the
off-by-default analyzer configuration "track-conditions".
In detail:
This idea was inspired by the program slicing algorithm. Essentially,
two things are used to produce a program slice (a subset of the program
relevant to a (statement, variable) pair): data and control
dependencies. The bug path (the linear path in the ExplodedGraph that leads
from the beginning of the analysis to the error node) enables to
analyzer to argue about data dependencies with relative ease.
Control dependencies are a different slice of the cake entirely.
Just because we reached a branch during symbolic execution, it
doesn't mean that that particular branch has any effect on whether the
bug would've occured. This means that we can't simply rely on the bug
path to gather control dependencies.
In previous patches, LLVM's IDFCalculator, which works on a control flow
graph rather than the ExplodedGraph was generalized to solve this issue.
We use this information to heuristically guess that the value of a tracked
expression depends greatly on it's control dependencies, and start
tracking them as well.
After plenty of evaluations this was seen as great idea, but still
lacking refinements (we should have different descriptions about a
conditions value), hence it's off-by-default.
Differential Revision: https://reviews.llvm.org/D62883
llvm-svn: 365207
Eugene Leviant [Fri, 5 Jul 2019 13:26:05 +0000 (13:26 +0000)]
Reverted r365188 due to alignment problems on i686-android
llvm-svn: 365206
Johan Vikstrom [Fri, 5 Jul 2019 13:06:03 +0000 (13:06 +0000)]
[clangd] Added highlighting for variable references (declrefs)
Summary: Added highlighting for variable references using VisitDeclRefExpr.
Reviewers: hokein, sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64199
llvm-svn: 365205
Haojian Wu [Fri, 5 Jul 2019 12:57:56 +0000 (12:57 +0000)]
[clangd] Deduplicate clang-tidy diagnostic messages.
Summary:
Clang-tidy checks may emit duplicated messages (clang-tidy tool
deduplicate them in its custom diagnostic consumer), and we may show
multiple duplicated diagnostics in the UI, which is really bad.
This patch makes clangd do the deduplication, and revert the change
rL363889.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64127
llvm-svn: 365204
Graham Hunter [Fri, 5 Jul 2019 12:48:16 +0000 (12:48 +0000)]
Scalable Vector IR Type with further LTO fixes
Reintroduces the scalable vector IR type from D32530, after it was reverted
a couple of times due to increasing chromium LTO build times. This latest
incarnation removes the walk over aggregate types from the verifier entirely,
in favor of rejecting scalable vectors in the isValidElementType methods in
ArrayType and StructType. This removes the 70% degradation observed with
the second repro tarball from PR42210.
Reviewers: thakis, hans, rengolin, sdesmalen
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D64079
llvm-svn: 365203
Robert Lougher [Fri, 5 Jul 2019 12:42:06 +0000 (12:42 +0000)]
This reverts r365061 and r365062 (test update)
Revision r365061 changed a skip of debug instructions for a skip
of meta instructions. This is not safe, as IMPLICIT_DEF is classed
as a meta instruction.
llvm-svn: 365202
Sam Elliott [Fri, 5 Jul 2019 12:35:21 +0000 (12:35 +0000)]
[RISCV] Support @llvm.readcyclecounter() Intrinsic
On RISC-V, the `cycle` CSR holds a 64-bit count of the number of clock
cycles executed by the core, from an arbitrary point in the past. This
matches the intended semantics of `@llvm.readcyclecounter()`, which we
currently leave to the default lowering (to the constant 0).
With this patch, we will now correctly lower this intrinsic to the
intended semantics, using the user-space instruction `rdcycle`. On
64-bit targets, we can directly lower to this instruction.
On 32-bit targets, we need to do more, as `rdcycle` only returns the low
32-bits of the `cycle` CSR. In this case, we perform a custom lowering,
based on the PowerPC lowering, using `rdcycleh` to obtain the high
32-bits of the `cycle` CSR. This custom lowering inserts a new basic
block which detects overflow in the high 32-bits of the `cycle` CSR
during reading (because multiple instructions are required to read). The
emitted assembly matches the suggested assembly in the RISC-V
specification.
Differential Revision: https://reviews.llvm.org/D64125
llvm-svn: 365201
Nico Weber [Fri, 5 Jul 2019 12:31:32 +0000 (12:31 +0000)]
lld, llvm-dlltool, llvm-lib: Use getAsString() instead of getSpelling() for printing unknown args
Since OPT_UNKNOWN args never have any values and consist only of
spelling (and are never aliased), this doesn't make any difference in
practice, but it's more consistent with Arg's guidance to use
getAsString() for diagnostics, and it matches what clang does.
Also tweak two tests to use an unknown option that contains '=' for
additional coverage while here. (The new tests pass fine with the old
code too though.)
llvm-svn: 365200
Robert Lougher [Fri, 5 Jul 2019 12:30:45 +0000 (12:30 +0000)]
Revert r365198 as this accidentally commited something that
should not have been added.
llvm-svn: 365199
Robert Lougher [Fri, 5 Jul 2019 12:20:21 +0000 (12:20 +0000)]
This reverts r365061 and r365062 (test update)
Revision r365061 changed a skip of debug instructions for a skip
of meta instructions. This is not safe, as IMPLICIT_DEF is classed
as a meta instruction.
llvm-svn: 365198
Kristof Umann [Fri, 5 Jul 2019 12:17:44 +0000 (12:17 +0000)]
[analyzer][IDF] Add a control dependency calculator + a new debug checker
I intend to improve the analyzer's bug reports by tracking condition
expressions.
01 bool b = messyComputation();
02 int i = 0;
03 if (b) // control dependency of the bug site, let's explain why we assume val
04 // to be true
05 10 / i; // warn: division by zero
I'll detail this heuristic in the followup patch, strictly related to this one
however:
* Create the new ControlDependencyCalculator class that uses llvm::IDFCalculator
to (lazily) calculate control dependencies for Clang's CFG.
* A new debug checker debug.DumpControlDependencies is added for lit tests
* Add unittests
Differential Revision: https://reviews.llvm.org/D62619
llvm-svn: 365197
Sam Elliott [Fri, 5 Jul 2019 12:16:40 +0000 (12:16 +0000)]
[RISCV][NFC] Replace hard-coded CSR duplication with symbolic references
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: MaskRay, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64139
Patch by James Clarke (jrtc27)
llvm-svn: 365195
Simon Pilgrim [Fri, 5 Jul 2019 12:12:23 +0000 (12:12 +0000)]
Fix MSVC/cppcheck Use::Next isn't initialized warning. NFCI.
llvm-svn: 365194
Eugene Leviant [Fri, 5 Jul 2019 12:10:44 +0000 (12:10 +0000)]
[llvm-objcopy] Allow strip symtab from executables and DSOs
Differential revision: https://reviews.llvm.org/D61672
llvm-svn: 365193
Thomas Preud'homme [Fri, 5 Jul 2019 12:01:12 +0000 (12:01 +0000)]
[FileCheck] Fix comment in parseNumericVariableUse
Summary:
Comment explaining the interaction between parsing of numeric variable
definition and uses in parseNumericVariableUse is stale since it
suggests both use and definition parsing is done in the same function.
This was the case in a previous version of the patch committed as
71d3f227a790d6cf39d8c6267940e0dc0c237e11 but is no longer the case. This
patch updates the comment accordingly.
Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk
Subscribers: JonChesterfield, rogfer01, hfinkel, kristina, rnk, tra, arichardson, grimar, dblaikie, probinson, llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64227
llvm-svn: 365192
Thomas Preud'homme [Fri, 5 Jul 2019 12:01:06 +0000 (12:01 +0000)]
[FileCheck] Factor some parsing checks out
Summary:
Both callers of parseNumericVariableDefinition() perform the same extra
check that no character is found after the variable name. This patch
factors out this check into parseNumericVariableDefinition().
Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk
Subscribers: JonChesterfield, rogfer01, hfinkel, kristina, rnk, tra, arichardson, grimar, dblaikie, probinson, llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64226
llvm-svn: 365191
Thomas Preud'homme [Fri, 5 Jul 2019 12:00:56 +0000 (12:00 +0000)]
[FileCheck] Add missing final dot in comment
llvm-svn: 365190
Endre Fulop [Fri, 5 Jul 2019 12:00:52 +0000 (12:00 +0000)]
[NFC] Test commit access
llvm-svn: 365189
Eugene Leviant [Fri, 5 Jul 2019 12:00:10 +0000 (12:00 +0000)]
[ThinLTO] Attempt to recommit r365040 after caching fix
It's possible that some function can load and store the same
variable using the same constant expression:
store %Derived* @foo, %Derived** bitcast (%Base** @bar to %Derived**)
%42 = load %Derived*, %Derived** bitcast (%Base** @bar to %Derived**)
The bitcast expression was mistakenly cached while processing loads,
and never examined later when processing store. This caused @bar to
be mistakenly treated as read-only variable. See load-store-caching.ll.
llvm-svn: 365188
James Henderson [Fri, 5 Jul 2019 11:57:07 +0000 (11:57 +0000)]
[docs][llvm-objcopy] Improve some wording.
llvm-svn: 365187
Nico Weber [Fri, 5 Jul 2019 11:45:24 +0000 (11:45 +0000)]
Make joined instances of JoinedOrSeparate flags point to the unaliased args, like all other arg types do
This fixes an 8-year-old regression. r105763 made it so that aliases
always refer to the unaliased option – but it missed the "joined" branch
of JoinedOrSeparate flags. (r162231 then made the Args classes
non-virtual, and r169344 moved them from clang to llvm.)
Back then, there was no JoinedOrSeparate flag that was an alias, so it
wasn't observable. Now /U in CLCompatOptions is a JoinedOrSeparate alias
in clang, and warn_slash_u_filename incorrectly used the aliased arg id
(using the unaliased one isn't really a regression since that warning
checks if the undefined macro contains slash or backslash and only then
emits the warning – and no valid use will pass "-Ufoo/bar" or similar).
Also, lld has many JoinedOrSeparate aliases, and due to this bug it had
to explicitly call `getUnaliasedOption()` in a bunch of places, even
though that shouldn't be necessary by design. After this fix in Option,
these calls really don't have an effect any more, so remove them.
No intended behavior change.
(I accidentally fixed this bug while working on PR29106 but then
wondered why the warn_slash_u_filename broke. When I figured it out, I
thought it would make sense to land this in a separate commit.)
Differential Revision: https://reviews.llvm.org/D64156
llvm-svn: 365186
Nico Weber [Fri, 5 Jul 2019 11:34:48 +0000 (11:34 +0000)]
gn build: Merge r365179
llvm-svn: 365185
George Rimar [Fri, 5 Jul 2019 11:29:04 +0000 (11:29 +0000)]
[LLD][ELF] - Update a test after LLVM change.
Error reporting changed in r365183
llvm-svn: 365184
George Rimar [Fri, 5 Jul 2019 11:28:49 +0000 (11:28 +0000)]
[Object/ELF.h] - Improve error reporting.
The errors coming from ELF.h are usually not very
useful because they are uninformative. This patch is a
first step to improve the situation.
I tested this patch with a run of check-llvm and found
that few messages are untested. In this patch, I did not
add more tests but marked all such cases with a "TODO" comment.
For all tested messages I extended the error text to
provide more details (see test cases changed).
Differential revision: https://reviews.llvm.org/D64014
llvm-svn: 365183
Nico Weber [Fri, 5 Jul 2019 11:28:31 +0000 (11:28 +0000)]
lld-link: Make /debugtype: option work better
- The code tried to pass false to split()'s KeepEmpty parameter, but
instead passed it to MaxSplit. As a result, it would never split on
commas. This has been broken since the flag was added in r278056.
- The code used getSpelling() for getting the argument's values, but
getSpelling() always returns the `/debugtype:` prefix without any
values. So if any /debugtype: flag was passed, it always resulted in
an "unknown option:" warning. (The warning code then used the correct
getValue() for printing the invalid option, so the warning looked
kind of like it made sense.) This regressed in r342894.
Slightly improve the test coverage of this feature (but since I don't
know what this flag actually does, there's still no test for the correct
semantics), and add a comment to getSpelling() explaining what it does.
llvm-svn: 365182
Kristof Umann [Fri, 5 Jul 2019 11:14:57 +0000 (11:14 +0000)]
Fix a buildbot failure due to the AST's lifetime ending before the test
llvm-svn: 365181
Simon Pilgrim [Fri, 5 Jul 2019 10:34:53 +0000 (10:34 +0000)]
[X86][SSE] LowerINSERT_VECTOR_ELT - early out for out of range indices
Fixes OSS-Fuzz #15662
llvm-svn: 365180
Kristof Umann [Fri, 5 Jul 2019 10:16:36 +0000 (10:16 +0000)]
[analyzer][Dominators][NFC] Add unit tests
Differential Revision: https://reviews.llvm.org/D62611
llvm-svn: 365179
David Green [Fri, 5 Jul 2019 10:02:43 +0000 (10:02 +0000)]
[ARM] MVE VMOV immediate handling
This adds some handling for VMOVimm, using the same method that NEON uses. We
create VMOVIMM/VMVNIMM/VMOVFPIMM nodes based on the immediate, and select them
using the now renamed ARMvmovImm/etc. There is also an extra 64bit immediate
mode that I have not yet added here.
Code by David Sherwood
Differential Revision: https://reviews.llvm.org/D63884
llvm-svn: 365178
Kristof Umann [Fri, 5 Jul 2019 09:52:00 +0000 (09:52 +0000)]
[CFG] Add a new function to get the proper condition of a CFGBlock
getTerminatorCondition() returned a condition that may be outside of the
block, while the new function returns the proper one:
if (A && B && C) {}
Return C instead of A && B && C.
Differential Revision: https://reviews.llvm.org/D63538
llvm-svn: 365177
David Green [Fri, 5 Jul 2019 09:34:30 +0000 (09:34 +0000)]
[ARM] MVE fp to int conversions
This adds the patterns needed for fptosi and sitofp.
Differential Revision: https://reviews.llvm.org/D63729
llvm-svn: 365176
Fangrui Song [Fri, 5 Jul 2019 08:25:14 +0000 (08:25 +0000)]
[RISCV] Delete a ctor that is commented out. NFC
llvm-svn: 365175
Mikael Holmen [Fri, 5 Jul 2019 06:12:24 +0000 (06:12 +0000)]
Silence gcc warning "control reaches end of non-void function" [NFCI]
Without this fix gcc (7.4) complains with
/data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp: In member function 'std::__cxx11::string {anonymous}::CGObjCCommonMac::GetSectionName(llvm::StringRef, llvm::StringRef)':
/data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp:4944:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
All values in the ObjectFormatType enum are currently handled in the switch
but gcc complains anyway.
llvm-svn: 365174
Seiya Nuta [Fri, 5 Jul 2019 05:28:38 +0000 (05:28 +0000)]
[llvm-objcopy][NFC] Refactor output target parsing v2
Summary:
Use an enum instead of string to hold the output file format in Config.InputFormat and Config.OutputFormat. It's essential to support other output file formats other than ELF.
This patch originally has been submitted as D63239. However, there was an use-of-uninitialized-value bug and reverted in r364379 (git commit 4ee933c).
This patch includes the fix for the bug by setting Config.InputFormat/Config.OutputFormat in parseStripOptions.
Reviewers: espindola, alexshap, rupprecht, jhenderson
Reviewed By: jhenderson
Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64170
llvm-svn: 365173
Fangrui Song [Fri, 5 Jul 2019 05:10:28 +0000 (05:10 +0000)]
[llvm-objcopy][test] Fix respect-umask.test after D62718/r365162
llvm-svn: 365172
Fangrui Song [Fri, 5 Jul 2019 01:45:12 +0000 (01:45 +0000)]
[WebAssembly] Delete static_assert(sizeof(SymbolUnion) <= 96) to fix Windows builds
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/47944/steps/stage%201%20build/logs/stdio
Needs to figure out later the size on Windows.
llvm-svn: 365171
Alex Brachet [Fri, 5 Jul 2019 01:28:41 +0000 (01:28 +0000)]
Fix patch not passing test cases
llvm-svn: 365170
Fangrui Song [Fri, 5 Jul 2019 01:27:39 +0000 (01:27 +0000)]
[WebAssembly] Reorder Symbol fields to make it smaller
On 64-bit systems, this decreases sizeof(SymbolUnion) from 112 to 96.
Add a static_assert to avoid accidental increases in future.
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D64208
llvm-svn: 365169
Alex Brachet [Fri, 5 Jul 2019 01:13:09 +0000 (01:13 +0000)]
Temporarily stop failing test case
llvm-svn: 365168
Peter Collingbourne [Fri, 5 Jul 2019 01:11:20 +0000 (01:11 +0000)]
gn build: Merge r365130.
llvm-svn: 365167
Peter Collingbourne [Fri, 5 Jul 2019 01:11:18 +0000 (01:11 +0000)]
gn build: Merge r365103.
llvm-svn: 365166
Peter Collingbourne [Fri, 5 Jul 2019 01:11:16 +0000 (01:11 +0000)]
gn build: Merge r365007.
llvm-svn: 365165
Peter Collingbourne [Fri, 5 Jul 2019 01:11:14 +0000 (01:11 +0000)]
gn build: Merge r365091.
llvm-svn: 365164
Craig Topper [Thu, 4 Jul 2019 22:53:57 +0000 (22:53 +0000)]
[X86] Add custom isel to select ADD/SUB/OR/XOR/AND to their non-immediate forms under optsize when the immediate has additional users.
Summary:
We attempt to prevent folding immediates with multiple users under optsize. But we only do this from store nodes and X86ISD::ADD/SUB/XOR/OR/AND patterns. We don't do it for ISD::ADD/SUB/XOR/OR/AND even though we count them as users when deciding whether to fold into other nodes. This leads to situations where we block folding to a compare for example, but still fold into an AND or OR as seen in PR27202.
Unfortunately touching the isel patterns in tablegen for the ISD::ADD/SUB/XOR/OR/AND opcodes will cause the patterns to be unusable for fast isel. And we don't have a way to make a fast isel only pattern.
To workaround this, this patch adds custom isel in front of the isel table that will select the non-immediate forms if the immediate has additional users. This may create some issues for ANDN and NOT matching. And there's room for improvement with unsigned 32 immediates on 64-bit AND.
This patch needs more thorough test cases, but I wanted to get feedback on the direction. Please send me any other test cases you've seen in the wild.
I think we probably have the same issue with the immediate matching when we fold RMW from X86ISD::ADD/SUB/XOR/OR/AND. And our TEST immedaite shrinking logic. Our cost modeling for immediates that can fit in a sign extended 8-bit immediate on a 16/32/64 bit operation is completely wrong.
I also wonder if we should update the ConstantHoisting cost model and block folding for "opaque" constants. But of course constants can still be created by DAG combine and lowering optimizations.
Fixes PR27202
Reviewers: spatel, RKSimon, andreadb
Reviewed By: RKSimon
Subscribers: jsji, hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59909
llvm-svn: 365163
Alex Brachet [Thu, 4 Jul 2019 22:45:27 +0000 (22:45 +0000)]
[llvm-objcopy] Change handling of output file permissions
Summary: Address bug [[ https://bugs.llvm.org/show_bug.cgi?id=42082 | 42082 ]] where files were always outputted with 0775 permissions. Now, the output file is given either 0666 or 0777 if the object is executable.
Reviewers: espindola, alexshap, rupprecht, jhenderson, jakehehrlich, MaskRay
Reviewed By: rupprecht, jhenderson, jakehehrlich, MaskRay
Subscribers: emaste, arichardson, jakehehrlich, MaskRay, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62718
llvm-svn: 365162
Simon Atanasyan [Thu, 4 Jul 2019 22:45:07 +0000 (22:45 +0000)]
[mips] Refactor expandSeq and expandSeqI methods. NFC
llvm-svn: 365161
Hubert Tong [Thu, 4 Jul 2019 21:40:28 +0000 (21:40 +0000)]
[NFC] Make some ObjectFormatType switches covering
Summary:
This patch removes the `default` case from some switches on
`llvm::Triple::ObjectFormatType`, and cases for the missing enumerators
are then added.
For `UnknownObjectFormat`, the action (`llvm_unreachable`) for the
`default` case is kept.
For the other unhandled cases, `report_fatal_error` is used instead.
Reviewers: sfertile, jasonliu, daltenty
Reviewed By: sfertile
Subscribers: wuzish, aheejin, jsji, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D63767
llvm-svn: 365160
Alex Brachet [Thu, 4 Jul 2019 21:19:05 +0000 (21:19 +0000)]
[docs] [tools] Fix see also links
Summary: Changes "see also" links to use :manpage: instead of plain text or the form `name|name` which was being treated literally, not as a link.
Reviewers: jhenderson, rupprecht
Reviewed By: jhenderson
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63970
llvm-svn: 365159
Louis Dionne [Thu, 4 Jul 2019 20:00:39 +0000 (20:00 +0000)]
[pstl] Use utilities from <functional> instead of reinventing the wheel
llvm-svn: 365158
Raphael Isemann [Thu, 4 Jul 2019 19:49:31 +0000 (19:49 +0000)]
Add assert for 'bad' code path in GetUniqueNamespaceDeclaration
Summary:
If we call this function with a non-namespace as a second argument (and a nullptr name), we currently
only get a nullptr as a return when we hit the "Bad!!!" code path. This patch just adds an assert as this
seems to be a programming error in the calling code.
Reviewers: shafik
Subscribers: abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D57880
llvm-svn: 365157
Louis Dionne [Thu, 4 Jul 2019 19:39:29 +0000 (19:39 +0000)]
[NFC][pstl] Do not name each header file in the leading comment
With the renaming that will happen, it's just a pain to maintain the
right names.
llvm-svn: 365156
Saleem Abdulrasool [Thu, 4 Jul 2019 19:26:49 +0000 (19:26 +0000)]
Plugins: permit building on Windows ARM64
Rather than relying on `sizeof(void *)` to determine the architecture,
use the `CMAKE_SYSTEM_PROCESSOR` variable. This should allow us to
build for Windows and cross-compile. Without this, we would attempt to
build the x64 plugin on ARM64 which would fail due to the `CONTEXT` type
being defined for ARM64 rather than `x64`.
llvm-svn: 365155
Saleem Abdulrasool [Thu, 4 Jul 2019 19:08:16 +0000 (19:08 +0000)]
docs: add documentation for `LIBCXX_INCLUDE_TESTS`
Add some missing documentation for the `LIBCXX_INCLUDE_TESTS` option.
Patch by Jean Heyd Meneide!
llvm-svn: 365154
Vassil Vassilev [Thu, 4 Jul 2019 19:06:52 +0000 (19:06 +0000)]
[modules] Add PP callbacks for entering and leaving a submodule.
llvm-svn: 365153
Louis Dionne [Thu, 4 Jul 2019 19:04:28 +0000 (19:04 +0000)]
[NFC][pstl] Run clang-format
llvm-svn: 365152
Sam McCall [Thu, 4 Jul 2019 18:49:08 +0000 (18:49 +0000)]
[clangd] Mark a couple of unimportant flags as hidden. NFC
llvm-svn: 365151
Louis Dionne [Thu, 4 Jul 2019 18:19:20 +0000 (18:19 +0000)]
[pstl] Make sure we include the pstl_config header in the glue headers
llvm-svn: 365150
Craig Topper [Thu, 4 Jul 2019 18:18:46 +0000 (18:18 +0000)]
[DAGCombiner] Don't combine (addcarry (uaddo X, Y), 0, Carry) -> (addcarry X, Y, Carry) if the Carry comes from the uaddo.
Summary:
The uaddo won't be removed and the addcarry will still be
dependent on the uaddo. So we'll just increase the use count
of X and Y and potentially require a COPY.
Reviewers: spatel, RKSimon, deadalnix
Reviewed By: RKSimon
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64190
llvm-svn: 365149
Tim Renouf [Thu, 4 Jul 2019 17:38:24 +0000 (17:38 +0000)]
[AMDGPU] Custom lower INSERT_SUBVECTOR v3, v4, v5, v8
Summary:
Since the changes to introduce vec3 and vec5, INSERT_VECTOR for these
sizes has been marked "expand", which made LegalizeDAG lower it to loads
and stores via a stack slot. The code got optimized a bit later, but the
now-unused stack slot was never deleted.
This commit avoids that problem by custom lowering INSERT_SUBVECTOR into
an EXTRACT_VECTOR_ELT and INSERT_VECTOR_ELT for each element in the
subvector to insert.
V2: Addressed review comments re test.
Differential Revision: https://reviews.llvm.org/D63160
Change-Id: I9e3c13e36f68cfa3431bb9814851cc1f673274e1
llvm-svn: 365148
Sanjay Patel [Thu, 4 Jul 2019 16:45:34 +0000 (16:45 +0000)]
[InstCombine] allow undef elements when forming splat from chain of insertelements
We allow forming a splat (broadcast) shuffle, but we were conservatively limiting
that to cases where all elements of the vector are specified. It should be safe
from a codegen perspective to allow undefined lanes of the vector because the
expansion of a splat shuffle would become the chain of inserts again.
Forming splat shuffles can reduce IR and help enable further IR transforms.
Motivating bugs:
https://bugs.llvm.org/show_bug.cgi?id=42174
https://bugs.llvm.org/show_bug.cgi?id=16739
Differential Revision: https://reviews.llvm.org/D63848
llvm-svn: 365147
Jay Foad [Thu, 4 Jul 2019 15:04:29 +0000 (15:04 +0000)]
Fix typos in comments and debug output.
llvm-svn: 365146
Simon Pilgrim [Thu, 4 Jul 2019 15:00:04 +0000 (15:00 +0000)]
[X86][SSE] Add partial dereferenceable vector load test inspired by PR21780
llvm-svn: 365145
Andus Yu [Thu, 4 Jul 2019 14:36:34 +0000 (14:36 +0000)]
llvm-c-test avoid calling malloc(0)
Summary:
As explained in D63668, malloc(0) could return a null pointer. llvm-c-test does not handle this case correctly. Instead of calling malloc(0), avoid the operation altogether.
Authored By: andusy
Reviewers: hubert.reinterpretcast, xingxue, jasonliu, daltenty, cebowleratibm
Reviewed By: hubert.reinterpretcast
Subscribers: mehdi_amini, dexonsmith, jsji, llvm-commits
Tags: LLVM
Differential Revision: https://reviews.llvm.org/D63788
llvm-svn: 365144
George Rimar [Thu, 4 Jul 2019 14:17:31 +0000 (14:17 +0000)]
[LLD][ELF] - Linkerscript: add a support for expressions for section's filling
Imagine the script:
.section: {
...
} = FILL_EXPR
LLD assumes that FILL_EXPR is a number, and does not allow
it to be an expression. Though that is allowed by specification:
https://sourceware.org/binutils/docs-2.32/ld/Output-Section-Fill.html
This patch adds a support for cases when FILL_EXPR is simple math expression.
Fixes https://bugs.llvm.org/show_bug.cgi?id=42482.
Differential revision: https://reviews.llvm.org/D64130
llvm-svn: 365143
Serge Guelton [Thu, 4 Jul 2019 14:03:11 +0000 (14:03 +0000)]
Document legacy pass manager extension points
Differential Revision: https://reviews.llvm.org/D64093
llvm-svn: 365142
David Bolvansky [Thu, 4 Jul 2019 13:48:32 +0000 (13:48 +0000)]
[NFC] Added tests for D64099
llvm-svn: 365141
Kadir Cetinkaya [Thu, 4 Jul 2019 13:47:51 +0000 (13:47 +0000)]
[clangd] Fix breakage on gcc 5.4
llvm-svn: 365140
Fangrui Song [Thu, 4 Jul 2019 13:33:27 +0000 (13:33 +0000)]
[ELF] Allow placing non-string SHF_MERGE sections with different alignments into the same MergeSyntheticSection
The difference from D63432/r365015 is that this patch does not place
SHF_STRINGS sections with different alignments into the same
MergeSyntheticSection. Doing that would:
(1) create unnecessary padding and thus waste space.
Add a test tail-merge-string-align2.s to check no extra padding is created.
(2) make some input sections unaligned when tail merge (-O2) is enabled.
The alignment of MergeTailAlignment::Builder was out of sync in D63432.
MOVAPS on such unaligned strings can raise SIGSEGV.
This should fix PR42289: the Linux kernel has a use case that input
files have .rodata.cst32 sections with different alignments. The
expectation (and what ld.bfd and gold do) is that in the -r link, there
is only one .rodata.cst32 (SHF_MERGE sections with different alignments
can be combined), but lld currently creates one for each different
alignment.
The current merging strategy:
1) Group SHF_MERGE sections by (name, sh_flags, sh_entsize and
sh_addralign). Merging is performed among a group, even if -O0 is specified.
2) Create one output section for each group. This is a special case in
addInputSec().
This patch changes 1) to:
1) Group SHF_MERGE sections by (name, sh_flags, sh_entsize).
Merging is performed among a group, even if -O0 is specified.
We will thus create just one .rodata.cst32 . This also improves merging
efficiency when sections with the same name but different alignments are
combined.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D64200
llvm-svn: 365139
Simon Pilgrim [Thu, 4 Jul 2019 13:31:49 +0000 (13:31 +0000)]
[X86][SSE] Add some partial dereferenceable vector load tests inspired by PR16739
llvm-svn: 365138
Michael Liao [Thu, 4 Jul 2019 13:29:45 +0000 (13:29 +0000)]
[AMDGPU] Correct the setting of `FlatScratchInit`.
Summary: - That flag setting should skip spilling stack slot.
Reviewers: arsenm, rampitec
Subscribers: qcolombet, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64143
llvm-svn: 365137
Simon Pilgrim [Thu, 4 Jul 2019 12:33:37 +0000 (12:33 +0000)]
[X86] Regenerate load fold peephole test.
llvm-svn: 365136
Haojian Wu [Thu, 4 Jul 2019 12:27:21 +0000 (12:27 +0000)]
[clangd] Some tweaks on semantic highlighting lookuptable.
Summary:
- move toTextMateScope to SemanticHighlighting.h;
- move the buildLookupTable to LSP layer (as LSP requires such form);
Reviewers: sammccall, jvikstrom
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64202
llvm-svn: 365135
Kadir Cetinkaya [Thu, 4 Jul 2019 12:24:17 +0000 (12:24 +0000)]
[clangd] Fix a lifetime bug in QueryDriver
llvm-svn: 365134
Gabor Marton [Thu, 4 Jul 2019 11:39:00 +0000 (11:39 +0000)]
[CTU] Add support for virtual functions
Reviewers: Szelethus, xazax.hun
Subscribers: rnkovacs, dkrupp, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63920
llvm-svn: 365133
Kadir Cetinkaya [Thu, 4 Jul 2019 11:34:23 +0000 (11:34 +0000)]
[clangd] Query driver reads stderr and passes driver as first argument
Summary:
gcc invokes cc1 through a path deduced from argv[0] therefore it must
be correctly set.
Also it prints the search path to stderr not stdout, this also applies to clang.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64196
llvm-svn: 365132
Fangrui Song [Thu, 4 Jul 2019 11:10:45 +0000 (11:10 +0000)]
[ELF] Fix weak-undef-shared.s after r365129
llvm-svn: 365131
Haojian Wu [Thu, 4 Jul 2019 10:49:32 +0000 (10:49 +0000)]
[clangd] Add a hidden tweak to annotate all highlighting tokens of the file.
Reviewers: sammccall, jvikstrom
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64137
llvm-svn: 365130
Fangrui Song [Thu, 4 Jul 2019 10:38:04 +0000 (10:38 +0000)]
[ELF] resolveUndefined: ignore undefined symbols in SharedFile for Undefined and SharedSymbol
If %t1.o has a weak reference on foo, and %t2.so has a non-weak
reference on foo: `ld.lld %t1.o %t2.so -o %t`
We incorrectly set the binding of the undefined foo to STB_GLOBAL.
Fix this by ignoring undefined symbols in a SharedFile for Undefined and
SharedSymbol.
This fixes the binding of pthread_once when the program links against
both librt.so and libpthread.so
```
a.o: STB_WEAK reference to pthread_once
librt.so: STB_GLOBAL reference to pthread_once # should be ignored
libstdc++.so: STB_WEAK reference to pthread_once # should be ignored
libgcc_s.so.1: STB_WEAK reference to pthread_once # should be ignored
```
The STB_GLOBAL pthread_once issue (not fixed by D63974) can cause a link error when the result
DSO is used to link another DSO with -z defs if -lpthread is not specified. (libstdc++.so.6 not having a dependency on libpthread.so is a really nasty hack...)
We happened to create a weak undef before D63974 because libgcc_s.so.1
was linked the last and it changed the binding again to weak.
Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D64136
llvm-svn: 365129
Simon Pilgrim [Thu, 4 Jul 2019 10:35:31 +0000 (10:35 +0000)]
Fix -Wdocumentation param warning.
Don't put the full stop at the end of a param name - it confuses the doxygen parser
llvm-svn: 365128
Simon Pilgrim [Thu, 4 Jul 2019 10:33:21 +0000 (10:33 +0000)]
Fix -Wdocumentation warning.
llvm-svn: 365127
Simon Pilgrim [Thu, 4 Jul 2019 10:28:31 +0000 (10:28 +0000)]
Fix -Wdocumentation warning.
llvm-svn: 365126
Simon Pilgrim [Thu, 4 Jul 2019 10:17:10 +0000 (10:17 +0000)]
[X86][AVX1] Combine concat_vectors(pshufd(x,c),pshufd(y,c)) -> vpermilps(concat_vectors(x,y),c)
Bitcast v4i32 to v8f32 and back again - it might be worth adding isel patterns for X86PShufd v8i32 on AVX1 targets like we did for X86Blendi to avoid the bitcasts?
llvm-svn: 365125
Kadir Cetinkaya [Thu, 4 Jul 2019 09:56:24 +0000 (09:56 +0000)]
[clangd] Turn background-index on by default
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64019
llvm-svn: 365124
Kadir Cetinkaya [Thu, 4 Jul 2019 09:52:12 +0000 (09:52 +0000)]
[clangd] Make HadErrors part of background index's internal state
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64147
llvm-svn: 365123
Kadir Cetinkaya [Thu, 4 Jul 2019 09:52:04 +0000 (09:52 +0000)]
[clangd] Add HadErrors field into shards
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64133
llvm-svn: 365122
Kadir Cetinkaya [Thu, 4 Jul 2019 09:51:53 +0000 (09:51 +0000)]
[clangd] Store hash of command line in index shards.
Summary: This is to enable cache invalidation when command line flags changes.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64018
llvm-svn: 365121