Nico Weber [Tue, 4 Jun 2019 18:06:28 +0000 (18:06 +0000)]
llvm-undname: Add test coverage for demangleInitFiniStub()
llvm-svn: 362536
Craig Topper [Tue, 4 Jun 2019 18:03:07 +0000 (18:03 +0000)]
[X86] Mutate fceil/ffloor/ftrunc/fnearbyint/frint into X86ISD::RNDSCALE during PreProcessIselDAG to cut down on pattern permutations
We already need to have patterns for X86ISD::RNDSCALE to support software intrinsics. But we currently have 5 sets of patterns for the 5 rounding operations. For of these 6 patterns we have to support 3 vectors widths, 2 element sizes, sse/vex/evex encodings, load folding, and broadcast load folding. This results in a fair amount of bytes in the isel table.
This patch adds code to PreProcessIselDAG to morph the fceil/ffloor/ftrunc/fnearbyint/frint to X86ISD::RNDSCALE. This way we can remove everything, but the intrinsic pattern while still allowing the operations to be considered Legal for DAGCombine and Legalization. This shrinks the DAGISel by somewhere between 9K and 10K.
There is one complication to this, the STRICT versions of these nodes are currently mutated to their none strict equivalents at isel time when the node is visited. This won't be true in the future since that loses the chain ordering information. For now I've also added support for the non-STRICT nodes to Select so we can change the STRICT versions there after they've been mutated to their non-STRICT versions. We'll probably need a STRICT version of RNDSCALE or something to handle this in the future. Which will take us back to needing 2 sets of patterns for strict and non-strict, but that's still better than the 11 or 12 sets of patterns we'd need.
We can probably do something similar for scalar, but I haven't looked at it yet.
Differential Revision: https://reviews.llvm.org/D62757
llvm-svn: 362535
Benjamin Kramer [Tue, 4 Jun 2019 18:01:07 +0000 (18:01 +0000)]
[X86] Fold single-use variable into assert. NFC.
Avoids an unused variable warning in Release builds.
llvm-svn: 362534
Craig Topper [Tue, 4 Jun 2019 17:44:18 +0000 (17:44 +0000)]
[DAGCombiner][X86] Fold (not (neg X)) -> (add X, -1)
This is a special case of a more general transform (not (sub Y, X)) -> (add X, ~Y). InstCombine knows the general form. I've restricted to the special case to fix the motivating case PR42118. I tried handling any case where Y was constant, but got some changes on some Mips tests that I couldn't quickly prove where beneficial.
Fixes PR42118
Differential Revision: https://reviews.llvm.org/D62828
llvm-svn: 362533
Philip Reames [Tue, 4 Jun 2019 17:29:55 +0000 (17:29 +0000)]
[Tests] Autogen a test so future changes are visible
Oddly, I had to change a value name from "tmp0" to "bc0" to get the autogened test to pass. I'm putting this down to an oddity of update_test_checks or FileCheck, but don't understand it.
llvm-svn: 362532
Richard Smith [Tue, 4 Jun 2019 17:17:20 +0000 (17:17 +0000)]
PR42104: Support instantiations of lambdas that implicitly capture
packs.
Two changes:
* Track odr-use via FunctionParmPackExprs to properly handle dependent
odr-uses of packs in generic lambdas.
* Do not instantiate implicit captures; instead, regenerate them by
instantiating the body of the lambda. This is necessary to
distinguish between cases where only one element of a pack is
captured and cases where the entire pack is captured.
This reinstates r362358 (reverted in r362375) with a fix for an
uninitialized variable use in UpdateMarkingForLValueToRValue.
llvm-svn: 362531
Ilya Biryukov [Tue, 4 Jun 2019 17:15:48 +0000 (17:15 +0000)]
[Syntax] Do not depend on llvm targets for Syntax tests. NFC
They are not required and only slow down the build.
llvm-svn: 362530
Roman Lebedev [Tue, 4 Jun 2019 17:05:34 +0000 (17:05 +0000)]
[NFC][Codegen][PowerPC] Autogenerate shift-cmp.ll test
Being affected by upcoming patch
llvm-svn: 362529
Roman Lebedev [Tue, 4 Jun 2019 17:05:06 +0000 (17:05 +0000)]
[NFC][Codegen][AMDGPU] Autogenerate commute-shifts.ll test
Being affected by upcoming patch
llvm-svn: 362528
Mitch Phillips [Tue, 4 Jun 2019 17:01:11 +0000 (17:01 +0000)]
[GWP-ASan] Configuration options [3].
Summary:
See D60593 for further information.
This patch introduces the configuration options for GWP-ASan. In general, we expect the supporting allocator to populate the options struct, and give that to GWP-ASan during initialisation. For allocators that are okay with pulling in sanitizer_common, we also provide an optional parser that populates the gwp_asan::Options struct with values provided in the GWP_ASAN_OPTIONS environment variable.
This patch contains very little logic, and all of the testable components (i.e. the optional parser's internal logic) is tested as part of the sanitizer_common testbed.
Reviewers: vlad.tsyrklevich, morehouse, jfb
Reviewed By: morehouse
Subscribers: dexonsmith, kubamracek, mgorny, #sanitizers, llvm-commits, vitalybuka
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D62698
llvm-svn: 362527
Alex Brachet [Tue, 4 Jun 2019 16:55:30 +0000 (16:55 +0000)]
[MACHO] Replaced calls to getStruct with getStructOrErr in functions returning Error or Expected or similar
llvm-svn: 362526
Louis Dionne [Tue, 4 Jun 2019 16:47:18 +0000 (16:47 +0000)]
[libcxx] Add test to check min/max requirement to regular expression
This commit adds tests that repeated characters in regular expressions
are within numeric limits, and that a <= b in a regex like `x{a,b}`.
Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D62816
llvm-svn: 362525
Sanjay Patel [Tue, 4 Jun 2019 16:40:04 +0000 (16:40 +0000)]
[x86] split 256-bit store of concatenated vectors
This shows up as a side issue to the main problem for the AVX target example from PR37428:
https://bugs.llvm.org/show_bug.cgi?id=37428 - https://godbolt.org/z/7tpRa3
But as we can see in the pile of existing test diffs, it's actually a widespread problem
that affects any AVX or later target. Apart from a couple of oddballs, I think these are
all improvements for the reasons stated in the code comment: we do not want to enable YMM
unnecessarily (avoid vzeroupper and frequency throttling) and some cores split 256-bit
stores anyway.
We could say that MergeConsecutiveStores() is going overboard on some of these examples,
but that won't solve the problem completely. But that is a reason I'm proposing this as
a lowering rather than a combine: we will infinite loop fighting the merge code if we try
this earlier.
Differential Revision: https://reviews.llvm.org/D62498
llvm-svn: 362524
Peter Smith [Tue, 4 Jun 2019 16:35:40 +0000 (16:35 +0000)]
[AArch64][ELF] Add support for PLT decoding with BTI instructions present
Arm Architecture v8.5a introduces Branch Target Identification (BTI). When
enabled all indirect branches must target a bti instruction of the
appropriate form. As PLT sequences may sometimes be the target of an
indirect branch and PLT[0] always is, a static linker may need to generate
PLT sequences that contain "bti c" as the first instruction. In effect:
bti c
adrp x16, page offset to .got.plt
...
Instead of:
adrp x16, page offset to .got.plt
...
At present the PLT decoding assumes the adrp will always be the first
instruction. This patch adds support for a single "bti c" to prefix it. A
test binary has been uploaded with such a PLT sequence. A forthcoming LLD
patch will make heavy use of the PLT decoding code.
Differential Revision: https://reviews.llvm.org/D62598
llvm-svn: 362523
Sam Clegg [Tue, 4 Jun 2019 16:35:23 +0000 (16:35 +0000)]
[WebAssembly] Add comment as follow-up to rL362276. NFC.
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62824
llvm-svn: 362522
Akira Hatanaka [Tue, 4 Jun 2019 16:29:58 +0000 (16:29 +0000)]
[CodeGen][ObjC] Convert '[self alloc]' in a class method to a call to
'objc_alloc(self)'
Also convert '[[self alloc] init]' in a class method to a call to
'objc_alloc_init(self)'.
rdar://problem/
50855121
Differential Revision: https://reviews.llvm.org/D62643
llvm-svn: 362521
Nico Weber [Tue, 4 Jun 2019 16:25:28 +0000 (16:25 +0000)]
llvm-undname: Yet more coverage for error paths
- For error returns in demangleSpecialTableNode(),
demangleLocalStaticGuard(), RTTITypeDescriptor,
demangleRttiBaseClassDescriptorNode(), demangleUnsigned(),
demangleUntypedVariable() (via RttiBaseClassArray)
- For ?_A and ?_P which are handled at early levels of the
demangler but are not implemented in a later stage; this
is now more obvious
- Replace a "default:" with an explicit list of cases, to
get -Wswitch check we list all cases
llvm-svn: 362520
Nikita Popov [Tue, 4 Jun 2019 16:24:09 +0000 (16:24 +0000)]
[LVI][CVP] Add support for urem, srem and sdiv
The underlying ConstantRange functionality has been added in D60952,
D61207 and D61238, this just exposes it for LVI.
I'm switching the code from using a whitelist to a blacklist, as
we're down to one unsupported operation here (xor) and writing it
this way seems more obvious :)
Differential Revision: https://reviews.llvm.org/D62822
llvm-svn: 362519
Philip Reames [Tue, 4 Jun 2019 16:19:34 +0000 (16:19 +0000)]
[Tests] Update a test to consistently use new pass manager and FileCheck the result
llvm-svn: 362518
Ilya Biryukov [Tue, 4 Jun 2019 16:19:11 +0000 (16:19 +0000)]
[clangd] Minor cleanup. NFC
Removed unused using declaration from TweakTests.cpp
llvm-svn: 362517
Philip Reames [Tue, 4 Jun 2019 16:15:19 +0000 (16:15 +0000)]
[Tests] Autogen tests so that diffs for a future change are understandable
llvm-svn: 362516
Nico Weber [Tue, 4 Jun 2019 15:47:25 +0000 (15:47 +0000)]
llvm-undname: Add coverage for startsWithLocalScopePattern()
llvm-svn: 362515
Nico Weber [Tue, 4 Jun 2019 15:38:00 +0000 (15:38 +0000)]
llvm-undname: More no-op changes to increase test coverage
- Add test coverage around invalid anon namespaces and
for error paths in demanglePrimitiveType() and in
demangleFullyQualifiedTypeName()
- Use DEMANGLE_UNREACHABLE in two more unreachable places
llvm-svn: 362514
James Henderson [Tue, 4 Jun 2019 15:34:58 +0000 (15:34 +0000)]
[llvm-symbolizer] Flush output on bad input
One way of using llvm-symbolizer is to interactively within a process
write a line from a parent process to llvm-symbolizer's stdin, and then
read the output, then write the next line, read, etc. This worked as
long as all the lines were good. However, this didn't work prior to this
patch if any of the inputs were bad inputs, because the output is not
flushed after a bad input, meaning the parent process is sat waiting for
output, whilst llvm-symbolizer is sat waiting for input. This patch
flushes the output after every invocation of symbolizeInput when reading
from stdin. It also removes unnecessary flushing when llvm-symbolizer is
not reading addresses from stdin, which should give a slight performance
boost in these situations.
Reviewed by: ikudrin
Differential Revision: https://reviews.llvm.org/D62371
llvm-svn: 362511
James Y Knight [Tue, 4 Jun 2019 15:27:19 +0000 (15:27 +0000)]
[lldb] Fix out-of-bounds read after
c3ea7c66fec021867e005ad1b02f3c7e80feaa85
"Add support for mid-function epilogues on x86 that end in a non-local jump."
Detected by asan.
llvm-svn: 362510
Jinsong Ji [Tue, 4 Jun 2019 15:22:23 +0000 (15:22 +0000)]
[PowerPC] P9 Scheduling Model: dispatching rule fixes
This is to address some of the problems in existing P9 resource modeling,
especially about the dispatching rules.
Instead of using a hypothetical DISPATCHER , we try to use the number of
actual dispatch slots, and define SchedWriteRes to model dispatch rules,
then update instruction classes according to dispatch rules.
All the dispatch rules and instruction classes update are made according
to POWER9 User Manual.
Differential Revision: https://reviews.llvm.org/D61873
llvm-svn: 362509
Marshall Clow [Tue, 4 Jun 2019 15:18:46 +0000 (15:18 +0000)]
No longer reject inputs when using a locale that has grouping information _and_ the input has no grouping characters at all. We continue to reject cases when the input has grouping characters in the wrong place. Fixes PR#28704
llvm-svn: 362508
Sanjay Patel [Tue, 4 Jun 2019 15:15:59 +0000 (15:15 +0000)]
[SelectionDAG][x86] limit post-legalization store merging by type
The proposal in D62498 showed that x86 would benefit from vector
store splitting, but that may conflict with the generic DAG
combiner's store merging transforms.
Add memory type to the existing TLI hook that enables the merging
transforms, so we can limit those changes to scalars only for x86.
llvm-svn: 362507
Nico Weber [Tue, 4 Jun 2019 15:13:30 +0000 (15:13 +0000)]
llvm-undname: Several behavior-preserving changes to increase coverage
- Replace `Error = true` in a few branches that are truly unreachable
with DEMANGLE_UNREACHABLE
- Remove early return early in startsWithLocalScopePattern() because
it's redundant with the next two early returns
- Remove unreachable `case '0'` (it's handled in the branch below)
- Remove an unused bool return
- Add test coverage for several early error returns, mostly in
array type parsing
llvm-svn: 362506
Gheorghe-Teodor Bercea [Tue, 4 Jun 2019 15:05:53 +0000 (15:05 +0000)]
[OpenMP][libomptarget] Enable usage of unified memory for declare target link variables
Summary: This patch enables the usage of a host variable on the device for declare target link variables when unified memory is available.
Reviewers: ABataev, caomhin, grokos
Reviewed By: grokos
Subscribers: Hahnfeld, guansong, jdoerfert, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D60884
llvm-svn: 362505
Simon Pilgrim [Tue, 4 Jun 2019 15:02:33 +0000 (15:02 +0000)]
[X86][SSE] Pulled out (sub (xor X, M), M) 'ConditionalNegate' out pattern match code. NFCI.
As discussed on D62777 - we should be able to use this in more SSE41+ cases as well but that requires us to separate it from the OR(AND(),ANDN()) matcher.
llvm-svn: 362504
Shawn Landden [Tue, 4 Jun 2019 14:51:15 +0000 (14:51 +0000)]
[Support] make countLeadingZeros() countTrailingZeros() countLeadingOnes() and countTrailingOnes() return unsigned
This matches APInt's versions of these functions, and there is no need for these to be size_t.
(as well as __builtin_clzll())
Differential Revision: https://reviews.llvm.org/D60823
llvm-svn: 362503
Sanjay Patel [Tue, 4 Jun 2019 14:40:37 +0000 (14:40 +0000)]
[x86] add test for store merging/splitting; NFC
This is a reduction of a test that would infinite loop with D62498.
llvm-svn: 362502
Shawn Landden [Tue, 4 Jun 2019 14:32:52 +0000 (14:32 +0000)]
[SimplifyCFG] fix last commit
llvm-svn: 362501
Stefan Granitz [Tue, 4 Jun 2019 14:21:48 +0000 (14:21 +0000)]
[CMake] Move and add settings to Apple-lldb-base cache script
llvm-svn: 362500
Shawn Landden [Tue, 4 Jun 2019 14:17:46 +0000 (14:17 +0000)]
[SimplifyCFG] NFC; remove bogus test case
Even if one bit is defined, the code is not clear what it is suppose to do.
The test wants to assert that some bits are undef, but that's not what the IR does and I don't think it's even possible to do that in any meaningful way. It was added in D12497, so @reames might want to double check.
Differential Revision: https://reviews.llvm.org/D60859
llvm-svn: 362499
Nico Weber [Tue, 4 Jun 2019 13:42:45 +0000 (13:42 +0000)]
gn build: Merge r362459
llvm-svn: 362498
Fangrui Song [Tue, 4 Jun 2019 13:41:29 +0000 (13:41 +0000)]
[ELF] Suppress "STT_SECTION symbol should be defined" on .eh_frame, .debug*, .zdebug* and .gcc_except_table
Summary:
With -r or --emit-relocs, we warn `STT_SECTION symbol should be defined`
on relocations to discarded section symbol. This was added as an error
in rLLD319404, but was not so effective before D61583 (it turned the
error to a warning).
Relocations from .eh_frame .debug* .zdebug* .gcc_except_table to
discarded .text are very common and somewhat expected. Don't warn/error
on them. As a reference, ld.bfd has a similar logic in
_bfd_elf_default_action_discarded() to allow these cases.
Delete invalid-undef-section-symbol.test because what it intended to
check is now covered by the updated comdat-discarded-reloc.s
Delete relocatable-eh-frame.s because we allow relocations from
.eh_frame as a special case now.
Reviewers: grimar, phosek, ruiu, espindola
Reviewed By: ruiu
Subscribers: emaste, arichardson, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62840
llvm-svn: 362497
Kadir Cetinkaya [Tue, 4 Jun 2019 13:38:36 +0000 (13:38 +0000)]
[clangd] Also apply adjustArguments when returning fallback commands
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62856
llvm-svn: 362496
Dmitri Gribenko [Tue, 4 Jun 2019 12:55:00 +0000 (12:55 +0000)]
Include what you use in PPCRegisterInfo.cpp
llvm-svn: 362495
Roman Lebedev [Tue, 4 Jun 2019 11:44:50 +0000 (11:44 +0000)]
[NFC][Codegen] D62818 - also add tests with X being constant
For X86, these may be a 'BT' pattern, and in general, can cause
the transform to deadlock.
llvm-svn: 362494
Peter Smith [Tue, 4 Jun 2019 11:44:33 +0000 (11:44 +0000)]
[AArch64][ELF][llvm-readobj] Add support for BTI and PAC dynamic tags
ELF for the 64-bit Arm Architecture defines two processor-specific dynamic
tags:
DT_AARCH64_BTI_PLT 0x70000001, d_val
DT_AARCH64_PAC_PLT 0x70000003, d_val
These presence of these tags indicate that PLT sequences have been
protected using Branch Target Identification and Pointer Authentication
respectively. The presence of both indicates that the PLT sequences have
been protected with both Branch Target Identification and Pointer
Authentication.
This patch adds the tags and tests for llvm-readobj and yaml2obj.
As some of the processor specific dynamic tags overlap, this patch splits
them up, keeping their original default value if they were not previously
mentioned explicitly in a switch case.
Differential Revision: https://reviews.llvm.org/D62596
llvm-svn: 362493
David Zarzycki [Tue, 4 Jun 2019 11:33:49 +0000 (11:33 +0000)]
Unbreak my hasty "unbreak" cmake fix
llvm-svn: 362492
Simon Pilgrim [Tue, 4 Jun 2019 11:31:45 +0000 (11:31 +0000)]
Fix -Wparentheses warning. NFCI.
llvm-svn: 362491
Peter Smith [Tue, 4 Jun 2019 11:28:22 +0000 (11:28 +0000)]
[AARCH64][ELF][llvm-readobj] Support for AArch64 .note.gnu.property
ELF for the 64-bit Arm Architecture defines a processor specific property
type GNU_PROPERTY_AARCH64_FEATURE_1_AND as GNU_PROPERTY_LOPROC. This
property works in a similar way to the existing X86 processor specific
property GNU_PROPERTY_GNU_X86_FEATURE_1_AND.
Two feature bits are defined for GNU_PROPERTY_AARCH64_FEATURE_1_AND:
- GNU_PROPERTY_AARCH64_FEATURE_1_BTI 0x1
- GNU_PROPERTY_AARCH64_FEATURE_1_PAC 0x2
This patch defines the property, feature bits and implements support for
printing in llvm-readobj.
Differential Revision: https://reviews.llvm.org/D62595
llvm-svn: 362490
Simon Pilgrim [Tue, 4 Jun 2019 11:11:51 +0000 (11:11 +0000)]
Fix Wshadow warning
llvm-svn: 362489
Roman Lebedev [Tue, 4 Jun 2019 11:06:21 +0000 (11:06 +0000)]
[DAGCombine][X86][AArch64][MIPS][LANAI] (C - x) - y -> C - (x + y) fold (PR41952)
Summary:
This *might* be the last fold for `sink-addsub-of-const.ll`, but i'm not sure yet.
As far as i can tell, there are no regressions here (ignoring x86-32),
all changes are either good or neutral.
This, almost surprisingly to me, fixes the motivational tests (in `shift-amount-mod.ll`)
`@reg32_lshr_by_sub_from_negated` from [[ https://bugs.llvm.org/show_bug.cgi?id=41952 | PR41952 ]].
https://rise4fun.com/Alive/vMd3
Reviewers: RKSimon, t.p.northover, craig.topper, spatel, efriedma
Reviewed By: RKSimon
Subscribers: sdardis, javed.absar, arichardson, kristof.beyls, jrtc27, atanasyan, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62774
llvm-svn: 362488
Roman Lebedev [Tue, 4 Jun 2019 11:06:08 +0000 (11:06 +0000)]
[DAGCombine][X86][AArch64][ARM] (C - x) + y -> (y - x) + C fold
Summary:
All changes except ARM look **great**.
https://rise4fun.com/Alive/R2M
The regression `test/CodeGen/ARM/addsubcarry-promotion.ll`
is recovered fully by D62392 + D62450.
Reviewers: RKSimon, craig.topper, spatel, rogfer01, efriedma
Reviewed By: efriedma
Subscribers: dmgreen, javed.absar, kristof.beyls, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62266
llvm-svn: 362487
Simon Pilgrim [Tue, 4 Jun 2019 10:49:06 +0000 (10:49 +0000)]
[SelectionDAG] ComputeNumSignBits - support constant pool values from target
As I mentioned on D61887 we don't get many hits on ComputeNumSignBits as we did on computeKnownBits.
The case we do get is interesting though - it allows us to use the 'ConditionalNegate' combine in combineLogicBlendIntoPBLENDV to remove a select.
It comes too late for SSE41 (BLENDV) cases, but SSE2 tests can hit it now. We should probably try to make use of this for SSE41+ targets as well - avoiding variable blends is usually a good idea. I'll investigate as a followup.
Differential Revision: https://reviews.llvm.org/D62777
llvm-svn: 362486
Simon Pilgrim [Tue, 4 Jun 2019 10:17:56 +0000 (10:17 +0000)]
[SelectionDAG] ComputeNumSignBits - clang-format + improve *EXTLOAD comments. NFCI.
Pre-commit requested for D62777.
llvm-svn: 362485
Owen Reynolds [Tue, 4 Jun 2019 10:13:03 +0000 (10:13 +0000)]
[llvm-ar] Reapply Fix relative thin archive path handling
Includes a fix for an introduced build failure due to a post c++11 use of std::mismatch.
This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command.
Differential Revision: https://reviews.llvm.org/D59491
llvm-svn: 362484
Simon Pilgrim [Tue, 4 Jun 2019 10:04:55 +0000 (10:04 +0000)]
[SelectionDAG] Add fpto[us]i(undef) --> undef constant fold
Follow up to D62807.
Differential Revision: https://reviews.llvm.org/D62811
llvm-svn: 362483
Mikhail Maltsev [Tue, 4 Jun 2019 09:39:55 +0000 (09:39 +0000)]
[ARM] Add FP16 vector insert/extract patterns
This change adds two FP16 extraction and two insertion patterns
(one per possible vector length).
Extractions are handled by copying a Q/D register into one of VFP2
class registers, where single FP32 sub-registers can be accessed. Then
the extraction of even lanes are simple sub-register extractions
(because we don't care about the top parts of registers for FP16
operations). Odd lanes need an additional VMOVX instruction.
Unfortunately, insertions cannot be handled in the same way, because:
* There is no instruction to insert FP16 into an even lane (VINS only
works with odd lanes)
* The patterns for odd lanes will have a form of a DAG (not a tree),
and will not be implementable in pure tablegen
Because of this insertions are handled in the same way as 16-bit
integer insertions (with conversions between FP registers and GPRs
using VMOVHR instructions).
Without these patterns the ARM backend would sometimes fail during
instruction selection.
This patch also adds patterns which combine:
* an FP16 element extraction and a store into a single VST1
instruction
* an FP16 load and insertion into a single VLD1 instruction
Differential Revision: https://reviews.llvm.org/D62651
llvm-svn: 362482
Ilya Biryukov [Tue, 4 Jun 2019 09:36:59 +0000 (09:36 +0000)]
[clangd] Support offsets for parameters in signatureHelp
Summary: Added to LSP in version 3.14
Reviewers: hokein
Reviewed By: hokein
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62476
llvm-svn: 362481
Dmitri Gribenko [Tue, 4 Jun 2019 09:31:07 +0000 (09:31 +0000)]
Silenced a warning "implicit conversion turns string literal into bool" introduced in r362473
llvm-svn: 362480
Ilya Biryukov [Tue, 4 Jun 2019 09:26:08 +0000 (09:26 +0000)]
[CodeComplete] Include more text into typed chunks of pattern completions
Summary:
To allow filtering on any of the words in the editors.
In particular, the following completions were changed:
- 'using namespace <#name#>'
Typed text before: 'using', after: 'using namespace'.
- 'else if (#<condition#>)'
Before: 'else', after: 'else if'.
- 'using typename <#qualifier#>::<#name#>'
Before: 'using', after: 'using typename'.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62615
llvm-svn: 362479
Eugene Leviant [Tue, 4 Jun 2019 09:20:02 +0000 (09:20 +0000)]
[HWASAN] Make new/delete weak
This allows instrumenting programs which have their own
versions of new and delete operators.
Differential revision: https://reviews.llvm.org/D62794
llvm-svn: 362478
Dmitri Gribenko [Tue, 4 Jun 2019 09:16:35 +0000 (09:16 +0000)]
Include what you use in PPC.h
llvm-svn: 362477
Dmitri Gribenko [Tue, 4 Jun 2019 09:16:31 +0000 (09:16 +0000)]
Include what you use in PPCMachineScheduler.cpp
llvm-svn: 362476
Dmitri Gribenko [Tue, 4 Jun 2019 09:13:08 +0000 (09:13 +0000)]
Include what you use in PPCRegisterInfo.h
llvm-svn: 362475
Eugene Leviant [Tue, 4 Jun 2019 09:04:53 +0000 (09:04 +0000)]
[HWASAN][CMake] Allow instrumenting LLVM/clang
Differential revision: https://reviews.llvm.org/D62813
llvm-svn: 362474
Yevgeny Rouban [Tue, 4 Jun 2019 09:03:39 +0000 (09:03 +0000)]
Make SwitchInstProfUpdateWrapper safer
While prof branch_weights inconsistencies are being fixed patch
by patch (pass by pass) we need SwitchInstProfUpdateWrapper to
be safe with respect to inconsistent metadata that can come from
passes that have not been fixed yet. See the bug found by @nikic
in https://reviews.llvm.org/D62126.
This patch introduces one more state (called Invalid) to the
wrapper class that allows users to work with the underlying
SwitchInst ignoring the prof metadata changes.
Created a unit test for the SwitchInstProfUpdateWrapper class.
Reviewers: davidx, nikic, eraman, reames, chandlerc
Reviewed By: davidx
Differential Revision: https://reviews.llvm.org/D62656
llvm-svn: 362473
QingShan Zhang [Tue, 4 Jun 2019 08:53:53 +0000 (08:53 +0000)]
[DAGCombine] Match a pattern where a wide type scalar value is stored by several narrow stores
This opportunity is found from spec 2017 557.xz_r. And it is used by the sha encrypt/decrypt. See sha-2/sha512.c
static void store64(u64 x, unsigned char* y)
{
for(int i = 0; i != 8; ++i)
y[i] = (x >> ((7-i) * 8)) & 255;
}
static u64 load64(const unsigned char* y)
{
u64 res = 0;
for(int i = 0; i != 8; ++i)
res |= (u64)(y[i]) << ((7-i) * 8);
return res;
}
The load64 has been implemented by https://reviews.llvm.org/D26149
This patch is trying to implement the store pattern.
Match a pattern where a wide type scalar value is stored by several narrow
stores. Fold it into a single store or a BSWAP and a store if the targets
supports it.
Assuming little endian target:
i8 *p = ...
i32 val = ...
p[0] = (val >> 0) & 0xFF;
p[1] = (val >> 8) & 0xFF;
p[2] = (val >> 16) & 0xFF;
p[3] = (val >> 24) & 0xFF;
>
*((i32)p) = val;
i8 *p = ...
i32 val = ...
p[0] = (val >> 24) & 0xFF;
p[1] = (val >> 16) & 0xFF;
p[2] = (val >> 8) & 0xFF;
p[3] = (val >> 0) & 0xFF;
>
*((i32)p) = BSWAP(val);
Differential Revision: https://reviews.llvm.org/D61843
llvm-svn: 362472
QingShan Zhang [Tue, 4 Jun 2019 08:45:07 +0000 (08:45 +0000)]
[NFC] Update the test to check the endianness after the CodeGenPrepare instead of checking the assembly instructions.
llvm-svn: 362471
Simon Tatham [Tue, 4 Jun 2019 08:28:48 +0000 (08:28 +0000)]
[ARM] Turn some undefined encoding bits into 0s.
The family of 32-bit Thumb instruction encodings that include t2ORR,
t2AND and t2EOR are all listed in the ArmARM as having (0) in bit 15.
The Tablegen descriptions of those instructions listed them as ?. This
change tightens that up by making them into 0 + Unpredictable.
In the specific case of t2ORR, we tighten it up still further by
making the zero bit mandatory. This change comes from Arm v8.1-M, in
which encodings with that bit equal to 1 will now be used for
different instructions.
Reviewers: dmgreen, samparker, SjoerdMeijer, efriedma
Reviewed By: dmgreen, efriedma
Subscribers: efriedma, javed.absar, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60705
llvm-svn: 362470
Ilya Biryukov [Tue, 4 Jun 2019 07:19:11 +0000 (07:19 +0000)]
[clangd] Fix a crash when clang-tidy is disabled
llvm-svn: 362469
Chen Zheng [Tue, 4 Jun 2019 06:48:14 +0000 (06:48 +0000)]
[PowerPC] add testcases for reordering LSR and PPCCTRLoops - NFC
llvm-svn: 362468
Nathan Ridge [Tue, 4 Jun 2019 04:25:44 +0000 (04:25 +0000)]
[clangd] SymbolCollector support for relations
Summary:
The only relation currently collected is RelationBaseOf, because this is
all we need for type hierarchy subtypes. Additional relations can be
collected in the future as the need arises.
This patch builds on D59407 and D62459.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62471
llvm-svn: 362467
Petr Hosek [Tue, 4 Jun 2019 02:38:15 +0000 (02:38 +0000)]
[builtins] Use libtool for builtins when building for Apple platform
compiler-rt already uses libtool instead of ar when building for
Apple platform, but that's not being used when builtins are being
built separately e.g. as part of the runtimes build. This change
extracts the logic setting up libtool into a separate file and uses
it from both the compiler-rt and standalone builtins build.
Differential Revision: https://reviews.llvm.org/D62820
llvm-svn: 362466
Marshall Clow [Tue, 4 Jun 2019 02:07:11 +0000 (02:07 +0000)]
We had a _LIBCPP_ASSERT commented out because gcc 4.9 didn't like it. We (LLVM) now require GCC 5.1, so that's not a problem any more. Re-enable the assertion. Fixes PR#36863
llvm-svn: 362465
Akira Hatanaka [Mon, 3 Jun 2019 23:48:14 +0000 (23:48 +0000)]
Add a release note entry for the change made in r362034.
llvm-svn: 362464
Alex Lorenz [Mon, 3 Jun 2019 23:17:21 +0000 (23:17 +0000)]
Fix windows build for commit r362459
llvm-svn: 362463
Eric Christopher [Mon, 3 Jun 2019 23:16:06 +0000 (23:16 +0000)]
Remove test/CodeGen/builtin-stackaddress.c as it duplicates
test/CodeGen/2004-02-13-BuiltinFrameReturnAddress.c.
Differential Revision: https://reviews.llvm.org/D62133
llvm-svn: 362462
Alex Langford [Mon, 3 Jun 2019 23:12:11 +0000 (23:12 +0000)]
[Target] Generalize some behavior in Target::SymbolsDidLoad
Summary:
SymbolsDidLoad is currently only implemented for ObjCLanguageRuntime,
but that doesn't mean that it couldn't be useful for other Langauges. Although
this change seems like it's generalizing for the sake of purity, this removes
Target's dependency on ObjCLanguageRuntime.
Differential Revision: https://reviews.llvm.org/D62796
llvm-svn: 362461
Roman Lebedev [Mon, 3 Jun 2019 23:00:51 +0000 (23:00 +0000)]
[NFC][X86] Fixup FileCheck prefixes - drop duplicates
llvm-svn: 362460
Alex Lorenz [Mon, 3 Jun 2019 22:59:17 +0000 (22:59 +0000)]
Add clang source minimizer that reduces source to directives
that might affect the dependency list for a compilation
This commit introduces a dependency directives source minimizer to clang
that minimizes header and source files to the minimum necessary preprocessor
directives for evaluating includes. It reduces the source down to #define, #include,
The source minimizer works by lexing the input with a custom fast lexer that recognizes
the preprocessor directives it cares about, and emitting those directives in the minimized source.
It ignores source code, comments, and normalizes whitespace. It gives up and fails if seems
any directives that it doesn't recognize as valid (e.g. #define 0).
In addition to the source minimizer this patch adds a
-print-dependency-directives-minimized-source CC1 option that allows you to invoke the minimizer
from clang directly.
Differential Revision: https://reviews.llvm.org/D55463
llvm-svn: 362459
Alex Langford [Mon, 3 Jun 2019 22:41:48 +0000 (22:41 +0000)]
[Target] Move ObjCLanguageRuntime::LookupRuntimeSymbol into LanguageRuntime
Summary:
LookupRuntimeSymbol seems like a general LanguageRuntime method.
Although no other language runtime currently implements this, there's no
reason another language runtime couldn't use this.
Additionally, this breaks IRExecutionUnit's dependency on
ObjCLanguageRuntime.
Reviewers: compnerd, labath, JDevlieghere, davide
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D62795
llvm-svn: 362458
Craig Topper [Mon, 3 Jun 2019 22:34:15 +0000 (22:34 +0000)]
[X86] Add test cases for 32 and 64 bit versions of PR42118. NFC
llvm-svn: 362457
Jason Molenda [Mon, 3 Jun 2019 22:34:12 +0000 (22:34 +0000)]
Add support for mid-function epilogues on x86 that end in a non-local jump.
The x86 assembly inspection engine has code to support detecting a
mid-function epilogue that ends in a RET instruction; add support for
recognizing an epilogue that ends in a JMP, and add a check that the
unwind state has been restored to the original stack setup; reinstate
the post-prologue unwind state after this JMP instruction.
The assembly inspection engine used for other architectures,
UnwindAssemblyInstEmulation, detects mid-function epilogues by
tracking branch instructions within the function and "forwards"
the current unwind state to the targets of the branches. If
an epilogue unwinds the stack and exits, followed by a branch
target, we get back to the correct unwind state. The x86
unwinder should move to this same algorithm, or possibly even
look at implementing an x86 instruction emulation plugin and
get UnwindAssemblyInstEmulation to work for x86 too. I added
a branch instruction recognizier method that will be necessary
if we want to switch the algorithm.
Differential Revision: https://reviews.llvm.org/D62764
<rdar://problem/
51074422>
llvm-svn: 362456
Roman Lebedev [Mon, 3 Jun 2019 22:30:18 +0000 (22:30 +0000)]
[NFC][Codegen] Add tests for hoisting and-by-const from "logical shift", when then eq-comparing with 0
This was initially reported as: https://reviews.llvm.org/D62818
https://rise4fun.com/Alive/oPH
llvm-svn: 362455
Jason Liu [Mon, 3 Jun 2019 22:22:03 +0000 (22:22 +0000)]
Fix DWARF DebugInfo unit test errors when cross-compiling
Summary:
When building with a Default Target set we can experience issues
in the DWARF DebugInfo unit tests because:
They assume we can generate object files for the host platform.
Some tests assume the endianess of the target we are generating
DWARF for and the host match.
This patch correct these issues by ensuring the tests which
generate objects in memory are run with respect to
LVM_DEFAULT_TARGET_TRIPLE and it's endianess.
We also make sure we don't use the hosts address size for line test
and split the triple util function in DwarfUtils into a version
that takes an address size and one that doesn't.
See also for discussion:
http://lists.llvm.org/pipermail/llvm-dev/2019-March/131212.html
Patch by: daltenty
Differential Revision: https://reviews.llvm.org/D62084
llvm-svn: 362454
Craig Topper [Mon, 3 Jun 2019 22:14:54 +0000 (22:14 +0000)]
Revert r362451 "foo" and r362452 "[X86] Add test cases for 32 and 64 bit versions of PR42118. NFC"
I failed to squash these properly
llvm-svn: 362453
Craig Topper [Mon, 3 Jun 2019 22:11:40 +0000 (22:11 +0000)]
[X86] Add test cases for 32 and 64 bit versions of PR42118. NFC
llvm-svn: 362452
Craig Topper [Mon, 3 Jun 2019 22:11:30 +0000 (22:11 +0000)]
foo
llvm-svn: 362451
Lang Hames [Mon, 3 Jun 2019 22:02:48 +0000 (22:02 +0000)]
[ORC] Use uint8_t for bitfields in SymbolTableEntry.
This allows for better struct packing on MSVC, and as a bonus will eliminate a
warning on GCC builds.
llvm-svn: 362450
Cameron McInally [Mon, 3 Jun 2019 21:53:56 +0000 (21:53 +0000)]
[SCCP] Add UnaryOperator visitor to SCCP for unary FNeg
Differential Revision: https://reviews.llvm.org/D62819
llvm-svn: 362449
Michael Berg [Mon, 3 Jun 2019 21:53:26 +0000 (21:53 +0000)]
Propagate fmf for setcc in SDAG for select folds
llvm-svn: 362448
Matt Arsenault [Mon, 3 Jun 2019 21:33:22 +0000 (21:33 +0000)]
AMDGPU: Disable stack realignment for kernels
This is something of a workaround, and the state of stack realignment
controls is kind of a mess. Ideally, we would be able to specify the
stack is infinitely aligned on entry to a kernel.
TargetFrameLowering provides multiple controls which apply at
different points. The StackRealignable field is used during
SelectionDAG, and for some reason distinct from this
hook. StackAlignment is a single field not dependent on the
function. It would probably be better to make that dependent on the
calling convention, and the maximum value for kernels.
Currently this doesn't really change anything, since the frame
lowering mostly does its own thing. This helps avoid regressions in a
future change which will rely more heavily on hasFP.
llvm-svn: 362447
Jessica Paquette [Mon, 3 Jun 2019 20:47:20 +0000 (20:47 +0000)]
[AArch64][GlobalISel] Optimize G_FCMP + G_SELECT pairs when G_SELECT is fp
Instead of emitting all of the test stuff for a compare when it's only used by
a select, instead, just emit the compare + select. The select will use the
value of NZCV correctly, so we don't need to emit all of the test instructions
etc.
For now, only support fp selects which use G_FCMP. Also only support condition
codes which will only require one select to represent.
Also add a test.
Differential Revision: https://reviews.llvm.org/D62695
llvm-svn: 362446
Peter Collingbourne [Mon, 3 Jun 2019 20:40:07 +0000 (20:40 +0000)]
gn build: Merge r361896.
llvm-svn: 362445
Peter Collingbourne [Mon, 3 Jun 2019 20:14:25 +0000 (20:14 +0000)]
ELF: Introduce a separate bit for tracking whether an output section has ever had an input section added to it. NFCI.
We currently (ab)use the Live bit on output sections to track whether
the section has ever had an input section added to it, and then later
use it during orphan placement. This will conflict with one of my upcoming
partition-related changes that will assign all output sections to a partition
(thus marking them as live) so that they can be added to the correct segment
by the code that creates program headers.
Instead of using the Live bit for this purpose, create a new flag and
start using it to track the property explicitly.
Differential Revision: https://reviews.llvm.org/D62348
llvm-svn: 362444
Erich Keane [Mon, 3 Jun 2019 19:57:52 +0000 (19:57 +0000)]
Fix test failure from r362435
Apparently I forgot to do an open brace in a namespace, so we get an
error about an extra closing brace.
llvm-svn: 362443
George Burgess IV [Mon, 3 Jun 2019 19:56:22 +0000 (19:56 +0000)]
CFLAA: reflow comments; NFC
llvm-svn: 362442
Craig Topper [Mon, 3 Jun 2019 19:35:52 +0000 (19:35 +0000)]
[CFLGraph] Add FAdd to visitConstantExpr.
This looks like an oversight as all the other binary operators are present.
Accidentally noticed while auditing places that need FNeg handling.
No test because as noted in the review it would be contrived and amount to "don't crash"
Differential Revision: https://reviews.llvm.org/D62790
llvm-svn: 362441
Craig Topper [Mon, 3 Jun 2019 19:29:14 +0000 (19:29 +0000)]
[X86] Fix the pattern for merge masked vcvtps2pd.
r362199 fixed it for zero masking, but not zero masking. The load
folding in the peephole pass hid the bug. This patch turns off
the peephole pass on the relevant test to ensure coverage.
llvm-svn: 362440
Michael Berg [Mon, 3 Jun 2019 19:12:15 +0000 (19:12 +0000)]
Propagate fmf for setcc/select folds
Summary: This change facilitates propagating fmf which was placed on setcc from fcmp through folds with selects so that back ends can model this path for arithmetic folds on selects in SDAG.
Reviewers: qcolombet, spatel
Reviewed By: qcolombet
Subscribers: nemanjai, jsji
Differential Revision: https://reviews.llvm.org/D62552
llvm-svn: 362439
Nemanja Ivanovic [Mon, 3 Jun 2019 19:09:15 +0000 (19:09 +0000)]
[PowerPC] Look through copies for compare elimination
We currently miss the opportunities for optmizing comparisons in the peephole
optimizer if the input is the result of a COPY since we look for record-form
versions of the producing instruction.
This patch simply lets the optimization peek through copies.
Differential revision: https://reviews.llvm.org/D59633
llvm-svn: 362438
Alexandre Ganea [Mon, 3 Jun 2019 18:46:30 +0000 (18:46 +0000)]
Silence 'warning C4305: 'initializing': truncation from 'double' to 'float'' with MSVC 19.16.27021.1 (VS2017 15.9.12)
llvm-svn: 362437
Matt Arsenault [Mon, 3 Jun 2019 18:41:34 +0000 (18:41 +0000)]
TTI: Improve default costs for addrspacecast
For some reason multiple places need to do this, and the variant the
loop unroller and inliner use was not handling it.
Also, introduce a new wrapper to be slightly more precise, since on
AMDGPU some addrspacecasts are free, but not no-ops.
llvm-svn: 362436
Erich Keane [Mon, 3 Jun 2019 18:36:33 +0000 (18:36 +0000)]
Make NoThrow FunctionLike, make FunctionLike include references, fix
prettyprint
__declspec(nothrow) should work on function pointers as well as function
references, so this changes it to FunctionLike. Additionally,
FunctionLike needed to be modified to permit function references.
Finally, the TypePrinter didn't properly print the NoThrow exception
specifier, so make sure we get that right as well.
llvm-svn: 362435