Richard Smith [Mon, 30 Jul 2018 18:05:19 +0000 (18:05 +0000)]
Delete some unreachable AST printing code.
llvm-svn: 338282
Jonathan Peyton [Mon, 30 Jul 2018 17:50:35 +0000 (17:50 +0000)]
[OpenMP] Add GOMP version symbols for OMP_4.5 API
This patch adds the appropriate version symbols to the relevant API functions
Differential Revision: https://reviews.llvm.org/D49859
llvm-svn: 338281
Jonathan Peyton [Mon, 30 Jul 2018 17:48:33 +0000 (17:48 +0000)]
[OpenMP] Implement GOMP doacross compatibility
This change introduces GOMP doacross compatibility. There are 12 new interface
functions 6 for long type and 6 for unsigned long long type:
GOMP_doacross_post, GOMP_doacross_wait, GOMP_loop_doacross_[schedule]_start
where schedule can be static, dynamic, guided, or runtime.
These functions just translate the parameters if necessary and send them
to the corresponding kmp function.
E.g., GOMP_doacross_post() -> __kmpc_doacross_post()
For the GOMP_doacross_post function, there is template specialization to
account for when long is a four byte vs an eight byte type. If it is a
four byte type, then a temporary array has to be created to convert the
four byte integers into eight byte integers and then sending that into
__kmpc_doacross_post(). Because GOMP_doacross_wait uses varargs, it
always needs a temporary array and does not need template specialization.
Differential Revision: https://reviews.llvm.org/D49857
llvm-svn: 338280
Momchil Velikov [Mon, 30 Jul 2018 17:48:23 +0000 (17:48 +0000)]
[ARM, AArch64]: Use unadjusted alignment when passing composites as arguments
The "Procedure Call Procedure Call Standard for the ARMĀ® Architecture"
(https://static.docs.arm.com/ihi0042/f/IHI0042F_aapcs.pdf), specifies that
composite types are passed according to their "natural alignment", i.e. the
alignment before alignment adjustment on the entire composite is applied.
The same applies for AArch64 ABI.
Clang, however, used the adjusted alignment.
GCC already implements the ABI correctly. With this patch Clang becomes
compatible with GCC and passes such arguments in accordance with AAPCS.
Differential Revision: https://reviews.llvm.org/D46013
llvm-svn: 338279
Jessica Paquette [Mon, 30 Jul 2018 17:45:28 +0000 (17:45 +0000)]
[MachineOutliner][AArch64] Add support for saving LR to a register
This teaches the outliner to save LR to a register rather than the stack when
possible. This allows us to avoid bumping the stack in outlined functions in
some cases. By doing this, in a later patch, we can teach the outliner to do
something like this:
f1:
...
bl OUTLINED_FUNCTION
...
f2:
...
move LR's contents to a register
bl OUTLINED_FUNCTION
move the register's contents back
instead of falling back to saving LR in both cases.
llvm-svn: 338278
Jonathan Peyton [Mon, 30 Jul 2018 17:45:23 +0000 (17:45 +0000)]
[OpenMP] Fix build errors when building with KMP_DEBUG_ADAPTIVE_LOCKS=1
This change fixes build errors when building a runtime with adaptive lock stats
enabled. Most of the errors were due to the recent changes in the runtime, but
it seems that we have not tried to build this debug runtime on Windows for a
long time.
Patch by Hansang Bae
Differential Revision: https://reviews.llvm.org/D49823
llvm-svn: 338277
Jonathan Peyton [Mon, 30 Jul 2018 17:41:08 +0000 (17:41 +0000)]
[OpenMP][Stats] Cleanup stats gathering code
1) Remove unnecessary data from list node structure
2) Remove timerPair in favor of pushing/popping explicitTimers.
This way, nested timers will work properly.
3) Fix #pragma omp critical timers
4) Add histogram capability
5) Add KMP_STATS_FILE formatting capability
6) Have time partitioned into serial & parallel by introducing
partitionedTimers::exchange(). This also counts the number of serial regions
in the executable.
7) Fix up the timers around OMP loops so that scheduling overhead and work are
both counted correctly.
8) Fix up the iterations statistics so they count the number of iterations the
thread receives at each loop scheduling event
9) Change timers so there is only one RDTSC read per event change
10) Fix up the outdated comments for the timers
Differential Revision: https://reviews.llvm.org/D49699
llvm-svn: 338276
Fangrui Song [Mon, 30 Jul 2018 17:36:38 +0000 (17:36 +0000)]
[docs] Update ld.lld.1
llvm-svn: 338275
Craig Topper [Mon, 30 Jul 2018 17:34:31 +0000 (17:34 +0000)]
[X86] Fix typo in comment. NFC
llvm-svn: 338274
Craig Topper [Mon, 30 Jul 2018 17:29:57 +0000 (17:29 +0000)]
Recommit r338204 "[X86] Correct the immediate cost for 'add/sub i64 %x, 0x80000000'."
This checks in a more direct way without triggering a UBSAN error.
llvm-svn: 338273
Jessica Paquette [Mon, 30 Jul 2018 17:13:25 +0000 (17:13 +0000)]
Add machine verifier to arm64-opt-remarks-lazy-bfi
Previously, I thought this was a Windows failure. Then I realized it failed on
every bot that used the verifier. This makes it use the verifier always, and
adds that pass to the pipeline checks so that it's consistent across all bots.
llvm-svn: 338272
David Bolvansky [Mon, 30 Jul 2018 17:02:46 +0000 (17:02 +0000)]
[AArch64] Support execute-only LOAD segments.
Summary:
This adds an LLD flag to mark executable LOAD segments execute-only for AArch64 targets.
In AArch64 the expectation is that code is execute-only compatible, so this just adds a linker option to enforce this.
Patch by: ivanlozano (Ivan Lozano)
Reviewers: srhines, echristo, peter.smith, eugenis, javed.absar, espindola, ruiu
Reviewed By: ruiu
Subscribers: dokyungs, emaste, arichardson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D49456
llvm-svn: 338271
David Bolvansky [Mon, 30 Jul 2018 16:50:00 +0000 (16:50 +0000)]
[DAGCombiner] Bug 31275- Extract a shift from a constant mul or udiv if a rotate can be formed
Summary:
Attempt to extract a shrl from a udiv or a shl from a mul if this allows a rotate to be formed. This targets cases where the input to a rotate pattern was a mul or udiv by a constant and InstCombine merged one of the shifts with the op.
Patch by: sameconrad (Sam Conrad)
Reviewers: RKSimon, craig.topper, spatel, lebedev.ri, javed.absar
Reviewed By: lebedev.ri
Subscribers: efriedma, kparzysz, llvm-commits
Differential Revision: https://reviews.llvm.org/D47681
llvm-svn: 338270
Thomas Preud'homme [Mon, 30 Jul 2018 16:48:39 +0000 (16:48 +0000)]
Reapply "Fix crash on inline asm with 64bit matching input in 32bit GPR"
This reapplies commit r338206 reverted by r338214 since the bug that
r338206 uncovered has been fixed in r338268.
Add support for inline assembly with matching input operand that do not
naturally go in the register class it is constrained to (eg. double in a
32-bit GPR). Note that regular input is already handled by existing
code.
llvm-svn: 338269
Thomas Preud'homme [Mon, 30 Jul 2018 16:45:40 +0000 (16:45 +0000)]
Fix uninitialized read in ARM's PrintAsmOperand
Summary:
Fix read of uninitialized RC variable in ARM's PrintAsmOperand when
hasRegClassConstraint returns false. This was causing
inline-asm-operand-implicit-cast test to fail in r338206.
Reviewers: t.p.northover, weimingz, javed.absar, chill
Reviewed By: chill
Subscribers: chill, eraman, kristof.beyls, chrib, llvm-commits
Differential Revision: https://reviews.llvm.org/D49984
llvm-svn: 338268
Jessica Paquette [Mon, 30 Jul 2018 16:36:22 +0000 (16:36 +0000)]
Attempt to fix Windows test failure caused by r338133
It seems like the pass pipeline on Windows is slightly different than on Linux
and macOS. As a result, the arm64-opt-remarks-lazy-bfi test has been failing.
This switches a CHECK-NEXT to a CHECK-DAG to try and get this running properly
again.
It'd be nice to switch it back to a CHECK-NEXT if possible, but the CHECK-NEXT
lines following the line we care about (the optimization remark emitter)
do a pretty good job of enforcing the ordering we want.
Hopefully this works, since I don't have a Windows machine. ;)
Example failure: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/11295
llvm-svn: 338267
Evandro Menezes [Mon, 30 Jul 2018 16:20:04 +0000 (16:20 +0000)]
[SLC] Refactor the simplication of pow() (NFC)
Use more meaningful variable names. Mostly NFC.
llvm-svn: 338266
Simon Pilgrim [Mon, 30 Jul 2018 16:18:38 +0000 (16:18 +0000)]
[X86] Regenerate NOBMI/BMI combine-select tests.
Test cleanup for D38128
llvm-svn: 338265
Simon Pilgrim [Mon, 30 Jul 2018 16:15:18 +0000 (16:15 +0000)]
[X86] Regenerate PKU test to merge 32/64-bit rdpkru checks
Test cleanup for D38128
llvm-svn: 338264
Reka Kovacs [Mon, 30 Jul 2018 16:14:59 +0000 (16:14 +0000)]
[analyzer] Add missing state transition in IteratorChecker.
After cleaning up program state maps in `checkDeadSymbols()`,
a transition should be added to generate the new state.
Differential Revision: https://reviews.llvm.org/D47417
llvm-svn: 338263
Simon Pilgrim [Mon, 30 Jul 2018 16:13:40 +0000 (16:13 +0000)]
[X86] Regenerate fast-isel tests.
Test cleanup for D38128
llvm-svn: 338262
Sander de Smalen [Mon, 30 Jul 2018 16:05:45 +0000 (16:05 +0000)]
[AArch64][SVE] Asm: Enable instructions to be prefixed.
This patch enables instructions that are destructive on their
destination- and first source operand, to be prefixed with a
MOVPRFX instruction.
This patch also adds a variety of tests:
- positive tests for all instructions and forms that accept a
movprfx for either or both predicated and unpredicated forms.
- negative tests for all instructions and forms that do not accept
an unpredicated or predicated movprfx.
- negative tests for the diagnostics that get emitted when a MOVPRFX
instruction is used incorrectly.
This is patch [2/2] in a series to add MOVPRFX instructions:
- Patch [1/2]: https://reviews.llvm.org/D49592
- Patch [2/2]: https://reviews.llvm.org/D49593
Reviewers: rengolin, SjoerdMeijer, samparker, fhahn, javed.absar
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D49593
llvm-svn: 338261
Ilya Biryukov [Mon, 30 Jul 2018 15:55:13 +0000 (15:55 +0000)]
[clangd] Remove outdated comment. NFC
llvm-svn: 338260
Reka Kovacs [Mon, 30 Jul 2018 15:43:45 +0000 (15:43 +0000)]
[analyzer] Add support for more invalidating functions in InnerPointerChecker.
According to the standard, pointers referring to the elements of a
`basic_string` may be invalidated if they are used as an argument to
any standard library function taking a reference to non-const
`basic_string` as an argument. This patch makes InnerPointerChecker warn
for these cases.
Differential Revision: https://reviews.llvm.org/D49656
llvm-svn: 338259
Sander de Smalen [Mon, 30 Jul 2018 15:42:46 +0000 (15:42 +0000)]
[AArch64][SVE] Asm: Add MOVPRFX instructions.
This patch adds predicated and unpredicated MOVPRFX instructions, which
can be prepended to SVE instructions that are destructive on their first
source operand, to make them a constructive operation, e.g.
add z1.s, p0/m, z1.s, z2.s <=> z1 = z1 + z2
can be made constructive:
movprfx z0, z1
add z0.s, p0/m, z0.s, z2.s <=> z0 = z1 + z2
The predicated MOVPRFX instruction can additionally be used to zero
inactive elements, e.g.
movprfx z0.s, p0/z, z1.s
add z0.s, p0/m, z0.s, z2.s
Not all instructions can be prefixed with the MOVPRFX instruction
which is why this patch also adds a mechanism to validate prefixed
instructions. The exact rules when a MOVPRFX applies is detailed in
the SVE supplement of the Architectural Reference Manual.
This is patch [1/2] in a series to add MOVPRFX instructions:
- Patch [1/2]: https://reviews.llvm.org/D49592
- Patch [2/2]: https://reviews.llvm.org/D49593
Reviewers: rengolin, SjoerdMeijer, samparker, fhahn, javed.absar
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D49592
llvm-svn: 338258
David Bolvansky [Mon, 30 Jul 2018 15:38:42 +0000 (15:38 +0000)]
[InstCombine] [NFC] Added tests for Select with binop fold
llvm-svn: 338257
Ilya Biryukov [Mon, 30 Jul 2018 15:30:45 +0000 (15:30 +0000)]
[clangd] Do not remove AST from cache if nothing changed
We were previously clearing the AST cache if the inputs and the
preamble were the same, which is not desired.
llvm-svn: 338256
Ilya Biryukov [Mon, 30 Jul 2018 15:19:05 +0000 (15:19 +0000)]
[CodeComplete] Fix the crash in code completion on access checking
Started crashing in r337453. See the added test case for the crash repro.
The fix reverts part of r337453 that causes the crash and does
not actually break anything when reverted.
llvm-svn: 338255
Joel Galenson [Mon, 30 Jul 2018 15:14:24 +0000 (15:14 +0000)]
[doc] Fix Getting Started typo.
This makes it easier for someone to copy-paste this line, change the path, and run the command.
Differential Revision: https://reviews.llvm.org/D49201
llvm-svn: 338254
Alexey Bataev [Mon, 30 Jul 2018 14:44:29 +0000 (14:44 +0000)]
[OPENMP] Modify the info about OpenMP support in UsersManual, NFC.
llvm-svn: 338252
Krzysztof Parzyszek [Mon, 30 Jul 2018 14:28:02 +0000 (14:28 +0000)]
[Hexagon] Simplify A4_rcmp[n]eqi R, 0
Consider cases when register R is known to be zero/non-zero, or when it
is defined by a C2_muxii instruction.
llvm-svn: 338251
John Brawn [Mon, 30 Jul 2018 14:26:24 +0000 (14:26 +0000)]
Adjust opt pass pipeline tests to cope with combination of r338240 and r338242
The combination of r338240 and r338242 causes the opt pass pipeline tests to
fail because of how r338242 makes BasicAA be invalidated more often. Adjust the
tests to reflect this.
llvm-svn: 338250
George Rimar [Mon, 30 Jul 2018 12:39:54 +0000 (12:39 +0000)]
[ELF] - Implement SHT_SYMTAB_SHNDX (.symtab_shndxr) section.
This is relative to https://bugs.llvm.org//show_bug.cgi?id=38119.
SHT_SYMTAB section is able to keep symbols with output section indices
up to 0xff00 (SHN_LORESERVE). But if we have indices that are greater
than that (PR shows that it might happen), we need to use
SHT_SYMTAB_SHNDX extended section. It was not supported by LLD.
Description of the SHT_SYMTAB_SHNDX section is here:
https://docs.oracle.com/cd/E19683-01/817-3677/chapter6-94076/index.html.
Differential revision: https://reviews.llvm.org/D49541
llvm-svn: 338247
Stefan Maksimovic [Mon, 30 Jul 2018 12:27:40 +0000 (12:27 +0000)]
[mips64][clang] Adjust tests to account for changes in r338239
llvm-svn: 338246
Krasimir Georgiev [Mon, 30 Jul 2018 12:22:41 +0000 (12:22 +0000)]
[clang-format] Silence -Wdocumentation warnings
introduced in r338232
llvm-svn: 338245
Matt Arsenault [Mon, 30 Jul 2018 12:16:58 +0000 (12:16 +0000)]
AMDGPU: Reduce code size with fcanonicalize (fneg x)
When fcanonicalize is lowered to a mul, we can
use -1.0 for free and avoid the cost of the bigger
encoding for source modifers.
llvm-svn: 338244
Matt Arsenault [Mon, 30 Jul 2018 12:16:47 +0000 (12:16 +0000)]
AMDGPU: Make fneg combine handle fcanonicalize
llvm-svn: 338243
John Brawn [Mon, 30 Jul 2018 11:52:08 +0000 (11:52 +0000)]
[BasicAA] Use PhiValuesAnalysis if available when handling phi alias
By using PhiValuesAnalysis we can get all the values reachable from a phi, so
we can be more precise instead of giving up when a phi has phi operands. We
can't make BaseicAA directly use PhiValuesAnalysis though, as the user of
BasicAA may modify the function in ways that PhiValuesAnalysis can't cope with.
For this optional usage to work correctly BasicAAWrapperPass now needs to be not
marked as CFG-only (i.e. it is now invalidated even when CFG is preserved) due
to how the legacy pass manager handles dependent passes being invalidated,
namely the depending pass still has a pointer to the now-dead dependent pass.
Differential Revision: https://reviews.llvm.org/D44564
llvm-svn: 338242
Ilya Biryukov [Mon, 30 Jul 2018 11:46:25 +0000 (11:46 +0000)]
[clangd] Fix a comment. NFC
llvm-svn: 338241
Alexandros Lamprineas [Mon, 30 Jul 2018 10:50:18 +0000 (10:50 +0000)]
[GVNHoist] Re-enable GVNHoist by default
My initial motivation for this came from https://reviews.llvm.org/D48122,
where it was pointed out that my change didn't fit well in SimplifyCFG and
therefore using GVNHoist was a better way to go. GVNHoist has been disabled
for a while as there was a list of bugs related to it.
I have fixed the following bugs:
https://bugs.llvm.org/show_bug.cgi?id=37808 -> https://reviews.llvm.org/D48372 (rL337149)
https://bugs.llvm.org/show_bug.cgi?id=36787 -> https://reviews.llvm.org/D49555 (rL337674)
https://bugs.llvm.org/show_bug.cgi?id=37445 -> https://reviews.llvm.org/D49425 (rL337680)
The next two bugs no longer occur, and it's unclear which commit fixed them:
https://bugs.llvm.org/show_bug.cgi?id=36635
https://bugs.llvm.org/show_bug.cgi?id=37791
I investigated this one and proved to be unrelated to GVNHoist, but a genuine bug in NewGvn:
https://bugs.llvm.org/show_bug.cgi?id=37660
To convince myself GVNHoist is in a good state I made a successful bootstrap build of LLVM.
Merging this change now in order to make it to the LLVM 7.0.0 branch.
Differential Revision: https://reviews.llvm.org/D49858
llvm-svn: 338240
Stefan Maksimovic [Mon, 30 Jul 2018 10:44:46 +0000 (10:44 +0000)]
[mips64][clang] Provide the signext attribute for i32 return values
Additional info: see r338019.
Differential Revision: https://reviews.llvm.org/D49289
llvm-svn: 338239
Simon Pilgrim [Mon, 30 Jul 2018 10:07:47 +0000 (10:07 +0000)]
Fix -Wdocumentation warning. NFCI.
llvm-svn: 338238
Francis Visoiu Mistrih [Mon, 30 Jul 2018 09:59:33 +0000 (09:59 +0000)]
[MachineOutliner][X86] Use TAILJMPd64 instead of JMP_1 for TailCall construction
The machine verifier asserts with:
Assertion failed: (isMBB() && "Wrong MachineOperand accessor"), function getMBB, file ../include/llvm/CodeGen/MachineOperand.h, line 542.
It calls analyzeBranch which tries to call getMBB if the opcode is
JMP_1, but in this case we do:
JMP_1 @OUTLINED_FUNCTION
I believe we have to use TAILJMPd64 instead of JMP_1 since JMP_1 is used
with brtarget8.
Differential Revision: https://reviews.llvm.org/D49299
llvm-svn: 338237
Dean Michael Berris [Mon, 30 Jul 2018 09:45:09 +0000 (09:45 +0000)]
Revert "[X86] Correct the immediate cost for 'add/sub i64 %x, 0x80000000'."
This reverts commit r338204.
llvm-svn: 338236
Nicolai Haehnle [Mon, 30 Jul 2018 09:23:59 +0000 (09:23 +0000)]
AMDGPU: Force skip over s_sendmsg and exp instructions
Summary:
These instructions interact with hardware blocks outside the shader core,
and they can have "scalar" side effects even when EXEC = 0. We don't
want these scalar side effects to occur when all lanes want to skip
these instructions, so always add the execz skip branch instruction
for basic blocks that contain them.
Also ensure that we skip scalar stores / atomics, though we don't
code-gen those yet.
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D48431
Change-Id: Ieaeb58352e2789ffd64745603c14970c60819d44
llvm-svn: 338235
Adam Balogh [Mon, 30 Jul 2018 08:52:21 +0000 (08:52 +0000)]
[Analyzer] Iterator Checker Hotfix: Defer deletion of container data until its last iterator is cleaned up
The analyzer may consider a container region as dead while it still has live
iterators. We must defer deletion of the data belonging to such containers
until all its iterators are dead as well to be able to compare the iterator
to the begin and the end of the container which is stored in the container
data.
Differential Revision: https://reviews.llvm.org/D48427
llvm-svn: 338234
Petr Pavlu [Mon, 30 Jul 2018 08:49:30 +0000 (08:49 +0000)]
[ARM] Fix over-alignment in arguments that are HA of 128-bit vectors
Code in `CC_ARM_AAPCS_Custom_Aggregate()` is responsible for handling
homogeneous aggregates for `CC_ARM_AAPCS_VFP`. When an aggregate ends up
fully on stack, the function tries to pack all resulting items of the
aggregate as tightly as possible according to AAPCS.
Once the first item was laid out, the alignment used for consecutive
items was the size of one item. This logic went wrong for 128-bit
vectors because their alignment is normally only 64 bits, and so could
result in inserting unexpected padding between the first and second
element.
The patch fixes the problem by updating the alignment with the item size
only if this results in reducing it.
Differential Revision: https://reviews.llvm.org/D49720
llvm-svn: 338233
Krasimir Georgiev [Mon, 30 Jul 2018 08:45:45 +0000 (08:45 +0000)]
[clang-format] Indent after breaking Javadoc annotated line
Summary:
This patch makes clang-format indent the subsequent lines created by breaking a
long javadoc annotated line.
Reviewers: mprobst
Reviewed By: mprobst
Subscribers: acoomans, cfe-commits
Differential Revision: https://reviews.llvm.org/D49797
llvm-svn: 338232
Karl-Johan Karlsson [Mon, 30 Jul 2018 08:17:00 +0000 (08:17 +0000)]
[RegisterScavenger] Fix debug print
llvm-svn: 338231
Richard Smith [Mon, 30 Jul 2018 07:19:54 +0000 (07:19 +0000)]
PR38355 Prevent infinite recursion when checking initializer lifetime if
an initializer is self-referential.
llvm-svn: 338230
Max Kazantsev [Mon, 30 Jul 2018 07:07:32 +0000 (07:07 +0000)]
[NFC] Prepare GuardWidening for widening of cond branches
llvm-svn: 338229
Dean Michael Berris [Mon, 30 Jul 2018 05:56:42 +0000 (05:56 +0000)]
[XRay][compiler-rt] FDR Mode: Use mmap instead of internal allocator
Summary:
This change moves FDR mode to use `internal_mmap(...)` from
sanitizer_common instead of the internal allocator interface. We're
doing this to sidestep the alignment issues we encounter with the
`InternalAlloc(...)` functions returning pointers that have some magic
bytes at the beginning.
XRay copies bytes into the buffer memory, and does not require the magic
bytes tracking the other sanitizers use when allocating/deallocating
buffers.
Reviewers: kpw, eizan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49972
llvm-svn: 338228
Zachary Turner [Mon, 30 Jul 2018 03:25:27 +0000 (03:25 +0000)]
Try to fix build.
llvm-svn: 338227
Zachary Turner [Mon, 30 Jul 2018 03:12:34 +0000 (03:12 +0000)]
[MS Demangler] Demangle symbols in function scopes.
There are a couple of issues you run into when you start getting into
more complex names, especially with regards to function local statics.
When you've got something like:
int x() {
static int n = 0;
return n;
}
Then this needs to demangle to something like
int `int __cdecl x()'::`1'::n
The nested mangled symbols (e.g. `int __cdecl x()` in the above
example) also share state with regards to back-referencing, so
we need to be able to re-use the demangler in the middle of
demangling a symbol while sharing back-ref state.
To make matters more complicated, there are a lot of ambiguities
when demangling a symbol's qualified name, because a function local
scope pattern (usually something like `?1??name?`) looks suspiciously
like many other possible things that can occur, such as `?1` meaning
the second back-ref and disambiguating these cases is rather
interesting. The `?1?` in a local scope pattern is actually a special
case of the more general pattern of `? + <encoded number> + ?`, where
"encoded number" can itself have embedded `@` symbols, which is a
common delimeter in mangled names. So we have to take care during the
disambiguation, which is the reason for the overly complicated
`isLocalScopePattern` function in this patch.
I've added some pretty obnoxious tests to exercise all of this, which
exposed several other problems related to back-referencing, so those
are fixed here as well. Finally, I've uncommented some tests that were
previously marked as `FIXME`, since now these work.
Differential Revision: https://reviews.llvm.org/D49965
llvm-svn: 338226
Fangrui Song [Mon, 30 Jul 2018 00:25:16 +0000 (00:25 +0000)]
[asan] Fix typo
llvm-svn: 338225
Jan Kratochvil [Sun, 29 Jul 2018 19:32:36 +0000 (19:32 +0000)]
Remove friend class declarations from DWARFUnit and DWARFCompileUnit
They are no longer needed since D45170.
llvm-svn: 338224
Raoul Wols [Sun, 29 Jul 2018 19:12:42 +0000 (19:12 +0000)]
[clangd] Add command-line option
to suppress the space and the circular dot prepended in a completion label.
llvm-svn: 338223
Craig Topper [Sun, 29 Jul 2018 18:39:26 +0000 (18:39 +0000)]
[DAGCombiner] Remove unnecessary calls to AddToWorklist.
The DAGCombiner has a mechanism for ensuring all nodes have been visited at least once. Every time a node is visited, it makes sure its operands have been in the worklist at least once. This ensures that when multiple nodes are created by a combine, only the last node needs to be returned. The earlier nodes can all be found Through this operand check. These means we don't need to explicitly add nodes to the worklist when a combine creates multiple nodes.
I've removed the most obvious cases here. There are probably more than can be removed.
llvm-svn: 338222
Sanjay Patel [Sun, 29 Jul 2018 18:13:16 +0000 (18:13 +0000)]
[InstCombine] try to fold 'add+sub' to 'not+add'
These are reassociated versions of the same pattern and
similar transforms as in rL338200 and rL338118.
The motivation is identical to those commits:
Patterns with add/sub combos can be improved using
'not' ops. This is better for analysis and may lead
to follow-on transforms because 'xor' and 'add' are
commutative/associative. It can also help codegen.
llvm-svn: 338221
Sanjay Patel [Sun, 29 Jul 2018 18:07:28 +0000 (18:07 +0000)]
[InstCombine] add tests for another sub-not variant; NFC
llvm-svn: 338220
Zachary Turner [Sun, 29 Jul 2018 16:38:02 +0000 (16:38 +0000)]
[MS Demangler] NFC - Remove state from Demangler class.
We need to be able to initiate a nested demangling from inside
of an "outer" demangling. These need to be able to share some
state, such as back-references. As a result, we can't store
things like the output stream or the mangled name in the Demangler
class, since each demangling will have different values. So
remove this state and pass it through the necessary methods.
llvm-svn: 338219
Sanjay Patel [Sun, 29 Jul 2018 16:36:38 +0000 (16:36 +0000)]
[InstSimplify] fold funnel shifts with 0-shift amount
llvm-svn: 338218
Sanjay Patel [Sun, 29 Jul 2018 16:27:17 +0000 (16:27 +0000)]
[InstSimplify] add tests for funnel shift intrinsics; NFC
llvm-svn: 338217
Jonas Devlieghere [Sun, 29 Jul 2018 14:56:15 +0000 (14:56 +0000)]
[dsymutil] Simplify temporary file handling.
Dsymutil's update functionality was broken on Windows because we tried
to rename a file while we're holding open handles to that file. TempFile
provides a solution for this through its keep(Twine) method. This patch
changes dsymutil to make use of that functionality.
Differential revision: https://reviews.llvm.org/D49860
llvm-svn: 338216
Sanjay Patel [Sun, 29 Jul 2018 14:42:08 +0000 (14:42 +0000)]
[InstSimplify] refactor intrinsic simplifications; NFCI
llvm-svn: 338215
Sanjay Patel [Sun, 29 Jul 2018 14:30:49 +0000 (14:30 +0000)]
revert r338206 because the test does not pass
Example of bot failure:
http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/5107/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Ainline-asm-operand-implicit-cast.ll
llvm-svn: 338214
Sid Manning [Sun, 29 Jul 2018 11:59:38 +0000 (11:59 +0000)]
[ELF][HEXAGON] Add R_HEX_32_6_X and R_HEX_12_X
And add a test.
llvm-svn: 338213
Dylan McKay [Sun, 29 Jul 2018 11:38:36 +0000 (11:38 +0000)]
[AVR] Re-enable expansion of ADDE/ADDC/SUBE/SUBC in ISel
This was disabled in r333748, which broke four tests.
In the future, these need to be updated to UADDO/ADDCARRY or
USUBO/SUBCARRY.
llvm-svn: 338212
Sander de Smalen [Sun, 29 Jul 2018 08:51:08 +0000 (08:51 +0000)]
[AArch64][SVE] Asm: Support for WHILE(LE|LO|LS|LT) instructions.
The WHILE instructions generate a predicate that is true while the
comparison of the first scalar operand (incremented for each predicate
element) with the second scalar operand is true and false thereafter.
WHILELE While incrementing signed scalar less than or equal to scalar
WHILELO While incrementing unsigned scalar lower than scalar
WHILELS While incrementing unsigned scalar lower than or same as scalar
WHILELT While incrementing signed scalar less than scalar
e.g.
whilele p0.s, x0, x1
generates predicate p0 (for 32bit elements) by incrementing
(signed) x0 and comparing that vector to splat(x1).
llvm-svn: 338211
Sander de Smalen [Sun, 29 Jul 2018 08:00:16 +0000 (08:00 +0000)]
[AArch64][SVE] Asm: Instructions to perform serialized operations.
The instructions added in this patch permit active elements within
a vector to be processed sequentially without unpacking the vector.
PFIRST Set the first active element to true.
PNEXT Find next active element in predicate.
CTERMEQ Compare and terminate loop when equal.
CTERMNE Compare and terminate loop when not equal.
llvm-svn: 338210
Chandler Carruth [Sun, 29 Jul 2018 03:05:07 +0000 (03:05 +0000)]
Revert r337456: [CodeGen] Disable aggressive structor optimizations at -O0, take 3
This commit increases the number of sections and overall output size of
.o files by 10% and sometimes a bit more. This alone is challenging for
some users, but it also appears to trigger an as-yet unexplained
behavior in the Gold linker where the memory usage increases
considerably more than 10% (we think).
The increase is also frustrating because in many (if not all) cases we
end up with almost all of the growth coming from the ELF overhead of
-ffunction-sections and such, not from actual extra code being emitted.
Richard Smith and Eric Christopher are both going to investigate this
and try to get to the bottom of what is triggering this and whether the
kinds of increases here are sustainable or what options we might have to
minimize the impact they have. However, this is currently breaking
a pretty large number of our users' builds so reverting it while we sort
out how to make progress here. I've seen a longer and more detailed
update to the commit thread.
llvm-svn: 338209
Fangrui Song [Sat, 28 Jul 2018 23:41:50 +0000 (23:41 +0000)]
Fix Asan-i386-calls-Test AddressSanitizer.ShadowGapTest on FreeBSD
0x22000000 happens to be on the left of a heap allocation and the error
message is different (heap-buffer-overflow).
FreeBSD NetBSD have larger SHADOW_OFFSET (0x40000000) but let's try not
using #ifdef here.
llvm-svn: 338208
Zachary Turner [Sat, 28 Jul 2018 22:10:42 +0000 (22:10 +0000)]
[MS Demangler] Refactor some of the name parsing code.
There are some very subtle differences between how one should
parse symbol names and type names. They differ with respect
to back-referencing, the set of legal values that can appear
as the unqualified portion, and various other aspects.
By separating the parsing code into separate paths, we can
remove a lot of ambiguity during the demangling process, which
is necessary for demangling more complicated things like
function local statics, nested classes, and lambdas.
llvm-svn: 338207
Thomas Preud'homme [Sat, 28 Jul 2018 21:33:39 +0000 (21:33 +0000)]
Fix crash on inline asm with 64bit matching input in 32bit GPR
Add support for inline assembly with matching input operand that do not
naturally go in the register class it is constrained to (eg. double in a
32-bit GPR). Note that regular input is already handled by existing
code.
llvm-svn: 338206
Craig Topper [Sat, 28 Jul 2018 19:44:20 +0000 (19:44 +0000)]
[SelectionDAG] Pass std::vector by reference instead of by pointer to BuildSDIV/BuildUDIV.
This removes the need for an assert to ensure the pointer isn't null.
Years ago we had ifs the checked the pointer was non-null before very access to the vector. These checks were removed and replaced with a single assert. But a reference seems more suitable here.
llvm-svn: 338205
Craig Topper [Sat, 28 Jul 2018 18:21:46 +0000 (18:21 +0000)]
[X86] Correct the immediate cost for 'add/sub i64 %x, 0x80000000'.
X86 normally requires immediates to be a signed 32-bit value which would exclude i64 0x80000000. But for add/sub we can negate the constant and use the opposite instruction.
llvm-svn: 338204
Craig Topper [Sat, 28 Jul 2018 18:21:45 +0000 (18:21 +0000)]
[X86] Use alignTo and divideCeil to make some code more readable. NFC
llvm-svn: 338203
Zachary Turner [Sat, 28 Jul 2018 17:25:42 +0000 (17:25 +0000)]
Add VS natvis support for LLVMDemangle's StringView.
llvm-svn: 338202
David Bolvansky [Sat, 28 Jul 2018 17:13:33 +0000 (17:13 +0000)]
[InstCombine] Tests for fold Select with binary op
Differential Revision: https://reviews.llvm.org/D49961
llvm-svn: 338201
Sanjay Patel [Sat, 28 Jul 2018 16:48:44 +0000 (16:48 +0000)]
[InstCombine] try to fold 'sub' to 'not'
https://rise4fun.com/Alive/jDd
Patterns with add/sub combos can be improved using
'not' ops. This is better for analysis and may lead
to follow-on transforms because 'xor' and 'add' are
commutative/associative. It can also help codegen.
llvm-svn: 338200
Serge Pavlov [Sat, 28 Jul 2018 15:33:03 +0000 (15:33 +0000)]
[UBSan] Strengthen pointer checks in 'new' expressions
With this change compiler generates alignment checks for wider range
of types. Previously such checks were generated only for the record types
with non-trivial default constructor. So the types like:
struct alignas(32) S2 { int x; };
typedef __attribute__((ext_vector_type(2), aligned(32))) float float32x2_t;
did not get checks when allocated by 'new' expression.
This change also optimizes the checks generated for the arrays created
in 'new' expressions. Previously the check was generated for each
invocation of type constructor. Now the check is generated only once
for entire array.
Differential Revision: https://reviews.llvm.org/D49589
llvm-svn: 338199
Sander de Smalen [Sat, 28 Jul 2018 14:18:11 +0000 (14:18 +0000)]
[AArch64][SVE] Asm: Support for PFALSE and PTEST instructions.
This patch adds PFALSE (unconditionally sets all elements of
the predicate to false) and PTEST (set the status flags for the
predicate).
llvm-svn: 338198
Matt Arsenault [Sat, 28 Jul 2018 14:11:34 +0000 (14:11 +0000)]
AMDGPU: Stop wasting argument registers with v3i32/v3f32
SelectionDAGBuilder widens v3i32/v3f32 arguments to
to v4i32/v4f32 which consume an additional register.
In addition to wasting argument space, this produces extra
instructions since now it appears the 4th vector component has
a meaningful value to most combines.
llvm-svn: 338197
Sander de Smalen [Sat, 28 Jul 2018 14:04:52 +0000 (14:04 +0000)]
[AArch64][SVE] Asm: Data-dependent loop predicate partitioning instructions.
This patch adds support for instructions that partition a predicate
based on data-dependent termination conditions in a loop.
BRKA Break after the first true condition
BRKAS Break after the first true condition, setting condition flags
BRKB Break before the first true condition
BRKBS Break before the first true condition, setting condition flags
BRKPA Break after the first true condition, propagating from the
previous partition
BRKPAS Break after the first true condition, propagating from the
previous partition, setting condition flags
BRKPB Break before the first true condition, propagating from the
previous partition
BRKPBS Break before the first true condition, propagating from the
previous partition, setting condition flags
BRKN Propagate break to next partition
BKRNS Propagate break to next partition, setting condition flags
llvm-svn: 338196
David Bolvansky [Sat, 28 Jul 2018 13:52:45 +0000 (13:52 +0000)]
[InstSimplify] Moved Select + AND/OR tests from InstCombine
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49957
llvm-svn: 338195
Matt Arsenault [Sat, 28 Jul 2018 13:25:19 +0000 (13:25 +0000)]
DAG: Add calling convention argument to calling convention funcs
This seems like a pretty glaring omission, and AMDGPU
wants to treat kernels differently from other calling
conventions.
llvm-svn: 338194
Matt Arsenault [Sat, 28 Jul 2018 12:34:25 +0000 (12:34 +0000)]
AMDGPU: Stop trying to extend arguments for clover
This was trying to replace i8/i16 arguments with i32, which
was broken and no longer necessary.
llvm-svn: 338193
David Green [Sat, 28 Jul 2018 08:20:10 +0000 (08:20 +0000)]
[GlobalOpt] Test array indices inside structs for out-of-bounds accesses
We now, from clang, can turn arrays of
static short g_data[] = {16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0};
into structs of the form
@g_data = internal global <{ [8 x i16], [8 x i16] }> ...
GlobalOpt will incorrectly SROA it, not realising that the access to the first
element may overflow into the second. This fixes it by checking geps more
thoroughly.
I believe this makes the globalsra-partial.ll test case invalid as the %i value
could be out of bounds. I've re-purposed it as a negative test for this case.
Differential Revision: https://reviews.llvm.org/D49816
llvm-svn: 338192
David Bolvansky [Sat, 28 Jul 2018 06:55:51 +0000 (06:55 +0000)]
[InstCombine] Fold Select with AND/OR condition
Summary:
Fold
```
%A = icmp ne i8 %X, %V1
%B = icmp ne i8 %X, %V2
%C = or i1 %A, %B
%D = select i1 %C, i8 %X, i8 %V1
ret i8 %D
=>
ret i8 %X
Fixes https://bugs.llvm.org/show_bug.cgi?id=38334
Proof: https://rise4fun.com/Alive/plI8
Reviewers: spatel, lebedev.ri
Reviewed By: lebedev.ri
Subscribers: craig.topper, llvm-commits
Differential Revision: https://reviews.llvm.org/D49919
llvm-svn: 338191
Erik Pilkington [Sat, 28 Jul 2018 04:06:30 +0000 (04:06 +0000)]
[demangler] Fix an oss-fuzz bug from r338138
Stack overflow on invalid. While collapsing references, we were skipping over a
cycle check in ForwardTemplateReference leading to a stack overflow. This commit
fixes the problem by duplicating the cycle check in ReferenceType.
llvm-svn: 338190
Akira Hatanaka [Sat, 28 Jul 2018 04:06:13 +0000 (04:06 +0000)]
[Sema][ObjC] Warn when a method declared in a protocol takes a
non-escaping parameter but the implementation's method takes an escaping
parameter.
rdar://problem/
39548196
Differential Revision: https://reviews.llvm.org/D49119
llvm-svn: 338189
Yaxun Liu [Sat, 28 Jul 2018 03:05:25 +0000 (03:05 +0000)]
[CUDA][HIP] Allow function-scope static const variable
CUDA 8.0 E.3.9.4 says: Within the body of a __device__ or __global__
function, only __shared__ variables or variables without any device
memory qualifiers may be declared with static storage class.
It is unclear how a function-scope non-const static variable
without device memory qualifier is implemented, therefore only static
const variable without device memory qualifier is allowed, which
can be emitted as a global variable in constant address space.
Currently clang only allows function-scope static variable with
__shared__ qualifier.
This patch also allows function-scope static const variable without
device memory qualifier and emits it as a global variable in constant
address space.
Differential Revision: https://reviews.llvm.org/D49931
llvm-svn: 338188
George Karpenkov [Sat, 28 Jul 2018 02:16:13 +0000 (02:16 +0000)]
[AST] Add a convenient getter from QualType to RecordDecl
Differential Revision: https://reviews.llvm.org/D49951
llvm-svn: 338187
Erik Pilkington [Sat, 28 Jul 2018 01:29:31 +0000 (01:29 +0000)]
Compile SemaTemplate.cpp with /bigobj on MSVC
This should fix some bot failures introduced by r338165.
llvm-svn: 338186
Michael Kruse [Sat, 28 Jul 2018 01:11:45 +0000 (01:11 +0000)]
[test] Remove non-JSPON comments in JSCOP file. NFC.
llvm-svn: 338185
Jakub Kuderski [Sat, 28 Jul 2018 00:54:07 +0000 (00:54 +0000)]
[Dominators] Make applyUpdate's documentation less confusing [NFC]
Summary:
It was pointed out by @chandlerc that it's not clear whether both applyUpdates and insert/deleteEdge can be used to perform multiple updates.
IMO, the confusing part was that the comment above applyUpdates made a comparison of expected update time between calling it and calling insert/deleteEdge multiple times. It's generally not possible to safely call insert/deleteEdge multiple times, which documentation for each of the 3 functions warns about, so the whole comparison makes very little sense. On top of that, the comment is already lengthy, so I think it's best to just get rid of this comparison.
Reviewers: chandlerc, asbirlea, NutshellySima, grosser
Reviewed By: chandlerc
Subscribers: llvm-commits, chandlerc
Differential Revision: https://reviews.llvm.org/D49944
llvm-svn: 338184
Fangrui Song [Sat, 28 Jul 2018 00:48:05 +0000 (00:48 +0000)]
[CFG] Remove duplicate function/class names at the beginning of comments
Some functions/classes have renamed while the comments still use the old names. Delete them per coding style.
Also some whitespace cleanup.
llvm-svn: 338183
Vedant Kumar [Sat, 28 Jul 2018 00:33:47 +0000 (00:33 +0000)]
[docs] Clarify role of DIExpressions within debug intrinsics
This should make the semantics of DIExpressions within llvm.dbg.{addr,
declare, value} easier to understand.
Differential Revision: https://reviews.llvm.org/D49572
llvm-svn: 338182
Craig Topper [Sat, 28 Jul 2018 00:27:25 +0000 (00:27 +0000)]
[DAGCombiner] Teach DAG combiner that A-(B-C) can be folded to A+(C-B)
This can be useful since addition is commutable, and subtraction is not.
This matches a transform that is also done by InstCombine.
llvm-svn: 338181
Alina Sbirlea [Sat, 28 Jul 2018 00:01:05 +0000 (00:01 +0000)]
[SimpleLoopUnswitch] Fix DT updates for trivial branch unswitching.
Summary:
Fixing 2 issues with the DT update in trivial branch switching, though I don't have a case where DT update fails.
1. After splitting ParentBB->UnswitchedBB edge, new edges become: ParentBB->LoopExitBB->UnswitchedBB, so remove ParentBB->LoopExitBB edge.
2. AFAIU, for multiple CFG changes, DT should be updated using batch updates, vs consecutive addEdge and removeEdge calls.
Reviewers: chandlerc, kuhar
Subscribers: sanjoy, jlebar, llvm-commits
Differential Revision: https://reviews.llvm.org/D49925
llvm-svn: 338180