Sam McCall [Mon, 18 Dec 2017 11:29:45 +0000 (11:29 +0000)]
[clangd] in VSCode client, filter extensions properly and only accept file: URIs
Summary:
The filtering wasn't previously working as intended - the string list is
interpreted as a list of editor modes, not file extensions.
(It happens to mostly work as "c" and "cpp" are the names of modes, but we're
missing objective-c)
The file: restriction is new - clangd needs to be able to convert URI<->path
in order to determine how to build.
Reviewers: hokein
Subscribers: klimek, ilya-biryukov, cfe-commits
Differential Revision: https://reviews.llvm.org/D41343
llvm-svn: 320972
Martin Bohme [Mon, 18 Dec 2017 11:29:21 +0000 (11:29 +0000)]
[X86] Use {{.*}} instead of hardcoded %1 in knot test.
This makes the test more resilient and consistent with the other tests
introduced in r320919.
llvm-svn: 320971
Sander de Smalen [Mon, 18 Dec 2017 11:26:34 +0000 (11:26 +0000)]
[AArch64][SVE] Asm: Add SVE predicate register definitions and parsing support
Summary: Patch [1/4] in a series to add parsing of predicates and properly parse SVE ZIP1/ZIP2 instructions.
Reviewers: rengolin, kristof.beyls, fhahn, mcrosier, evandro, echristo, efriedma
Reviewed By: fhahn
Subscribers: aemerson, javed.absar, llvm-commits, tschuett
Differential Revision: https://reviews.llvm.org/D40360
llvm-svn: 320970
Pavel Labath [Mon, 18 Dec 2017 11:05:28 +0000 (11:05 +0000)]
Fix FreeBSD build broken by r320966
llvm-svn: 320969
Eugene Leviant [Mon, 18 Dec 2017 10:53:45 +0000 (10:53 +0000)]
[ThinLTO] Remove unused code
This is a re-commit of r320464, after patch for gold plugin
was landed.
llvm-svn: 320968
Pavel Labath [Mon, 18 Dec 2017 10:51:03 +0000 (10:51 +0000)]
Add LLVMObject dependency to our ObjectFileELF plugin
llvm-svn: 320967
Pavel Labath [Mon, 18 Dec 2017 10:50:59 +0000 (10:50 +0000)]
Reduce x86 register context boilerplate.
Summary:
The x86 FPR struct was defined as a struct containing a union between
two members: XSAVE and FXSAVE. This patch makes FPR a union directly to
remove one layer of indirection when trying to access the members.
The initial layout of these two structs is identical, which is
recognised by the fact that XSAVE has FXSAVE as its first member, so we
also considered removing one more layer and leave FPR identical to XSAVE
struct, but stopped short of doing that, as the FPR may be used to store
different layouts in the future (e.g., ones generated by the FSAVE
instruction).
Reviewers: clayborg, krytarowski
Subscribers: emaste, lldb-commits
Differential Revision: https://reviews.llvm.org/D41245
llvm-svn: 320966
Tim Northover [Mon, 18 Dec 2017 10:36:00 +0000 (10:36 +0000)]
AArch64: work around how Cyclone handles "movi.2d vD, #0".
For Cylone, the instruction "movi.2d vD, #0" is executed incorrectly in some rare
circumstances. Work around the issue conservatively by avoiding the instruction entirely.
This patch changes CodeGen so that problematic instructions are never
generated, and the AsmParser so that an equivalent instruction is used (with a
warning).
llvm-svn: 320965
Igor Laevsky [Mon, 18 Dec 2017 10:31:58 +0000 (10:31 +0000)]
[TargetLibraryInfo] Discard library functions with incorrectly sized integers
Differential Revision: https://reviews.llvm.org/D41184
llvm-svn: 320964
Sam Parker [Mon, 18 Dec 2017 10:08:03 +0000 (10:08 +0000)]
[ARM] Adjust test checks
Correct the CHECK-LABELS of a couple of dag combine tests.
llvm-svn: 320963
Sam Parker [Mon, 18 Dec 2017 10:04:27 +0000 (10:04 +0000)]
[DAGCombine] Move AND nodes to multiple load leaves
Search from AND nodes to find whether they can be propagated back to
loads, so that the AND and load can be combined into a narrow load.
We search through OR, XOR and other AND nodes and all bar one of the
leaves are required to be loads or constants. The exception node then
needs to be masked off meaning that the 'and' isn't removed, but the
loads(s) are narrowed still.
Differential Revision: https://reviews.llvm.org/D41177
llvm-svn: 320962
Pavel Labath [Mon, 18 Dec 2017 09:44:29 +0000 (09:44 +0000)]
NPL: Clean up handling of inferior exit
Summary:
lldb-server was sending the "exit" packet (W??) twice. This happened
because it was handling both the pre-exit (PTRACE_EVENT_EXIT) and
post-exit (WIFEXITED) as exit events. We had some code which was trying
to detect when we've already sent the exit packet, but this stopped
working quite a while ago.
This never really caused any problems in practice because the client
automatically closes the connection after receiving the first packet, so
the only effect of this was some warning messages about extra packets
from the lldb-server test suite, which were ignored because they didn't
fail the test.
The new test suite will be stricter about this, so I fix this issue
ignoring the first event. I think this is the correct behavior, as the
inferior is not really dead at that point, so it's premature to send the
exit packet.
There isn't an actual test yet which would verify the exit behavior, but
in my next patch I will add a test which will also test this
functionality.
Reviewers: eugene
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D41069
llvm-svn: 320961
Clement Courbet [Mon, 18 Dec 2017 07:32:48 +0000 (07:32 +0000)]
[NFC][CodeGen][ExpandMemCmp] Fix documentation.
llvm-svn: 320960
Craig Topper [Mon, 18 Dec 2017 07:21:58 +0000 (07:21 +0000)]
[X86] Use mattr instead of mcpu in some of the cost model tests.
Based on the names of the check lines, features seems more appropriate that cpu.
Spotted while prototyping my patch to make 512-bit vectors illegal on SKX sometimes.
llvm-svn: 320959
Hiroshi Inoue [Mon, 18 Dec 2017 06:47:37 +0000 (06:47 +0000)]
[SROA] Disable non-whole-alloca splits by default
This patch introduce a switch to control splitting of non-whole-alloca slices with default off.
The switch will be default on again after fixing an issue reported in PR35657.
llvm-svn: 320958
Craig Topper [Mon, 18 Dec 2017 04:50:05 +0000 (04:50 +0000)]
[X86] Fix mistake that I made when splitting up the setOperationAction calls recently.
The block I moved things that need BWI and 512-bit or VLX is incorrectly qualified with just hasBWI || hasVLX. Here I've qualified it with hasBWI && (hasAVX512 || hasVLX) where the hasAVX512 will be replaced with allowing 512-bit vectors in an upcoming patch.
llvm-svn: 320957
Serguei Katkov [Mon, 18 Dec 2017 04:25:07 +0000 (04:25 +0000)]
[CGP] Fix the handling select inst in complex addressing mode
When we put the value in select placeholder we must pass
the value through simplification tracker due to the value might
be already simplified and erased.
This is a fix for PR35658.
Reviewers: john.brawn, uabelho
Reviewed By: john.brawn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41251
llvm-svn: 320956
Sanjay Patel [Mon, 18 Dec 2017 00:38:45 +0000 (00:38 +0000)]
[x86] add tests for finite libcall lowering (PR35672); NFC
llvm-svn: 320955
Benjamin Kramer [Sun, 17 Dec 2017 23:52:45 +0000 (23:52 +0000)]
Refactor overridden methods iteration to avoid double lookups.
Convert most uses to range-for loops. No functionality change intended.
llvm-svn: 320954
Bjorn Steinbrink [Sun, 17 Dec 2017 21:20:16 +0000 (21:20 +0000)]
Re-commit "Properly handle multi-element and dynamically sized allocas in getPointerDereferenceableBytes()""
llvm-clang-x86_64-expensive-checks-win is still broken, so the failure
seems unrelated.
llvm-svn: 320953
Davide Italiano [Sun, 17 Dec 2017 18:58:27 +0000 (18:58 +0000)]
[testsuite] Un-XFAIL the global variables tests.
<rdar://problem/
28725399>
Differential Revision: https://reviews.llvm.org/D41312
llvm-svn: 320952
Craig Topper [Sun, 17 Dec 2017 18:31:36 +0000 (18:31 +0000)]
[X86] Add test cases that show cases where buildvector of extract and inserts should be turned into fmsubadd.
This is a follow up to the fmaddsub support added in r320950. Hopefully in the future we can fix lowering to handle this fmsubadd too.
llvm-svn: 320951
Craig Topper [Sun, 17 Dec 2017 18:23:45 +0000 (18:23 +0000)]
[X86] Make the code that creates fmaddsub from build_vector of extracts and inserts functional and add tests.
Summary:
We had no tests for this and we couldn't do the optimization because of a bad use count check. We need to know how many non-undef pieces of the build vector were filled in and ensure our use count is equal to that. But on the shuffle combine version we need the use count to be 2.
The missing coverage was noticed during the review of D40335.
Reviewers: RKSimon, zvi, spatel
Reviewed By: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41133
llvm-svn: 320950
Simon Pilgrim [Sun, 17 Dec 2017 18:20:42 +0000 (18:20 +0000)]
[X86] Regenerate truncated rotation tests + add missing 32-bit checks
llvm-svn: 320949
Sam Clegg [Sun, 17 Dec 2017 17:52:01 +0000 (17:52 +0000)]
[WebAssembly] Move code for copying of data segment relocation. NFC.
This is a preparetory change for function gc which also
requires relocations to be copied in ranges like this.
Differential Revision: https://reviews.llvm.org/D41313
llvm-svn: 320948
Sam Clegg [Sun, 17 Dec 2017 17:50:07 +0000 (17:50 +0000)]
use uint32_t
llvm-svn: 320947
Sam Clegg [Sun, 17 Dec 2017 17:50:07 +0000 (17:50 +0000)]
[WebAssembly] Export some more info on wasm funtions
Summary:
These fields are useful for lld's gc-sections support
Also remove an unused field.
Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish
Differential Revision: https://reviews.llvm.org/D41320
llvm-svn: 320946
Bjorn Steinbrink [Sun, 17 Dec 2017 15:16:58 +0000 (15:16 +0000)]
Revert "Properly handle multi-element and dynamically sized allocas in getPointerDereferenceableBytes()"
This reverts commit
217067d5179882de9deb60d2e866befea4c126e7.
Fails on llvm-clang-x86_64-expensive-checks-win
llvm-svn: 320945
Bjorn Steinbrink [Sun, 17 Dec 2017 15:16:51 +0000 (15:16 +0000)]
Revert "Treat sret arguments as being dereferenceable in getPointerDereferenceableBytes()"
This reverts commit
8b7a7660a3904b2088bc594311bcea2c651def08.
I didn't mean to commit this.
llvm-svn: 320944
Bjorn Steinbrink [Sun, 17 Dec 2017 15:11:52 +0000 (15:11 +0000)]
Treat sret arguments as being dereferenceable in getPointerDereferenceableBytes()
llvm-svn: 320943
Aleksei Sidorin [Sun, 17 Dec 2017 14:16:17 +0000 (14:16 +0000)]
[ASTImporter] Support importing FunctionTemplateDecl and CXXDependentScopeMemberExpr
* Also introduces ImportTemplateArgumentListInfo facility (A. Sidorin)
Patch by Peter Szecsi!
Differential Revision: https://reviews.llvm.org/D38692
llvm-svn: 320942
Simon Pilgrim [Sun, 17 Dec 2017 11:01:33 +0000 (11:01 +0000)]
Remove superfluous break after a return. NFCI.
llvm-svn: 320941
Craig Topper [Sun, 17 Dec 2017 03:16:23 +0000 (03:16 +0000)]
[X86DomainReassignment] Store legal domains in a std::bitset instead of using a SmallVector that really only ever has one element as a set.
llvm-svn: 320940
Bjorn Steinbrink [Sun, 17 Dec 2017 02:37:42 +0000 (02:37 +0000)]
Properly handle byval arguments in getPointerDereferenceableBytes()
Summary:
For byval arguments, the number of dereferenceable bytes is equal to
the size of the pointee, not the pointer.
Reviewers: hfinkel, rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41305
llvm-svn: 320939
Bjorn Steinbrink [Sun, 17 Dec 2017 01:54:25 +0000 (01:54 +0000)]
Properly handle multi-element and dynamically sized allocas in getPointerDereferenceableBytes()
Reviewers: hfinkel, rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41288
llvm-svn: 320938
Craig Topper [Sun, 17 Dec 2017 01:35:48 +0000 (01:35 +0000)]
[X86] Use extract_vector_elt instead of X86ISD::VEXTRACT for isel of vXi1 extractions.
llvm-svn: 320937
Craig Topper [Sun, 17 Dec 2017 01:35:47 +0000 (01:35 +0000)]
[X86] Canonicalize extract_vector_elt from vXi1 to always return MVT::i32.
This allows us to remove some isel patterns that allowed MVT::i8 result type.
llvm-svn: 320936
Craig Topper [Sun, 17 Dec 2017 01:35:44 +0000 (01:35 +0000)]
[X86] Don't create X86ISD::VEXTRACT nodes directly. Use EXTRACT_VECTOR_ELT and allow that to be legaized to VEXTRACT.
I think we can remove the VEXTRACT node completely and use a canonicalized EXTRACT_VECTOR_ELT instead. This is a first step.
llvm-svn: 320935
Simon Pilgrim [Sat, 16 Dec 2017 23:37:51 +0000 (23:37 +0000)]
Fix unused variable warning.
llvm-svn: 320934
Simon Pilgrim [Sat, 16 Dec 2017 23:32:18 +0000 (23:32 +0000)]
[X86][AVX] lowerVectorShuffleAsBroadcast - aggressively peek through BITCASTs
Assuming we can safely adjust the broadcast index for the new type to keep it suitably aligned, then peek through BITCASTs when looking for the broadcast source.
Fixes PR32007
llvm-svn: 320933
Simon Pilgrim [Sat, 16 Dec 2017 23:09:57 +0000 (23:09 +0000)]
[X86][AVX] Use extract128BitVector helper. NFCI.
llvm-svn: 320932
Kostya Kortchinsky [Sat, 16 Dec 2017 23:01:14 +0000 (23:01 +0000)]
[sanitizer] Define __sanitizer_clockid_t on FreeBSD
Summary:
https://reviews.llvm.org/D41121 broke the FreeBSD build due to that type not
being defined on FreeBSD. As far as I can tell, it is an int, but I do not have
a way to test the change.
Reviewers: alekseyshl, kparzysz
Reviewed By: kparzysz
Subscribers: kparzysz, emaste, kubamracek, krytarowski, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D41325
llvm-svn: 320931
Simon Pilgrim [Sat, 16 Dec 2017 22:57:17 +0000 (22:57 +0000)]
[X86][AVX] Fix failed broadcast fold
Strip excess BITCASTs from EXTRACT_SUBVECTOR input
llvm-svn: 320930
Sean Fertile [Sat, 16 Dec 2017 22:41:39 +0000 (22:41 +0000)]
[Memcpy Loop Lowering] Only calculate residual size/bytes copied when needed.
If the loop operand type is int8 then there will be no residual loop for the
unknown size expansion. Dont create the residual-size and bytes-copied values
when they are not needed.
llvm-svn: 320929
Craig Topper [Sat, 16 Dec 2017 21:12:24 +0000 (21:12 +0000)]
[X86] Don't pass a zero input to the passthru operand of getVectorMaskingNode/getScalarMaskingNode when its going to emit an ISD::OR/ISD::AND. NFCI
In those cases, the pass thru operand of the methods isn't used. The calls to the scalar version were passing a MVT::i1 zero, which is an illegal type at the stage this code runs.
llvm-svn: 320928
Craig Topper [Sat, 16 Dec 2017 21:12:23 +0000 (21:12 +0000)]
[X86] Have getVectorMaskingNode return an ISD::AND for X86ISD::VPSHUFBITQMB instead of creating a select with one input being 0.
llvm-svn: 320927
Craig Topper [Sat, 16 Dec 2017 19:31:36 +0000 (19:31 +0000)]
[X86] When using vpopcntdq for ctpop of v8i16 vectors, only promote to v8i32.
Previously we promoted to v8i64, but we don't need to go all the way to 512-bits. If we have VLX we can use the 256-bit instruction. And even if we don't have VLX we can widen v8i32 to v16i32 and drop the upper half.
llvm-svn: 320926
Sam Clegg [Sat, 16 Dec 2017 18:59:50 +0000 (18:59 +0000)]
[libcxx] Add WebAssembly support
It turns out that this is the only change required in libcxx
for it to compile with the new `wasm32-unknown-unknown-wasm`
target recently added to Clang.
Patch by Nicholas Wilson!
Differential Revision: https://reviews.llvm.org/D41073
llvm-svn: 320925
Craig Topper [Sat, 16 Dec 2017 18:35:31 +0000 (18:35 +0000)]
[X86] Combine some more scheduler model entries using regular expressions.
We had a lot of separate 32 and 64 instructions that had the same scheduling data. This merges them into the same regular expression. This is pretty consistent with a lot of other instructions.
llvm-svn: 320924
Craig Topper [Sat, 16 Dec 2017 18:35:29 +0000 (18:35 +0000)]
[X86] Use instrs instead of instregex for gather/scatter instructions in the scheduler models. Combine into single InstrRW entries.
The reduces the number of scheduler groups in subtarget info.
llvm-svn: 320923
Simon Pilgrim [Sat, 16 Dec 2017 17:18:15 +0000 (17:18 +0000)]
[InstCombine] Regenerate FMUL/FMA combine tests with update_test_checks.py
llvm-svn: 320922
Sanjay Patel [Sat, 16 Dec 2017 16:41:17 +0000 (16:41 +0000)]
[InstCombine] canonicalize shifty abs(): ashr+add+xor --> cmp+neg+sel
We want to do this for 2 reasons:
1. Value tracking does not recognize the ashr variant, so it would fail to match for cases like D39766.
2. DAGCombiner does better at producing optimal codegen when we have the cmp+sel pattern.
More detail about what happens in the backend:
1. DAGCombiner has a generic transform for all targets to convert the scalar cmp+sel variant of abs
into the shift variant. That is the opposite of this IR canonicalization.
2. DAGCombiner has a generic transform for all targets to convert the vector cmp+sel variant of abs
into either an ABS node or the shift variant. That is again the opposite of this IR canonicalization.
3. DAGCombiner has a generic transform for all targets to convert the exact shift variants produced by #1 or #2
into an ISD::ABS node. Note: It would be an efficiency improvement if we had #1 go directly to an ABS node
when that's legal/custom.
4. The pattern matching above is incomplete, so it is possible to escape the intended/optimal codegen in a
variety of ways.
a. For #2, the vector path is missing the case for setlt with a '1' constant.
b. For #3, we are missing a match for commuted versions of the shift variants.
5. Therefore, this IR canonicalization can only help get us to the optimal codegen. The version of cmp+sel
produced by this patch will be recognized in the DAG and converted to an ABS node when possible or the
shift sequence when not.
6. In the following examples with this patch applied, we may get conditional moves rather than the shift
produced by the generic DAGCombiner transforms. The conditional move is created using a target-specific
decision for any given target. Whether it is optimal or not for a particular subtarget may be up for debate.
define i32 @abs_shifty(i32 %x) {
%signbit = ashr i32 %x, 31
%add = add i32 %signbit, %x
%abs = xor i32 %signbit, %add
ret i32 %abs
}
define i32 @abs_cmpsubsel(i32 %x) {
%cmp = icmp slt i32 %x, zeroinitializer
%sub = sub i32 zeroinitializer, %x
%abs = select i1 %cmp, i32 %sub, i32 %x
ret i32 %abs
}
define <4 x i32> @abs_shifty_vec(<4 x i32> %x) {
%signbit = ashr <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31>
%add = add <4 x i32> %signbit, %x
%abs = xor <4 x i32> %signbit, %add
ret <4 x i32> %abs
}
define <4 x i32> @abs_cmpsubsel_vec(<4 x i32> %x) {
%cmp = icmp slt <4 x i32> %x, zeroinitializer
%sub = sub <4 x i32> zeroinitializer, %x
%abs = select <4 x i1> %cmp, <4 x i32> %sub, <4 x i32> %x
ret <4 x i32> %abs
}
> $ ./opt -instcombine shiftyabs.ll -S | ./llc -o - -mtriple=x86_64 -mattr=avx
> abs_shifty:
> movl %edi, %eax
> negl %eax
> cmovll %edi, %eax
> retq
>
> abs_cmpsubsel:
> movl %edi, %eax
> negl %eax
> cmovll %edi, %eax
> retq
>
> abs_shifty_vec:
> vpabsd %xmm0, %xmm0
> retq
>
> abs_cmpsubsel_vec:
> vpabsd %xmm0, %xmm0
> retq
>
> $ ./opt -instcombine shiftyabs.ll -S | ./llc -o - -mtriple=aarch64
> abs_shifty:
> cmp w0, #0 // =0
> cneg w0, w0, mi
> ret
>
> abs_cmpsubsel:
> cmp w0, #0 // =0
> cneg w0, w0, mi
> ret
>
> abs_shifty_vec:
> abs v0.4s, v0.4s
> ret
>
> abs_cmpsubsel_vec:
> abs v0.4s, v0.4s
> ret
>
> $ ./opt -instcombine shiftyabs.ll -S | ./llc -o - -mtriple=powerpc64le
> abs_shifty:
> srawi 4, 3, 31
> add 3, 3, 4
> xor 3, 3, 4
> blr
>
> abs_cmpsubsel:
> srawi 4, 3, 31
> add 3, 3, 4
> xor 3, 3, 4
> blr
>
> abs_shifty_vec:
> vspltisw 3, -16
> vspltisw 4, 15
> vsubuwm 3, 4, 3
> vsraw 3, 2, 3
> vadduwm 2, 2, 3
> xxlxor 34, 34, 35
> blr
>
> abs_cmpsubsel_vec:
> vspltisw 3, -16
> vspltisw 4, 15
> vsubuwm 3, 4, 3
> vsraw 3, 2, 3
> vadduwm 2, 2, 3
> xxlxor 34, 34, 35
> blr
>
Differential Revision: https://reviews.llvm.org/D40984
llvm-svn: 320921
Sanjay Patel [Sat, 16 Dec 2017 16:11:17 +0000 (16:11 +0000)]
[Driver, CodeGen] pass through and apply -fassociative-math
There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF:
1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the
interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math.
This was mostly already done - we just need to translate the flag as a codegen option.
The test file is complicated because there are many potential combinations of flags here.
Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math.
2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and
corresponding test.
For the motivating example from PR27372:
float foo(float a, float x) { return ((a + x) - x); }
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub'
%add = fadd nnan ninf nsz arcp contract float %0, %1
%sub = fsub nnan ninf nsz arcp contract float %add, %2
So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch).
This case now works as expected end-to-end although the underlying logic is still wrong:
$ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example:
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd
%add = fadd reassoc float %0, %1
$ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm
addss %xmm1, %xmm0
subss %xmm1, %xmm0
Differential Revision: https://reviews.llvm.org/D39812
llvm-svn: 320920
Craig Topper [Sat, 16 Dec 2017 08:26:22 +0000 (08:26 +0000)]
[X86] Implement kand/kandn/kor/kxor/kxnor/knot intrinsics using native IR.
llvm-svn: 320919
Craig Topper [Sat, 16 Dec 2017 08:25:30 +0000 (08:25 +0000)]
[X86] Remove GCCBuiltin from kand/kandn/kor/kxor/kxnor/knot intrinsics so clang can implement with native IR.
llvm-svn: 320918
Craig Topper [Sat, 16 Dec 2017 06:58:30 +0000 (06:58 +0000)]
[X86] Remove unneeded code for handling the old kunpck intrinsics.
llvm-svn: 320917
Craig Topper [Sat, 16 Dec 2017 06:10:24 +0000 (06:10 +0000)]
[X86] Add the two files I forgot to commit in r320915.
llvm-svn: 320916
Craig Topper [Sat, 16 Dec 2017 06:02:31 +0000 (06:02 +0000)]
[X86] Add builtins and tests for 128 and 256 bit vpopcntdq.
llvm-svn: 320915
Hal Finkel [Sat, 16 Dec 2017 05:10:20 +0000 (05:10 +0000)]
Move Transforms/LoopVectorize/consecutive-ptr-cg-bug.ll into the X86 subdirectory
This test depends on X86's TTI; move into the X86 subdirectory.
llvm-svn: 320914
Hal Finkel [Sat, 16 Dec 2017 02:55:24 +0000 (02:55 +0000)]
[LV] Extend InstWidening with CM_Widen_Recursive
Changes to the original scalar loop during LV code gen cause the return value
of Legal->isConsecutivePtr() to be inconsistent with the return value during
legal/cost phases (further analysis and information of the bug is in D39346).
This patch is an alternative fix to PR34965 following the CM_Widen approach
proposed by Ayal and Gil in D39346. It extends InstWidening enum with
CM_Widen_Reverse to properly record the widening decision for consecutive
reverse memory accesses and, consequently, get rid of the
Legal->isConsetuviePtr() call in LV code gen. I think this is a simpler/cleaner
solution to PR34965 than the one in D39346.
Fixes PR34965.
Patch by Diego Caballero, thanks!
Differential Revision: https://reviews.llvm.org/D40742
llvm-svn: 320913
Galina Kistanova [Sat, 16 Dec 2017 02:54:17 +0000 (02:54 +0000)]
Fixed warning 'function declaration isn’t a prototype [-Werror=strict-prototypes]'
llvm-svn: 320912
Hal Finkel [Sat, 16 Dec 2017 02:42:18 +0000 (02:42 +0000)]
[PowerPC, AsmParser] Enable the mnemonic spell corrector
r307148 added an assembly mnemonic spelling correction support and enabled it
on ARM. This enables that support on PowerPC as well.
Patch by Dmitry Venikov, thanks!
Differential Revision: https://reviews.llvm.org/D40552
llvm-svn: 320911
Craig Topper [Sat, 16 Dec 2017 02:40:28 +0000 (02:40 +0000)]
[X86] Add 128 and 256-bit VPOPCNTDQ instructions. Adjust some tablegen classes LZCNT/POPCNT.
I think when this instruction was first published it was only for a Knights CPU and thus VLX version was missing.
llvm-svn: 320910
Vitaly Buka [Sat, 16 Dec 2017 02:40:20 +0000 (02:40 +0000)]
[LTO] Update tests for r320905
llvm-svn: 320909
Hal Finkel [Sat, 16 Dec 2017 02:23:22 +0000 (02:23 +0000)]
[VerifyDiagnosticConsumer] support -verify=<prefixes>
This mimics FileCheck's --check-prefixes option.
The default prefix is "expected". That is, "-verify" is equivalent to
"-verify=expected".
The goal is to permit exercising a single test suite source file with different
compiler options producing different sets of diagnostics. While cpp can be
combined with the existing -verify to accomplish the same goal, source is often
easier to maintain when it's not cluttered with preprocessor directives or
duplicate passages of code. For example, this patch also rewrites some existing
clang tests to demonstrate the benefit of this feature.
Patch by Joel E. Denny, thanks!
Differential Revision: https://reviews.llvm.org/D39694
llvm-svn: 320908
Vitaly Buka [Sat, 16 Dec 2017 02:12:35 +0000 (02:12 +0000)]
Remove trailing whitespace
llvm-svn: 320907
Sam Clegg [Sat, 16 Dec 2017 02:10:16 +0000 (02:10 +0000)]
[WebAssembly] Return ArrayRef's rather than const std::vector&
From working on lld I've learned this is generally the
preferred way for several reasons (e.g. more concise, improves
encapsulation).
Differential Revision: https://reviews.llvm.org/D41265
llvm-svn: 320906
Vitaly Buka [Sat, 16 Dec 2017 02:10:00 +0000 (02:10 +0000)]
[LTO] Make processing of combined module more consistent
Summary:
1. Use stream 0 only for combined module. Previously if combined module was not
processes ThinLTO used the stream for own output. However small changes in input,
could trigger combined module and shuffle outputs making life of llvm::LTO harder.
2. Always process combined module and write output to stream 0. Processing empty
combined module is cheap and allows llvm::LTO users to avoid implementing processing
which is already done in llvm::LTO.
Subscribers: mehdi_amini, inglorion, eraman, hiraditya
Differential Revision: https://reviews.llvm.org/D41267
llvm-svn: 320905
Hal Finkel [Sat, 16 Dec 2017 01:40:19 +0000 (01:40 +0000)]
[TextDiagnosticBuffer] Fix diagnostic note emission order
The frontend currently groups diagnostics from the command line according to
diagnostic level, but that places all notes last. Fix that by emitting such
diagnostics in the order they were generated.
Patch by Joel E. Denny, thanks!
Differential Revision: https://reviews.llvm.org/D40995
llvm-svn: 320904
Teresa Johnson [Sat, 16 Dec 2017 01:35:36 +0000 (01:35 +0000)]
Add another missing -enable-import-metadata to test
r320895 modified a test so that it needs -enable-import-metadata which
is false by default for NDEBUG, found another place that needs this
added.
llvm-svn: 320903
Vedant Kumar [Sat, 16 Dec 2017 01:28:25 +0000 (01:28 +0000)]
[CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)
This patch introduces a specialized way to lower overflow-checked
multiplications with mixed-sign operands. This fixes link failures and
ICEs on code like this:
void mul(int64_t a, uint64_t b) {
int64_t res;
__builtin_mul_overflow(a, b, &res);
}
The generic checked-binop irgen would use a 65-bit multiplication
intrinsic here, which requires runtime support for _muloti4 (128-bit
multiplication), and therefore fails to link on i386. To get an ICE
on x86_64, change the example to use __int128_t / __uint128_t.
Adding runtime and backend support for 65-bit or 129-bit checked
multiplication on all of our supported targets is infeasible.
This patch solves the problem by using simpler, specialized irgen for
the mixed-sign case.
llvm.org/PR34920, rdar://
34963321
Testing: Apart from check-clang, I compared the output from this fairly
comprehensive test driver using unpatched & patched clangs:
https://gist.github.com/vedantk/
3eb9c88f82e5c32f2e590555b4af5081
Differential Revision: https://reviews.llvm.org/D41149
llvm-svn: 320902
Hal Finkel [Sat, 16 Dec 2017 01:26:25 +0000 (01:26 +0000)]
[SimplifyLibCalls] Inline calls to cabs when it's safe to do so
When unsafe algerbra is allowed calls to cabs(r) can be replaced by:
sqrt(creal(r)*creal(r) + cimag(r)*cimag(r))
Patch by Paul Walker, thanks!
Differential Revision: https://reviews.llvm.org/D40069
llvm-svn: 320901
Hal Finkel [Sat, 16 Dec 2017 01:12:50 +0000 (01:12 +0000)]
[LV] NFC patch for moving VP*Recipe class definitions from LoopVectorize.cpp to VPlan.h
This is a small step forward to move VPlan stuff to where it should belong (i.e., VPlan.*):
1. VP*Recipe classes in LoopVectorize.cpp are moved to VPlan.h.
2. Many of VP*Recipe::print() and execute() definitions are still left in
LoopVectorize.cpp since they refer to things declared in LoopVectorize.cpp. To
be moved to VPlan.cpp at a later time.
3. InterleaveGroup class is moved from anonymous namespace to llvm namespace.
Referencing it in anonymous namespace from VPlan.h ended up in warning.
Patch by Hideki Saito, thanks!
Differential Revision: https://reviews.llvm.org/D41045
llvm-svn: 320900
Teresa Johnson [Sat, 16 Dec 2017 01:00:48 +0000 (01:00 +0000)]
Add -enable-import-metadata to test
r320895 modified a test so that it needs -enable-import-metadata which
is false by default for NDEBUG.
llvm-svn: 320899
Craig Topper [Sat, 16 Dec 2017 00:33:16 +0000 (00:33 +0000)]
[X86] Add back the assert from r320830 that was reverted in r320850
Hopefully r320864 has fixed the offending case that failed the assert.
llvm-svn: 320898
Teresa Johnson [Sat, 16 Dec 2017 00:29:31 +0000 (00:29 +0000)]
Fix NDEBUG build problem in r320895
Fix incorrect placement of #endif causing NDEBUG build failures.
llvm-svn: 320897
Shoaib Meenai [Sat, 16 Dec 2017 00:23:24 +0000 (00:23 +0000)]
[COFF] Clean up debug option handling
/debug and /debug:dwarf are orthogonal. An object file can contain both
CodeView and DWARF debug info, so the combination of /debug:dwarf and
/debug should generate both DWARF and a PDB, rather than /debug:dwarf
always suppressing PDB creation.
/nopdb is now redundant and can be removed. /debug /nopdb was previously
used to support DWARF, but specifying /debug:dwarf is entirely
equivalent to that combination now.
Differential Revision: https://reviews.llvm.org/D41310
llvm-svn: 320896
Teresa Johnson [Sat, 16 Dec 2017 00:18:12 +0000 (00:18 +0000)]
[ThinLTO] Enable importing of aliases as copy of aliasee
Summary:
This implements a missing feature to allow importing of aliases, which
was previously disabled because alias cannot be available_externally.
We instead import an alias as a copy of its aliasee.
Some additional work was required in the IndexBitcodeWriter for the
distributed build case, to ensure that the aliasee has a value id
in the distributed index file (i.e. even when it is not being
imported directly).
This is a performance win in codes that have many aliases, e.g. C++
applications that have many constructor and destructor aliases.
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D40747
llvm-svn: 320895
Shoaib Meenai [Fri, 15 Dec 2017 23:52:46 +0000 (23:52 +0000)]
[COFF] Update an outdated comment. NFC
This comment dates from when LLD didn't produce actual PDBs, and is very
outdated now.
llvm-svn: 320894
David Blaikie [Fri, 15 Dec 2017 23:52:06 +0000 (23:52 +0000)]
Fix WebAssembly backend for some LLVM API changes
llvm-svn: 320893
Shoaib Meenai [Fri, 15 Dec 2017 23:51:14 +0000 (23:51 +0000)]
[COFF] Simplify hasArgs calls. NFC
We can just pass multiple options to hasArgs (which will check for any
of those options being present) instead of calling it multiple times.
llvm-svn: 320892
Davide Italiano [Fri, 15 Dec 2017 23:27:10 +0000 (23:27 +0000)]
[CMake] darwin-debug is an hard dependency for tests on macOS.
Fixes a few failured on the testsuite with CMake.
llvm-svn: 320891
Quentin Colombet [Fri, 15 Dec 2017 23:24:39 +0000 (23:24 +0000)]
[TableGen][GlobalISel] Make the different Matcher comparable
This opens refactoring opportunities in the match table now that we can
check that two predicates are the same.
NFC.
llvm-svn: 320890
Quentin Colombet [Fri, 15 Dec 2017 23:24:36 +0000 (23:24 +0000)]
[TableGen][GlobalISel] Fix unused variable warning in release mode
Introduced in r320887.
NFC.
llvm-svn: 320889
Paul Robinson [Fri, 15 Dec 2017 23:21:52 +0000 (23:21 +0000)]
Revert "Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header.""
This reverts commit
0afef672f63f0e4e91938656bc73424a8c058bfc.
Still failing at runtime on bots.
llvm-svn: 320888
Quentin Colombet [Fri, 15 Dec 2017 23:07:42 +0000 (23:07 +0000)]
[TableGen][GlobalISel] Have the predicate directly know which data they are dealing with
Prior to this patch, a predicate wouldn't make sense outside of its
rule. Indeed, it was only during emitting a rule that a predicate would
be made aware of the IDs of the data it is checking. Because of that,
predicates could not be moved around or compared between each other.
NFC.
llvm-svn: 320887
Paul Robinson [Fri, 15 Dec 2017 22:57:17 +0000 (22:57 +0000)]
Recommit "[DWARFv5] Dump an MD5 checksum in the line-table header."
Adds missing support for DW_FORM_data16.
Update of r320852, fixing the unittest to use a hand-coded struct
instead of std::array to guarantee data layout.
Differential Revision: https://reviews.llvm.org/D41090
llvm-svn: 320886
Matthias Braun [Fri, 15 Dec 2017 22:53:33 +0000 (22:53 +0000)]
Fix unused variable in non-assert builds
llvm-svn: 320885
Matthias Braun [Fri, 15 Dec 2017 22:22:58 +0000 (22:22 +0000)]
MachineFunction: Return reference from getFunction(); NFC
The Function can never be nullptr so we can return a reference.
llvm-svn: 320884
Davide Italiano [Fri, 15 Dec 2017 22:22:51 +0000 (22:22 +0000)]
[MacOSX/Queues] Relax an overly aggressive assertion in a test.
"Default" is a valid QoS for a thread on older versions of macOS,
like the one installed in the bot.
Thanks to Jason Molenda for helping me figuring out the problem.
<rdar://problem/
28346273>
llvm-svn: 320883
Matthias Braun [Fri, 15 Dec 2017 22:22:46 +0000 (22:22 +0000)]
MachineFunction: Slight refactoring; NFC
Slight cleanup/refactor in preparation for upcoming commit.
llvm-svn: 320882
Matthias Braun [Fri, 15 Dec 2017 22:22:42 +0000 (22:22 +0000)]
MachineModuleInfo: Remove unused function; NFC
Remove the unused setModule() function; it would be dangerous if someone
actually used it as it wouldn't reset/recompute various other module
related data.
llvm-svn: 320881
Sam Clegg [Fri, 15 Dec 2017 22:17:15 +0000 (22:17 +0000)]
[WebAssembly] Don't include lazy symbols in import table
This bug was introduced in: https://reviews.llvm.org/D41304.
Add a test for this case.
Differential Revision: https://reviews.llvm.org/D41309
llvm-svn: 320872
Galina Kistanova [Fri, 15 Dec 2017 22:15:29 +0000 (22:15 +0000)]
Fixed the gcc 'enumeral and non-enumeral type in conditional expression [-Werror=extra]' warning introduced by r320750
llvm-svn: 320868
Krzysztof Parzyszek [Fri, 15 Dec 2017 21:34:05 +0000 (21:34 +0000)]
[Hexagon] Remove recursion in visitUsesOf, replace with use queue
This is primarily to reduce stack usage, but ordering the use queue
according to the position in the code (earlier instructions visited
before later ones) reduces the number of unnecessary bottoms due to
visiting instructions out of order, e.g.
%reg1 = copy %reg0
%reg2 = copy %reg0
%reg3 = and %reg1, %reg2
Here, reg3 should be known to be same as reg0-2, but if reg3 is
evaluated after reg1 is updated, but before reg2 is updated, the two
inputs to the and will appear different, causing reg3 to become
bottom.
llvm-svn: 320866
Krzysztof Parzyszek [Fri, 15 Dec 2017 21:23:12 +0000 (21:23 +0000)]
[Hexagon] Handle concat_vectors of all allowed HVX types
llvm-svn: 320865
Craig Topper [Fri, 15 Dec 2017 21:18:06 +0000 (21:18 +0000)]
[X86] Use AND32ri8 instead of AND64ri8 in Asan code in EmitCallAsanReport for 32-bit mode.
This seemed to work due to a quirk in the X86 MC encoder that didn't emit a REX byte that the AND64ri8 implies when in 32-bit mode. This made the encoding the same as AND32ri8. I tried to add an assert to catch the dropped REX prefix that caught this.
llvm-svn: 320864
Craig Topper [Fri, 15 Dec 2017 21:18:05 +0000 (21:18 +0000)]
[X86] In LowerVectorCTPOP use ISD::ZERO_EXTEND/ISD::TRUNCATE instead of the target specific nodes.
The target independent nodes will get legalized to the target specific nodes by their own legalization process. Someday I'd like to stop using a target specific for zero extends and truncates of legal types so the less places we reference the target specific opcode the better.
llvm-svn: 320863
Craig Topper [Fri, 15 Dec 2017 20:57:18 +0000 (20:57 +0000)]
[X86] Remove unnecessary TODO.
When I wrote it I thought we were missing a potential optimization for KNL. But investigating further shows that for KNL we still do the optimal thing by widening to v4f32 and then using special isel patterns to widen again to zmm a register.
llvm-svn: 320862
Martin Storsjo [Fri, 15 Dec 2017 20:53:10 +0000 (20:53 +0000)]
[MinGW] Ignore the --no-seh flag
The COFF linker automatically sets the IMAGE_DLL_CHARACTERISTICS_NO_SEH
when suitable, similarly to link.exe.
Differential Revision: https://reviews.llvm.org/D41275
llvm-svn: 320861