Sam Clegg [Thu, 26 Apr 2018 16:41:51 +0000 (16:41 +0000)]
[WebAssembly] Implement getRelocationValueString()
And use it in llvm-objdump.
Differential Revision: https://reviews.llvm.org/D46092
llvm-svn: 330957
Simon Dardis [Thu, 26 Apr 2018 16:22:47 +0000 (16:22 +0000)]
[mips] Fix a test case which is keeping the expensive checks bot win red (NFC)
llvm-svn: 330956
Marshall Clow [Thu, 26 Apr 2018 16:16:45 +0000 (16:16 +0000)]
Move old test into test/libcxx, and implement new version of test for ostreambuf_iterator::failed. Fixes PR#37245. Thanks to Billy O'Neill for the bug report.
llvm-svn: 330955
Mark Searles [Thu, 26 Apr 2018 16:11:19 +0000 (16:11 +0000)]
[AMDGPU][Waitcnt] As of gfx7, VMEM operations do not increment the export counter and the input registers are available in the next instruction; update the waitcnt pass to take this into account.
Differential Revision: https://reviews.llvm.org/D46067
llvm-svn: 330954
Rafael Espindola [Thu, 26 Apr 2018 16:09:30 +0000 (16:09 +0000)]
Delete GotPltIndex.
It was always an offset of PltIndex.
This doesn't reduce the size of the structures, but makes it easier to
do so in a followup patch.
llvm-svn: 330953
Simon Dardis [Thu, 26 Apr 2018 16:06:34 +0000 (16:06 +0000)]
[mips] Correct the definitions of some control instructions
Correct the definitions of ei, di, eret, deret, wait, syscall and break.
Also provide microMIPS specific aliases to match the MIPS aliases.
Additionally correct the definition of the wait instruction so that
it is present in the instruction mapping tables.
Reviewers: smaksimovic, abeserminji, atanasyan
Differential Revision: https://reviews.llvm.org/D45939
llvm-svn: 330952
Sanjay Patel [Thu, 26 Apr 2018 16:04:44 +0000 (16:04 +0000)]
[DAGCombiner] limit ftrunc optimizations with function attribute
As noted, the attribute name is subject to change once we have
the clang side implemented, but it's clear that we need some
kind of attribute-based predication here based on the discussion
for:
rL330437
llvm-svn: 330951
Sanjay Patel [Thu, 26 Apr 2018 15:36:15 +0000 (15:36 +0000)]
[x86] add tests to show potential opt-out of ftrunc optimization; NFC
This is another preliminary step for disabling this transform as
discussed in the post-commit thread for:
rL330437
I'm using one of the names suggested there for the attribute, but
we can fix that up as needed once the clang side of this is sorted
out.
llvm-svn: 330950
Alex Bradbury [Thu, 26 Apr 2018 15:34:27 +0000 (15:34 +0000)]
[RISCV] Implement isLoadFromStackSlot and isStoreToStackSlot
This causes some slight shuffling but no meaningful codegen differences on the
corpus I used for testing, but it has a larger impact when combined with e.g.
rematerialisation. Regardless, it makes sense to report as accurate
target-specific information as possible.
llvm-svn: 330949
Benjamin Kramer [Thu, 26 Apr 2018 15:26:29 +0000 (15:26 +0000)]
[NVPTX] Make the legalizer expand shufflevector of <2 x half>
There's no direct instruction for this, but it's trivially implemented
with two movs. Without this the code generator just dies when
encountering a shufflevector.
Differential Revision: https://reviews.llvm.org/D46116
llvm-svn: 330948
Sanjay Patel [Thu, 26 Apr 2018 15:20:18 +0000 (15:20 +0000)]
[DAGCombiner] refactor FP->int->FP folds; NFC
As discussed in the post-review comments for rL330437,
we need to guard this fold to allow existing code to
keep working with the undefined behavior that they've
come to rely on.
That would mean duplicating more code than we already
have, so let's fix that first.
llvm-svn: 330947
Yuka Takahashi [Thu, 26 Apr 2018 15:09:13 +0000 (15:09 +0000)]
Add getDeserializationListener to ASTReader
Summary:
We need to know if ASTReader already has a DeserializationListner or
not, and this also helps to create a multiplexing deserialization
listener if there is one already attached.
Reviewers: v.g.vassilev, rsmith, dblaikie, thakis
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D45921
llvm-svn: 330946
Matthew Simpson [Thu, 26 Apr 2018 14:50:04 +0000 (14:50 +0000)]
[SLP] Add tests for transposable binary operations
These test cases are vectorizable, but we are currently unable to vectorize
them effectively.
llvm-svn: 330945
Guansong Zhang [Thu, 26 Apr 2018 14:06:53 +0000 (14:06 +0000)]
[OpenMP] Remove compilation warning when using clang to compile bc files.
Summary: Minor printf format correction. NVCC ignore those. Clang will give warning on these if debug is enabled.
Reviewers: grokos
Reviewed By: grokos
Subscribers: openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D45528
llvm-svn: 330944
Alex Bradbury [Thu, 26 Apr 2018 14:04:18 +0000 (14:04 +0000)]
[RISCV] Implement isZextFree
This returns true for 8-bit and 16-bit loads, allowing LBU/LHU to be selected
and avoiding unnecessary masks.
llvm-svn: 330943
Alex Bradbury [Thu, 26 Apr 2018 14:00:35 +0000 (14:00 +0000)]
[RISCV] Add test case showing suboptimal codegen when loading unsigned char/short
Implementing isZextFree will allow lbu or lhu to be selected rather than
lb+mask and lh+mask.
llvm-svn: 330942
Matthew Simpson [Thu, 26 Apr 2018 13:48:33 +0000 (13:48 +0000)]
[TTI, AArch64] Add transpose shuffle kind
This patch adds a new shuffle kind useful for transposing a 2xn matrix. These
transpose shuffle masks read corresponding even- or odd-numbered vector
elements from two n-dimensional source vectors and write each result into
consecutive elements of an n-dimensional destination vector. The transpose
shuffle kind is meant to model the TRN1 and TRN2 AArch64 instructions. As such,
this patch also considers transpose shuffles in the AArch64 implementation of
getShuffleCost.
Differential Revision: https://reviews.llvm.org/D45982
llvm-svn: 330941
Alex Bradbury [Thu, 26 Apr 2018 13:37:00 +0000 (13:37 +0000)]
[RISCV] Implement isTruncateFree
Adapted from ARM's implementation introduced in r313533 and r314280.
llvm-svn: 330940
Lama Saba [Thu, 26 Apr 2018 13:16:11 +0000 (13:16 +0000)]
[X86] Fix Update Kill Register in Avoid SFB Pass - Bug 37153
Differential Revision: https://reviews.llvm.org/D45823
Change-Id: Icf6f34f6babc3cb2ff5292fde003472473037a71
llvm-svn: 330939
Alex Bradbury [Thu, 26 Apr 2018 13:15:17 +0000 (13:15 +0000)]
[RISCV] Implement isLegalICmpImmediate
I'm unable to construct a representative test case that demonstrates the
advantage, but it seems sensible to report accurate target-specific
information regardless.
llvm-svn: 330938
Alex Bradbury [Thu, 26 Apr 2018 13:00:37 +0000 (13:00 +0000)]
[RISCV] Implement isLegalAddImmediate
This causes a trivial improvement in the recently added lsr-legaladdimm.ll
test case.
llvm-svn: 330937
Alex Bradbury [Thu, 26 Apr 2018 12:57:29 +0000 (12:57 +0000)]
[RISCV] Add test/CodeGen/RISCV/lsr-legaladdimm.ll
Add a test case which will show a codegen difference upon the implementation
of a target-specific isLegalAddImmediate.
llvm-svn: 330936
Andrea Di Biagio [Thu, 26 Apr 2018 12:56:26 +0000 (12:56 +0000)]
[Tablegen] Simplify code in CodeGenSchedule. NFCI
llvm-svn: 330935
Sander de Smalen [Thu, 26 Apr 2018 12:54:42 +0000 (12:54 +0000)]
[AArch64][SVE] Enable DiagnosticPredicates for SVE LD1 instructions.
This patch extends the PredicateMethod of AsmOperands used in SVE's
LD1 instructions with a DiagnosticPredicate. This makes them 'context
sensitive' to the operand that has been parsed and tells the user to
use the right register (with expected shift/extend), rather than telling
the immediate is out of range when it actually parsed a register.
Patch [2/2] in a series to improve assembler diagnostics for SVE:
- Patch [1/2]: https://reviews.llvm.org/D45879
- Patch [2/2]: https://reviews.llvm.org/D45880
Reviewers: olista01, stoklund, craig.topper, mcrosier, rengolin, echristo, fhahn, SjoerdMeijer, evandro, javed.absar
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D45880
llvm-svn: 330934
Benjamin Kramer [Thu, 26 Apr 2018 12:30:16 +0000 (12:30 +0000)]
[NVPTX] Deduplicate code. No functionality change.
llvm-svn: 330933
Alex Bradbury [Thu, 26 Apr 2018 12:13:48 +0000 (12:13 +0000)]
[RISCV] Implement isLegalAddressingMode for RISC-V
This has no impact on codegen for the current RISC-V unit tests or my small
benchmark set and very minor changes in a few programs in the GCC torture
suite. Based on this, I haven't been able to produce a representative test
program that demonstrates a benefit from isLegalAddressingMode. I'm committing
the patch anyway, on the basis that presenting accurate information to the
target-independent code is preferable to relying on incorrect generic
assumptions.
llvm-svn: 330932
Florian Hahn [Thu, 26 Apr 2018 10:26:17 +0000 (10:26 +0000)]
[LoopInterchange] Ignore debug intrinsics during legality checks.
Reviewers: aprantl, mcrosier, karthikthecool
Reviewed By: aprantl
Subscribers: mattd, vsk, #debug-info, llvm-commits
Differential Revision: https://reviews.llvm.org/D45379
llvm-svn: 330931
Sander de Smalen [Thu, 26 Apr 2018 09:24:45 +0000 (09:24 +0000)]
[AsmMatcher] Extend PredicateMethod with optional DiagnosticPredicate
An optional, light-weight and backward-compatible mechanism to allow
specifying that a diagnostic _only_ applies to a partial mismatch (NearMiss),
rather than a full mismatch.
Patch [1/2] in a series to improve assembler diagnostics for SVE.
- Patch [1/2]: https://reviews.llvm.org/D45879
- Patch [2/2]: https://reviews.llvm.org/D45880
Reviewers: olista01, stoklund, craig.topper, mcrosier, rengolin, echristo, fhahn, SjoerdMeijer, evandro, javed.absar
Reviewed By: olista01
Differential Revision: https://reviews.llvm.org/D45879
llvm-svn: 330930
Sander de Smalen [Thu, 26 Apr 2018 08:43:22 +0000 (08:43 +0000)]
[AArch64][SVE] Asm: Negative tests for all LD1 gather (scalar+vector) load instructions.
Patch [3/3] in series to add support for SVE's gather load instructions
that use scalar+vector addressing modes:
- Patch [1/3]: https://reviews.llvm.org/D45951
- Patch [2/3]: https://reviews.llvm.org/D46023
- Patch [3/3]: https://reviews.llvm.org/D45958
Reviewers: fhahn, rengolin, samparker, SjoerdMeijer, t.p.northover, echristo, evandro, javed.absar
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D45958
llvm-svn: 330929
Sander de Smalen [Thu, 26 Apr 2018 08:19:53 +0000 (08:19 +0000)]
[AArch64][SVE] Asm: Support for gather LD1/LDFF1 (scalar + vector) load instructions.
Patch [2/3] in series to add support for SVE's gather load instructions
that use scalar+vector addressing modes:
- Patch [1/3]: https://reviews.llvm.org/D45951
- Patch [2/3]: https://reviews.llvm.org/D46023
- Patch [3/3]: https://reviews.llvm.org/D45958
Reviewers: fhahn, rengolin, samparker, SjoerdMeijer, t.p.northover, echristo, evandro, javed.absar
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D46023
llvm-svn: 330928
Serge Pavlov [Thu, 26 Apr 2018 08:08:25 +0000 (08:08 +0000)]
Make test more platform neutral
llvm-svn: 330927
Serge Pavlov [Thu, 26 Apr 2018 06:28:47 +0000 (06:28 +0000)]
[ConfigFiles] Update argument strings when merging argrument lists
Implementation of `InputArgList` assumes its field `ArgStrings` contains
strings for each argument exactly in the same order. This condition was
broken when arguments from config file and from invocation were merged.
This change fixes https://bugs.llvm.org/show_bug.cgi?id=37196 (Clang
config files can crash argument handling).
llvm-svn: 330926
Rafael Espindola [Thu, 26 Apr 2018 06:10:18 +0000 (06:10 +0000)]
Add a test. NFC.
This would have fund a bug in a patch I am working on.
llvm-svn: 330925
Shoaib Meenai [Thu, 26 Apr 2018 06:04:46 +0000 (06:04 +0000)]
[cmake] Make linker detection take flags into account
LLVM might be compiled using a toolchain file which controls the linker
to use via flags (e.g. `-B` or `-fuse-ld=`). Take these flags into
account for linker detection. We can also correct the detection by
manually passing LLVM_USE_LINKER, of course, but it seems more
convenient to have the detection take flags into account.
Differential Revision: https://reviews.llvm.org/D45464
llvm-svn: 330924
Craig Topper [Thu, 26 Apr 2018 05:38:39 +0000 (05:38 +0000)]
[X86] Add support for _mm512_mullox_epi64 and _mm512_mask_mullox_epi64 intrinsics to match icc.
On AVX512F targets we'll produce an emulated sequence using 3 pmuludqs with shifts and adds. On AVX512DQ we'll use vpmulld.
Fixes PR37140.
llvm-svn: 330923
Craig Topper [Thu, 26 Apr 2018 05:07:40 +0000 (05:07 +0000)]
[X86] Print 'tbyte ptr' instead of 'xword ptr' for f80mem in Intel syntax.
This matches objdump.
llvm-svn: 330922
Craig Topper [Thu, 26 Apr 2018 03:53:39 +0000 (03:53 +0000)]
[X86] Remove alignment restriction on loading folding of pcmp[ei]str* during isel too.
This is a follow up to the changes in r330896 which enabled folding after isel during peephole and register allocation.
llvm-svn: 330897
Chandler Carruth [Thu, 26 Apr 2018 03:17:25 +0000 (03:17 +0000)]
[x86] Allow folding unaligned memory operands into pcmp[ei]str*
instructions.
These have special permission according to the x86 manual to read
unaligned memory, and this folding is done by ICC and GCC as well.
This corrects one of the issues identified in PR37246.
llvm-svn: 330896
Chandler Carruth [Thu, 26 Apr 2018 03:12:17 +0000 (03:12 +0000)]
[x86] NFC: Add tests for idiomatic usage patterns of SSE4.2 string
comparison instructions (pcmp[ei]stri*).
These will help show improvements from fixes to PR37246.
I've not really covered the mask forms of this intrinsic as I don't have
as good of an intuition about the likely usage patterns there. Happy for
someone to extend this with tests covering the mask form.
llvm-svn: 330895
Richard Smith [Thu, 26 Apr 2018 02:10:22 +0000 (02:10 +0000)]
Diagnose missing template arguments for a variable template even when there is
a preceding 'template' keyword.
We only diagnose in the dependent case (wherein we used to crash). Another bug
prevents the diagnostic from appearing in the non-template case.
llvm-svn: 330894
Max Kazantsev [Thu, 26 Apr 2018 02:07:40 +0000 (02:07 +0000)]
Revert "[SCEV] Make computeExitLimit more simple and more powerful"
This reverts commit
023c8be90980e0180766196cba86f81608b35d38.
This patch triggers miscompile of zlib on PowerPC platform. Most likely it is
caused by some pre-backend PPC-specific pass, but we don't clearly know the
reason yet. So we temporally revert this patch with intention to return it
once the problem is resolved. See bug 37229 for details.
llvm-svn: 330893
Rui Ueyama [Thu, 26 Apr 2018 01:38:29 +0000 (01:38 +0000)]
Simplify. NFC.
llvm-svn: 330892
Richard Smith [Thu, 26 Apr 2018 01:16:08 +0000 (01:16 +0000)]
Revert addition of 'concept' to diagnostics in r330890.
Matches revert in r330888 of r330794.
llvm-svn: 330891
Richard Smith [Thu, 26 Apr 2018 01:08:00 +0000 (01:08 +0000)]
Factor out common code for diagnosing missing template arguments.
In passing, add 'concept' to the list of template kinds in diagnostics.
llvm-svn: 330890
Faisal Vali [Thu, 26 Apr 2018 01:05:05 +0000 (01:05 +0000)]
Fix a merge conflict that was inadvertently introduced in r330888
- during the reversion of r330794
llvm-svn: 330889
Faisal Vali [Thu, 26 Apr 2018 00:42:40 +0000 (00:42 +0000)]
Revert rC330794 and some dependent tiny bug fixes
See Richard's humbling feedback here:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-
20180423/226482.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-
20180423/226486.html
Wish I'd had the patience to solicit the feedback prior to committing :)
Sorry for the noise guys.
Thank you Richard for being the steward that clang deserves!
llvm-svn: 330888
Richard Trieu [Wed, 25 Apr 2018 23:50:55 +0000 (23:50 +0000)]
Switch to Clang's isDigit function.
std::isdigit can be overloaded, causing the template deduction to fail. Use
Clang's isDigit function which to avoid this. Switch the other calls for
consistency.
llvm-svn: 330887
Reid Kleckner [Wed, 25 Apr 2018 23:38:54 +0000 (23:38 +0000)]
Include <cctype> to get std::isdigit, fixes MSVC STL build
llvm-svn: 330886
Volodymyr Sapsai [Wed, 25 Apr 2018 23:38:41 +0000 (23:38 +0000)]
[libcxx] func.wrap.func.con: Unset function before destroying anything
Be defensive against a reentrant std::function::operator=(nullptr_t), in case
the held function object has a non-trivial destructor. Destroying the function
object in-place can lead to the destructor being called twice.
Patch by Duncan P. N. Exon Smith. C++03 support by Volodymyr Sapsai.
rdar://problem/
32836603
Reviewers: EricWF, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits, arphaman
Differential Revision: https://reviews.llvm.org/D34331
llvm-svn: 330885
Reid Kleckner [Wed, 25 Apr 2018 23:34:15 +0000 (23:34 +0000)]
[codeview] Ignore .cv_loc directives at the end of a function
If no data or instructions are emitted after a location directive, we
should clear the cv_loc when we change sections, or it will be emitted
at the beginning of the next section. This violates our invariant that
all .cv_loc directives belong to the same section. Add clearer
assertions for this.
llvm-svn: 330884
Bob Haarman [Wed, 25 Apr 2018 23:33:19 +0000 (23:33 +0000)]
[COFF] more informative "broken object file" diagnostics
Summary:
When a symbol refers to a special section or a section that doesn't
exist, lld would fatal with "broken object file". This change gives a
different message for each scenario, and includes the name of the
file, name of the symbol, and the section being referred to.
Reviewers: pcc, ruiu
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46090
llvm-svn: 330883
Artem Dergachev [Wed, 25 Apr 2018 23:02:06 +0000 (23:02 +0000)]
[analyzer] Fix a crash on lifetime extension through aggregate initialization.
If 'A' is a C++ aggregate with a reference field of type 'C', in code like
A a = { C() };
C() is lifetime-extended by 'a'. The analyzer wasn't expecting this pattern and
crashing. Additionally, destructors aren't added in the CFG for this case,
so for now we shouldn't be inlining the constructor for C().
Differential Revision: https://reviews.llvm.org/D46037
llvm-svn: 330882
Richard Smith [Wed, 25 Apr 2018 22:58:55 +0000 (22:58 +0000)]
Fix crash on qualified template name instantiation if the template name has no
template argument list.
llvm-svn: 330881
Ana Pazos [Wed, 25 Apr 2018 22:42:38 +0000 (22:42 +0000)]
[RISCV] More validations on the input value of -march=
Supporting additional rules for parsing ISA string.
- RISC-V ISA strings must be lowercase.
E.g.: rv32IMC is not supported, rv32imc is correct.
- Multi-letter extensions are to be separated by a single
underscore '_'. The extension prefix counts as a letter.
This means extensions that start with 's', 'sx' and 'sx'
are all multi-letter.
E.g.:
xasb is a single non-standard extension named 'xasb'
xa_sb are two extensions, the non-standard user level extension
'xa', and the supervisor level extension 'sb'.
- Standard user-level extensions are specified following
a canonical order, according to Table 22.1 in
RISC-V User-Level ISA V2.2.
- Non-standard user-level 'x' extensions,
standard supervisor-level 's' extensions and
non-standard supervisor-level 'sx' extensions
are also specified following a canonical order according
to Table 22.1 in RISC-V User-Level ISA V2.2:
'x' extensions, follwed by 's' extensions and then 'sx' extensions.
- Extensions might have a version number.
Underscores may be used to separate ISA subset components to
improve readability and to provide disambiguation.
E.g.: rv32i2_m3_a1_f2_d2
- Version numbers are divided into major and minor numbers,
separated by a 'p'. If the minor version is 0, then 'p0' can
be omitted.
- Additional checks for dependent extensions and invalid
extensions combinations.
E.g.:
'e' requires rv32
'e' can't be combined with 'f' nor 'd'
'q' requires rv64
- TODO items have also been marked with comments in the code.
Reviewers: asb, kito-cheng
Reviewed By: asb
Subscribers: edward-jones, mgrang, zzheng, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, shiva0217, cfe-commits
Differential Revision: https://reviews.llvm.org/D45284
llvm-svn: 330880
Rui Ueyama [Wed, 25 Apr 2018 22:34:21 +0000 (22:34 +0000)]
Remove unused features from StringRefZ and move it to Symbols.h.
Differential Revision: https://reviews.llvm.org/D46087
llvm-svn: 330879
Alex Lorenz [Wed, 25 Apr 2018 22:23:26 +0000 (22:23 +0000)]
[driver][darwin] Do not infer -simulator environment for OS version env vars
with non-simulator SDKs
rdar://
37955008
llvm-svn: 330878
Frederic Riss [Wed, 25 Apr 2018 22:12:12 +0000 (22:12 +0000)]
[debugserver] Return 'ios' instead of 'iphoneos' for the ostype.
When I merged the 2 codepaths that return an OS type, I hade
checked that the places accepting 'iphoneos' would also accept
'ios', but then I got it backwards and return 'iphoneos'.
We use this value to build triples, and there 'iphoneos' is
invalid.
This also makes the test slightly simpler.
llvm-svn: 330877
Artem Dergachev [Wed, 25 Apr 2018 21:51:26 +0000 (21:51 +0000)]
[analyzer] Enable analysis of WebKit "unified sources".
Normally the analyzer begins path-sensitive analysis from functions within
the main file, even though the path is allowed to go through any functions
within the translation unit.
When a recent version of WebKit is compiled, the "unified sources" technique
is used, that assumes #including multiple code files into a single main file.
Such file would have no functions defined in it, so the analyzer wouldn't be
able to find any entry points for path-sensitive analysis.
This patch pattern-matches unified file names that are similar to those
used by WebKit and allows the analyzer to find entry points in the included
code files. A more aggressive/generic approach is being planned as well.
Differential Revision: https://reviews.llvm.org/D45839
llvm-svn: 330876
Vedant Kumar [Wed, 25 Apr 2018 21:50:09 +0000 (21:50 +0000)]
[ADT] Make filter_iterator support bidirectional iteration
This makes it possible to reverse a filtered range. For example, here's
a way to visit memory accesses in a BasicBlock in reverse order:
auto MemInsts = reverse(make_filter_range(BB, [](Instruction &I) {
return isa<StoreInst>(&I) || isa<LoadInst>(&I);
}));
for (auto &MI : MemInsts)
...
To implement this functionality, I factored out forward iteration
functionality into filter_iterator_base, and added a specialization of
filter_iterator_impl which supports bidirectional iteration. Thanks to
Tim Shen, Zachary Turner, and others for suggesting this design and
providing feedback! This version of the patch supersedes the original
(https://reviews.llvm.org/D45792).
This was motivated by a problem we encountered in D45657: we'd like to
visit the non-debug-info instructions in a BasicBlock in reverse order.
Testing: check-llvm, check-clang
Differential Revision: https://reviews.llvm.org/D45853
llvm-svn: 330875
Rafael Espindola [Wed, 25 Apr 2018 21:44:37 +0000 (21:44 +0000)]
Pack symbols a bit more.
Before this patch:
Symbol 56
Defined 80
Undefined 56
SharedSymbol 88
LazyArchive 72
LazyObject 56
With this patch
Symbol 48
Defined 72
Undefined 48
SharedSymbol 80
LazyArchive 64
LazyObject 48
The result is that peak allocation when linking chromium (according to
heaptrack) goes from 578 to 568 MB.
llvm-svn: 330874
Dan Albert [Wed, 25 Apr 2018 21:26:06 +0000 (21:26 +0000)]
[Driver] Reland "Android triples are not aliases for other triples."
Fixed directory separators in tests to be compatible with both
Windows and !Windows.
This reverts commit
aa423850afa4c16a53c4c492fe254dcad3d5a53e.
llvm-svn: 330873
Martin Storsjo [Wed, 25 Apr 2018 21:24:04 +0000 (21:24 +0000)]
[test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.
Differential Revision: https://reviews.llvm.org/D45985
llvm-svn: 330872
Martin Storsjo [Wed, 25 Apr 2018 21:23:59 +0000 (21:23 +0000)]
[Driver] Fix implicit config files from prefixed symlinks
If -no-canonical-prefixes isn't used, the clang executable name used
is the one of the actual executable, not the name of the symlink that
the user invoked.
In these cases, the target prefix was overridden based on the clang
executable name. (On the other hand the implicit -target option
that such a symlink adds, is added as an actual command line parameter
in tools/driver/driver.cop, before resolving the symlink and finding
the actual clang executable.
Use the original ClangNameParts (set from argv[0] in
tools/driver/driver.cpp) if it seems to be initialized propery.
All existing tests of this feature used -no-canonical-prefixes
(possibly because it also makes the driver look in the directory
of the symlink instead of the directory of the executable); add
another one that uses --config-user-dir= to specify the directory
instead. (For actual users of such symlinks, outisde of the test
suite, the directory is probably the same for both.)
This makes this feature work more like what the documentation
describes.
Differential Revision: https://reviews.llvm.org/D45964
llvm-svn: 330871
Simon Pilgrim [Wed, 25 Apr 2018 20:59:16 +0000 (20:59 +0000)]
[CostModel][X86] Remove hard coded SDIV/UDIV vector costs
Algorithmically compute the 'x20' SDIV/UDIV vector costs - this is necessary for PR36550 when DIV costs will be driven from the scheduler models.
llvm-svn: 330870
Rafael Espindola [Wed, 25 Apr 2018 20:46:08 +0000 (20:46 +0000)]
Also demote lazy symbols.
This is not a big simplification right now, but the special cases for
lazy symbols have been a common source of bugs in the past.
llvm-svn: 330869
Hans Wennborg [Wed, 25 Apr 2018 20:32:00 +0000 (20:32 +0000)]
[COFF] Don't set the tsaware bit on DLLs
It doesn't apply to DLLs, and link.exe doesn't set it.
Differential Revision: https://reviews.llvm.org/D46077
llvm-svn: 330868
Reid Kleckner [Wed, 25 Apr 2018 20:16:24 +0000 (20:16 +0000)]
Fix PluginsTests failure on Windows buildbots by enabling it everywhere
lit is picking up a stale executable in the unittests tree, which is
failing on Windows.
To simplify the CMake and avoid problems like this in the future, now we
always compile the test, but the test exits successfully when plugins
are not enabled.
llvm-svn: 330867
Tom Stellard [Wed, 25 Apr 2018 20:02:53 +0000 (20:02 +0000)]
AMDGPU/R600: Move int_r600_store_stream_output to the public intrinsic file
Summary:
The TableGen'd GlobalISel instruction selector assumes all intrinsics are in
the public Intrinsic:: namespace.
Reviewers: jvesely, nhaehnle
Reviewed By: jvesely, nhaehnle
Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D45989
llvm-svn: 330866
Michael Kruse [Wed, 25 Apr 2018 19:54:16 +0000 (19:54 +0000)]
[CodeGen] Fix comment. NFC.
llvm-svn: 330865
Michael Kruse [Wed, 25 Apr 2018 19:43:49 +0000 (19:43 +0000)]
[CodeGen] Print executed statement instances at runtime.
Add the options -polly-codegen-trace-stmts and
-polly-codegen-trace-scalars. When enabled, adds a call to the
beginning of every generated statement that prints the executed
statement instance. With -polly-codegen-trace-scalars, it also prints
the value of all scalars that are used in the statement, and PHIs
defined in the beginning of the statement.
Differential Revision: https://reviews.llvm.org/D45743
llvm-svn: 330864
Petar Jovanovic [Wed, 25 Apr 2018 19:34:48 +0000 (19:34 +0000)]
Add s390x to XFAIL for illegal_read/write_test.cc
Follow up to r330840 and r330849.
It seems that s390 is also not distinguishing illegal WRITE and READ memory
access.
Add s390x to XFAIL for the tests.
llvm-svn: 330863
Mark Searles [Wed, 25 Apr 2018 19:21:26 +0000 (19:21 +0000)]
[AMDGPU] Waitcnt pass: add debug options
- Add "amdgpu-waitcnt-forcezero" to force all waitcnt instrs to be emitted as s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
- Add debug counters to control force emit of s_waitcnt instrs; debug counters:
si-insert-waitcnts-forceexp: force emit s_waitcnt expcnt(0) instrs
si-insert-waitcnts-forcevm: force emit s_waitcnt lgkmcnt(0) instrs
si-insert-waitcnts-forcelgkm: force emit s_waitcnt vmcnt(0) instrs
- Add some debug statements
Note that a variant of this patch was previously committed/reverted.
Differential Revision: https://reviews.llvm.org/D45888
llvm-svn: 330862
Eli Friedman [Wed, 25 Apr 2018 19:14:05 +0000 (19:14 +0000)]
[TargetInfo] Sort target features before passing them to the backend
Passing the features in random order will lead to unpredictable results
when some of the features are related (like the architecture-version
features on ARM).
It might be possible to fix this particular case in the ARM target code,
to avoid adding overlapping target features. But we should probably be
sorting in any case: the behavior shouldn't depend on StringMap's
hashing algorithm.
Differential Revision: https://reviews.llvm.org/D46030
llvm-svn: 330861
David Bolvansky [Wed, 25 Apr 2018 18:58:53 +0000 (18:58 +0000)]
[SimplifyLibcalls] Atoi, strtol replacements
Reviewers: spatel, lebedev.ri, xbolva00, efriedma
Reviewed By: xbolva00, efriedma
Subscribers: efriedma, llvm-commits
Differential Revision: https://reviews.llvm.org/D45418
llvm-svn: 330860
Francis Visoiu Mistrih [Wed, 25 Apr 2018 18:58:06 +0000 (18:58 +0000)]
[MIR] Add support for debug metadata for fixed stack objects
Debug var, expr and loc were only supported for non-fixed stack objects.
This patch adds the following fields to the "fixedStack:" entries, and
renames the ones from "stack:" to:
* debug-info-variable
* debug-info-expression
* debug-info-location
Differential Revision: https://reviews.llvm.org/D46032
llvm-svn: 330859
Michael Kruse [Wed, 25 Apr 2018 18:53:33 +0000 (18:53 +0000)]
[ScopDetect] Reject loop with multiple exit blocks.
The current statement domain derivation algorithm does not (always)
consider that different exit blocks of a loop can have different
conditions to be reached.
From the code
for (int i = n; ; i-=2) {
if (i <= 0) goto even;
if (i <= 1) goto odd;
A[i] = i;
}
even:
A[0] = 42;
return;
odd:
A[1] = 21;
return;
Polly currently derives the following domains:
Stmt_even_critedge
Domain :=
[n] -> { Stmt_even_critedge[] };
Stmt_odd
Domain :=
[n] -> { Stmt_odd[] : (1 + n) mod 2 = 0 and n > 0 };
while the domain for the odd case is correct, Stmt_even is assumed to be
executed unconditionally, which is obviously wrong. While projecting out
the loop dimension in `adjustDomainDimensions`, it does not consider
that there are other exit condition that have matched before.
I don't know a how to fix this without changing a lot of code. Therefore
This patch rejects loops with multiple exist blocks to fix the
miscompile of test-suite's uuencode.
The odd condition is transformed by LLVM to
%cmp1 = icmp eq i64 %indvars.iv, 1
such that the project_out in adjustDomainDimensions() indeed only
matches for odd n (using this condition only, we'd have an infinite loop
otherwise).
The even condition manifests as
%cmp = icmp slt i64 %indvars.iv, 3
Because buildDomainsWithBranchConstraints() does not consider other exit
conditions, it has to assume that the induction variable will eventually
be lower than 3 and taking this exit.
IMHO we need to reuse the algorithm that determines the number of
iterations (addLoopBoundsToHeaderDomain) to determine which exit
condition applies first. It has to happen in
buildDomainsWithBranchConstraints() because the result will need to
propagate to successor BBs. Currently addLoopBoundsToHeaderDomain() just
look for union of all backedge conditions (which means leaving not the
loop here). The patch in llvm.org/PR35465 changes it to look for exit
conditions instead. This is required because there might be other exit
conditions that do not alternatively go back to the loop header.
Differential Revision: https://reviews.llvm.org/D45649
llvm-svn: 330858
Kostya Kortchinsky [Wed, 25 Apr 2018 18:52:29 +0000 (18:52 +0000)]
[scudo] Adding an interface function to print allocator stats
Summary:
This adds `__scudo_print_stats` as an interface function to display the Primary
and Secondary allocator statistics for Scudo.
Reviewers: alekseyshl, flowerhack
Reviewed By: alekseyshl
Subscribers: delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D46016
llvm-svn: 330857
Nico Weber [Wed, 25 Apr 2018 18:34:00 +0000 (18:34 +0000)]
IWYU llvm-config.h for LLVM_VERSION_STRING
llvm-svn: 330856
Petr Hosek [Wed, 25 Apr 2018 18:30:55 +0000 (18:30 +0000)]
[CMake] Enable libc++ for Fuchsia toolchain on Darwin
This is necessary in order to get a working C++ compiler on Darwin
since Clang expects libc++ headers to be part of the toolchain.
Differential Revision: https://reviews.llvm.org/D46075
llvm-svn: 330855
Sam Clegg [Wed, 25 Apr 2018 18:24:08 +0000 (18:24 +0000)]
[WebAssebmly] Add Module name to WasmSymbol
Imports in a wasm module can have custom module name. This change
adds the module name to the WasmSymbol structure so that the linker
can preserve this module name.
This is needed to fix: https://bugs.llvm.org/show_bug.cgi?id=37168
Differential Revision: https://reviews.llvm.org/D45797
llvm-svn: 330854
Nico Weber [Wed, 25 Apr 2018 18:06:23 +0000 (18:06 +0000)]
Rename sancov.cc to sancov.cpp
LLVM uses cpp as its C++ file ending.
https://reviews.llvm.org/D46068
llvm-svn: 330853
Simon Pilgrim [Wed, 25 Apr 2018 18:03:31 +0000 (18:03 +0000)]
[CostModel][X86] Add div/rem tests for non-uniform constant divisors
llvm-svn: 330852
Jan Vesely [Wed, 25 Apr 2018 17:36:36 +0000 (17:36 +0000)]
relational/select: Condition types for half are short/ushort, not char/uchar
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 330851
Craig Topper [Wed, 25 Apr 2018 17:35:03 +0000 (17:35 +0000)]
[X86] Form MUL_IMM for multiplies with 3/5/9 to encourage LEA formation over load folding.
Previously we only formed MUL_IMM when we split a constant. This blocked load folding on those cases. We should also form MUL_IMM for 3/5/9 to favor LEA over load folding.
Differential Revision: https://reviews.llvm.org/D46040
llvm-svn: 330850
Petar Jovanovic [Wed, 25 Apr 2018 17:34:30 +0000 (17:34 +0000)]
Finetune supported arches for the tests added in r330840
r330840 introduced two tests that may not be supported on all architectures.
powerpc64 seems to be one of those.
llvm-svn: 330849
Reid Kleckner [Wed, 25 Apr 2018 17:30:00 +0000 (17:30 +0000)]
Revert r330755 "[lit] Report line number for failed RUN command"
It is causing many tests to fail on Windows buildbots:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10211
llvm-svn: 330848
Peter Szecsi [Wed, 25 Apr 2018 17:28:03 +0000 (17:28 +0000)]
[ASTImporter] FriendDecl importing improvements
There are only a few cases of importing a frienddecl which is currently supported.
This patch aims to improve the friend import process.
Set FriendObjectKind in case of decls, insert friend into the friend chain
correctly, checks structurally equivalent in a more advanced manner.
Test cases added as well.
llvm-svn: 330847
Alex Bradbury [Wed, 25 Apr 2018 17:25:29 +0000 (17:25 +0000)]
[RISCV] Allow call pseudoinstruction to be used to call a function name that coincides with a register name
Previously `call zero`, `call f0` etc would fail. This leads to compilation
failures if building programs that define functions with those names and using
-save-temps.
llvm-svn: 330846
Nico Weber [Wed, 25 Apr 2018 17:24:41 +0000 (17:24 +0000)]
Don't list a source file twice.
llvm-svn: 330845
Taewook Oh [Wed, 25 Apr 2018 17:19:21 +0000 (17:19 +0000)]
[ICP] Do not attempt type matching for variable length arguments.
Summary:
When performing indirect call promotion, current implementation inspects "all" parameters of the callsite and attemps to match with the formal argument type of the callee function. However, it is not possible to find the type for variable length arguments, and the compiler crashes when it attemps to match the type for variable lenght argument.
It seems that the bug is introduced with D40658. Prior to that, the type matching is performed only for the parameters whose ID is less than callee->getFunctionNumParams(). The attached test case will crash without the patch.
Reviewers: mssimpso, davidxl, davide
Reviewed By: mssimpso
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46026
llvm-svn: 330844
Nico Weber [Wed, 25 Apr 2018 17:07:46 +0000 (17:07 +0000)]
Rename Attributes.gen, Intrinsics.gen to Attributes.inc, Intrinsics.inc
Virtually all other tablegen outputs are called .inc, not .gen, so rename these two too for consistency.
No behavior change.
https://reviews.llvm.org/D46058
llvm-svn: 330843
Craig Topper [Wed, 25 Apr 2018 16:57:46 +0000 (16:57 +0000)]
[Builtins] Fix typos in a comment. NFC
llvm-svn: 330842
Sanjay Patel [Wed, 25 Apr 2018 16:34:01 +0000 (16:34 +0000)]
[InstCombine] clean up foldSelectICmpAnd(); NFC
As discussed in D45862, we want to delete parts of
this code because it can create more instructions
than it removes. But we also want to preserve some
folds that are winners, so tidy up what's here to
make splitting the good from bad a bit easier.
llvm-svn: 330841
Petar Jovanovic [Wed, 25 Apr 2018 16:21:00 +0000 (16:21 +0000)]
[mips] Implement GetWriteFlag() for mips
The read/write flag is set by manually decoding the instruction that caused
the exception. It is implemented this way because the cause register which
contains the needed flag was removed from the signal context structure which
the user handler receives from the kernel.
Patch by Milos Stojanovic.
Differential Revision: https://reviews.llvm.org/D45768
llvm-svn: 330840
Nico Weber [Wed, 25 Apr 2018 16:20:43 +0000 (16:20 +0000)]
Make add_clang_unittest formatting a bit more consistent.
llvm-svn: 330839
Marshall Clow [Wed, 25 Apr 2018 16:09:47 +0000 (16:09 +0000)]
Disable the test I just added when testing C++03.
llvm-svn: 330838
Sanjay Patel [Wed, 25 Apr 2018 15:59:23 +0000 (15:59 +0000)]
[InstCombine] add tests for select to logic folds; NFC
As discussed in D45862, we want these folds sometimes
because they're good improvements.
But as we can see here, the current logic doesn't
check uses and doesn't produce optimal code in all
cases.
llvm-svn: 330837
Haojian Wu [Wed, 25 Apr 2018 15:27:09 +0000 (15:27 +0000)]
[clangd] Add "str()" method to SymbolID.
Summary:
This is a convenient function when we try to get std::string of
SymbolID.
Reviewers: ioeric
Subscribers: klimek, ilya-biryukov, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D46065
llvm-svn: 330835
Simon Pilgrim [Wed, 25 Apr 2018 15:22:03 +0000 (15:22 +0000)]
[CostModel][X86] Recursive call for cost of imul for packed v16i16 constant shift left.
Don't just assume cost = 1.
llvm-svn: 330834
Ilya Biryukov [Wed, 25 Apr 2018 15:13:34 +0000 (15:13 +0000)]
[CodeComplete] Fix completion in the middle of ident in ctor lists.
Summary:
The example that was broken before (^ designates completion points):
class Foo {
Foo() : fie^ld^() {} // no completions were provided here.
int field;
};
To fix it we don't cut off lexing after an identifier followed by code
completion token is lexed. Instead we skip the rest of identifier and
continue lexing.
This is consistent with behavior of completion when completion token is
right before the identifier.
Reviewers: sammccall, aaron.ballman, bkramer, sepavloff, arphaman, rsmith
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44932
llvm-svn: 330833