Clement Courbet [Wed, 27 Mar 2019 15:43:03 +0000 (15:43 +0000)]
[X86MacroFusion][NFC] Improve macrofusion testing.
Add negative tests.
Add arithmetic/inc/cmp/and macrofusion tests.
llvm-svn: 357076
Haojian Wu [Wed, 27 Mar 2019 15:41:59 +0000 (15:41 +0000)]
[clangd] Add activate command to the vscode extension.
Summary:
This would help minizime the annoying part of not activating the extension
for .cu file.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59817
llvm-svn: 357075
Andrea Di Biagio [Wed, 27 Mar 2019 15:41:53 +0000 (15:41 +0000)]
[MCA][Pipeline] Don't visit stages in reverse order when calling method cycleEnd(). NFCI
There is no reason why stages should be visited in reverse order.
This patch allows the definition of stages that push instructions forward from
their cycleEnd() routine.
llvm-svn: 357074
Matt Arsenault [Wed, 27 Mar 2019 15:41:00 +0000 (15:41 +0000)]
AMDGPU: Fix areLoadsFromSameBasePtr for DS atomics
The offset operand index is different for atomics.
llvm-svn: 357073
Andrew Ng [Wed, 27 Mar 2019 15:30:52 +0000 (15:30 +0000)]
[LLD] Restore tests that use "-" as output
No longer require workarounds for output to "-" (stdout) for
Windows. These workarounds were just hiding the actual problem which has
been fixed in r357058.
Differential Revision: https://reviews.llvm.org/D59824
llvm-svn: 357072
Nico Weber [Wed, 27 Mar 2019 15:10:47 +0000 (15:10 +0000)]
gn build: Merge r357047
llvm-svn: 357071
Nirav Dave [Wed, 27 Mar 2019 14:14:46 +0000 (14:14 +0000)]
[DAGCombiner] Unify Lifetime and memory Op aliasing.
Rework BaseIndexOffset and isAlias to fully work with lifetime nodes
and fold in lifetime alias analysis.
This is mostly NFC.
Reviewers: courbet
Reviewed By: courbet
Subscribers: hiraditya, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59794
llvm-svn: 357070
Nirav Dave [Wed, 27 Mar 2019 14:14:35 +0000 (14:14 +0000)]
[DAGCombine] Refactor GatherAllAliases. NFCI.
llvm-svn: 357069
Alexey Bataev [Wed, 27 Mar 2019 14:14:31 +0000 (14:14 +0000)]
[OPENMP]Initial support for 'allocate' clause.
Added parsing/sema analysis of the allocate clause.
llvm-svn: 357068
Hans Wennborg [Wed, 27 Mar 2019 14:10:11 +0000 (14:10 +0000)]
Re-commit r355490 "[CodeGen] Omit range checks from jump tables when lowering switches with unreachable default"
Original commit by Ayonam Ray.
This commit adds a regression test for the issue discovered in the
previous commit: that the range check for the jump table can only be
omitted if the fall-through destination of the jump table is
unreachable, which isn't necessarily true just because the default of
the switch is unreachable.
This addresses the missing optimization in PR41242.
> During the lowering of a switch that would result in the generation of a
> jump table, a range check is performed before indexing into the jump
> table, for the switch value being outside the jump table range and a
> conditional branch is inserted to jump to the default block. In case the
> default block is unreachable, this conditional jump can be omitted. This
> patch implements omitting this conditional branch for unreachable
> defaults.
>
> Differential Revision: https://reviews.llvm.org/D52002
> Reviewers: Hans Wennborg, Eli Freidman, Roman Lebedev
llvm-svn: 357067
Dmitry Preobrazhensky [Wed, 27 Mar 2019 13:49:52 +0000 (13:49 +0000)]
Revert of 357063 [AMDGPU][MC] Corrected handling of tied src for atomic return MUBUF opcodes
Reason: the change was mistakenly committed before review
llvm-svn: 357066
Kevin P. Neal [Wed, 27 Mar 2019 13:30:57 +0000 (13:30 +0000)]
The IR verifier currently supports the constrained floating point intrinsics,
but the implementation is hard to extend. It doesn't currently have an
easy way to support intrinsics that, for example, lack a rounding mode.
This will be needed for impending new constrained intrinsics.
This code is split out of D55897 <https://reviews.llvm.org/D55897>, which
itself was split out of D43515 <https://reviews.llvm.org/D43515>.
Reviewed by: arsenm
Differential Revision: http://reviews.llvm.org/D59830
llvm-svn: 357065
Sander de Smalen [Wed, 27 Mar 2019 13:16:19 +0000 (13:16 +0000)]
[AArch64] NFC: Cleanup isAArch64FrameOffsetLegal
Cleanup isAArch64FrameOffsetLegal by:
- Merging the large switch statement to reuse AArch64InstrInfo::getMemOpInfo().
- Using AArch64InstrInfo::getUnscaledLdSt() to determine whether an instruction
has an unscaled variant.
- Simplifying the logic that calculates the offset to fit the immediate.
Reviewers: paquette, evandro, eli.friedman, efriedma
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D59636
llvm-svn: 357064
Dmitry Preobrazhensky [Wed, 27 Mar 2019 13:07:41 +0000 (13:07 +0000)]
[AMDGPU][MC] Corrected handling of tied src for atomic return MUBUF opcodes
See bug 40917: https://bugs.llvm.org/show_bug.cgi?id=40917
Reviewers: artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D59305
llvm-svn: 357063
Simon Pilgrim [Wed, 27 Mar 2019 11:21:09 +0000 (11:21 +0000)]
[X86][SSE] Add shuffle test case for PR41249
llvm-svn: 357062
George Rimar [Wed, 27 Mar 2019 11:00:03 +0000 (11:00 +0000)]
Revert the r348352 "[clang] - Simplify tools::SplitDebugName."
This partially reverts the r348352 (https://reviews.llvm.org/D55006)
because of https://bugs.llvm.org/show_bug.cgi?id=41161.
I did not revert the test case file because it passes fine now.
llvm-svn: 357061
Pavel Labath [Wed, 27 Mar 2019 10:54:10 +0000 (10:54 +0000)]
minidump: Add ability to attach (breakpad) symbol files to placeholder modules
This re-commits r354263, which was because it uncovered with handling of
modules with empty (zero) UUIDs. This would cause us to treat two
modules as intentical even though they were not. This caused an assert
in PlaceholderObjectFile::SetLoadAddress to fire, because we were trying
to load the module twice even though it was designed to be only loaded
at a specific address. (The same problem also existed with the previous
implementation, but it had no asserts to warn us about this.) These
issues have now been fixed in r356896.
windows bot. The issue there was that ObjectFilePECOFF vended its base
address through the incorrect interface. SymbolFilePDB depended on that,
which lead to assertion failures when SymbolFilePDB was attempting to
use the placeholder object files as a base. This has been fixed in
r354258
The original commit message was:
The reason this wasn't working was that ProcessMinidump was creating odd
object-file-less modules, and SymbolFileBreakpad required the module to
have an associated object file because it needed to get its base
address.
This fixes that by introducing a PlaceholderObjectFile to serve as a
dummy object file. The general idea for this is taken from D55142, but
I've reworked it a bit to avoid the need for the PlaceholderModule
class. Now that we have an object file, our modules are sufficiently
similar to regular modules that we can use the regular Module class
almost out of the box -- the only thing I needed to tweak was the
Module::CreateModuleFromObjectFile functon to set the module's FileSpec
in addition to it's architecture. This wasn't needed for ObjectFileJIT
(the other user of CreateModuleFromObjectFile), but it shouldn't hurt it
either, and the change seems like a straightforward extension of this
function.
Reviewers: clayborg, lemo, amccarth
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D57751
llvm-svn: 357060
Sander de Smalen [Wed, 27 Mar 2019 10:39:03 +0000 (10:39 +0000)]
[AArch64] Adds cases for LDRSHWui and LDRSHXui to getMemOpInfo
This patch also adds cases PRFUMi and PRFMui.
This change was discussed in https://reviews.llvm.org/D59635.
llvm-svn: 357059
Andrew Ng [Wed, 27 Mar 2019 10:26:21 +0000 (10:26 +0000)]
[Support] MemoryBlock size should reflect the requested size
This patch mirrors the change made to the Unix equivalent in
r351916. This in turn fixes bugs related to the use of FileOutputBuffer
to output to "-", i.e. stdout, on Windows.
Differential Revision: https://reviews.llvm.org/D59663
llvm-svn: 357058
Simon Pilgrim [Wed, 27 Mar 2019 10:25:02 +0000 (10:25 +0000)]
Revert rL356864 : [X86][SSE41] Start shuffle combining from ZERO_EXTEND_VECTOR_INREG (PR40685)
Enable SSE41 ZERO_EXTEND_VECTOR_INREG shuffle combines - for the PMOVZX(PSHUFD(V)) -> UNPCKH(V,0) pattern we reduce the shuffles (port5-bottleneck on Intel) at the expense of creating a zero (pxor v,v) and an extra register move - which is a good trade off as these are pretty cheap and in most cases it doesn't increase register pressure.
This also exposed a missed opportunity to use combine to ZERO_EXTEND_VECTOR_INREG with folded loads - even if we're in the float domain.
........
Causes PR41249
llvm-svn: 357057
Pavel Labath [Wed, 27 Mar 2019 10:02:36 +0000 (10:02 +0000)]
Fix a "memset clearing an object of non-trivial type" warning in DWARFFormValue
This is diagnosed by gcc-8. The ValueType struct already has a default
constructor which performs zero-initialization, so we can just call that
instead of using memset.
llvm-svn: 357056
Pavel Labath [Wed, 27 Mar 2019 09:39:46 +0000 (09:39 +0000)]
Fix an out-of-bounds error in RegisterContextDarwin_arm64
Summary:
gcc diagnoses this as "array subscript 63 is above array bounds of
'RegisterContextDarwin_arm64::VReg [32]'".
The correct fix seems to be subtracting the fpu register base index, but
I have no way of verifying that this actually works.
Reviewers: jasonmolenda
Subscribers: javed.absar, kristof.beyls, lldb-commits
Differential Revision: https://reviews.llvm.org/D59495
llvm-svn: 357055
Fangrui Song [Wed, 27 Mar 2019 09:38:05 +0000 (09:38 +0000)]
[DWARF] Add D to Seen early to avoid duplicate elements in Worklist
llvm-svn: 357054
Fangrui Song [Wed, 27 Mar 2019 08:43:21 +0000 (08:43 +0000)]
[DWARF] Simplify DWARFVerifier::handleDebugAbbrev. NFC
llvm-svn: 357053
Jonas Paulsson [Wed, 27 Mar 2019 08:41:46 +0000 (08:41 +0000)]
[DAGCombiner] Don't allow addcarry if the carry producer is illegal.
getAsCarry() checks that the input argument is a carry-producing node before
allowing a transformation to addcarry. This patch adds a check to make sure
that the carry-producing node is legal. If it is not, it may not remain in a
form that is manageable by the target backend. The test case caused a
compilation failure during instruction selection for this reason on SystemZ.
Patch by Ulrich Weigand.
Review: Sanjay Patel
https://reviews.llvm.org/D59822
llvm-svn: 357052
Fangrui Song [Wed, 27 Mar 2019 08:19:36 +0000 (08:19 +0000)]
[llvm-dwarfdump] Simplify -o handling
ToolOutputFile handles '-' so no need to specialize here.
Also, we neither reassign the variable nor pass it around, thus no need
to use std::unique_ptr<ToolOutputFile>.
exit(1) -> return 1; to call the destructor of raw_fd_stream
llvm-svn: 357051
Craig Topper [Wed, 27 Mar 2019 06:07:05 +0000 (06:07 +0000)]
[X86] Add test cases for missed opportunities in (x << C1) op C2 to (x op (C2>>C1)) << C1 transform.
We handle the case where the C2 does not fit in a signed 32-bit immediate, but
(C2>>C1) does. But there's also some 64-bit opportunities when C2 is not an unsigned
32-bit immediate, but (C2>>C1) is. For OR/XOR this allows us to load the
immediate with with MOV32ri instead of a movabsq. For AND it allows us to use a
32-bit AND and fold the immediate.
llvm-svn: 357050
Craig Topper [Wed, 27 Mar 2019 04:45:58 +0000 (04:45 +0000)]
[X86] When iselling (x << C1) and/or/xor C2 as (x and/or/xor (C2>>C1)) << C1, go through the isel table instead of manually selecting.
Previously we manually selected the AND/OR/XOR with immediate and the SHL(or ADD if the shift is 1). But this was missing out on the opportunity to use a 64 bit AND with a 32-bit immediate and possibly other isel tricks we have built into the tables.
Instead, insert the new nodes into the DAG using insertDAGNode and allow them each to be selected through the normal table.
llvm-svn: 357049
Yi Kong [Wed, 27 Mar 2019 04:18:37 +0000 (04:18 +0000)]
Revert "[builtins] Rounding mode support for addxf3/subxf3"
This reverts commit
2cabea054e40ae2837da959d0ca89ae25cf1b1f1.
Test failure on buildbots.
llvm-svn: 357048
QingShan Zhang [Wed, 27 Mar 2019 03:50:16 +0000 (03:50 +0000)]
[NFC][PowerPC] Custom PowerPC specific machine-scheduler
This patch lays the groundwork for extending the generic machine scheduler by providing a PPC-specific implementation.
There are no functional changes as this is an incremental patch that simply provides the necessary overrides which just
encapsulate the behavior of the generic scheduler. Subsequent patches will add specific behavior.
Differential Revision: https://reviews.llvm.org/D59284
llvm-svn: 357047
Craig Topper [Wed, 27 Mar 2019 02:18:41 +0000 (02:18 +0000)]
[X86] Autogenerate complete checks. NFC
llvm-svn: 357046
Craig Topper [Wed, 27 Mar 2019 02:08:03 +0000 (02:08 +0000)]
[X86] Simplify some code in matchBitExtract by using ANY_EXTEND.
We were manually outputting the code we would get from selecting ANY_EXTEND. We
can save some code by just letting an ANY_EXTEND go through isel on its own.
llvm-svn: 357045
Nathan Lanza [Wed, 27 Mar 2019 01:24:03 +0000 (01:24 +0000)]
Get the lang from the CompileUnit for ParseCompileUnitFunctionForPDBFunc
Summary:
Instead of assuming that the language is C++ instead check the compunit
for the language it received from the debug info.
Subscribers: aprantl, jdoerfert
Differential Revision: https://reviews.llvm.org/D59805
llvm-svn: 357044
Francis Visoiu Mistrih [Wed, 27 Mar 2019 01:13:59 +0000 (01:13 +0000)]
[Remarks] Emit a section containing remark diagnostics metadata
A section containing metadata on remark diagnostics will be emitted if
the flag (-mllvm) -remarks-section is present.
For now, the metadata is:
* a magic number for remarks: "REMARKS\0"
* the version number: a little-endian uint64_t
* the absolute file path to the serialized remark diagnostics: a
null-terminated string.
Differential Revision: https://reviews.llvm.org/D59571
llvm-svn: 357043
Nico Weber [Wed, 27 Mar 2019 00:17:05 +0000 (00:17 +0000)]
gn build: Add build files for clang-include-fixer and find-all-symbols
Differential Revision: https://reviews.llvm.org/D59838
llvm-svn: 357042
Erik Pilkington [Tue, 26 Mar 2019 23:21:22 +0000 (23:21 +0000)]
Emit -Wfortify-source using DiagRuntimeBehaviour
This fixes a false positive on the following, where st is configured to have
different sizes based on some preprocessor logic:
if (sizeof(buf) == sizeof(*st))
memcpy(&buf, st, sizeof(*st));
llvm-svn: 357041
Erik Pilkington [Tue, 26 Mar 2019 23:21:19 +0000 (23:21 +0000)]
[Sema] Fix an assert when a block captures a constexpr local
MarkVarDeclODRUsed indirectly calls captureInBlock, which creates a copy
expression. The copy expression is insulated in it's own
ExpressionEvaluationContext, so it saves, mutates, and restores MaybeODRUseExprs
as CleanupVarDeclMarking is iterating through it, leading to a crash. Fix this
by iterating through a local copy of MaybeODRUseExprs.
rdar://
47493525
https://reviews.llvm.org/D59670
llvm-svn: 357040
Nikita Popov [Tue, 26 Mar 2019 22:37:26 +0000 (22:37 +0000)]
[ConstantRange] Exclude full set from isSignWrappedSet()
Split off from D59749. This uses a simpler and more efficient
implementation of isSignWrappedSet(), and considers full sets
as non-wrapped, to be consistent with isWrappedSet(). Otherwise
the behavior is unchanged.
There are currently only two users of this function and both already
check for isFullSet() || isSignWrappedSet(), so this is not going to
cause a change in overall behavior.
Differential Revision: https://reviews.llvm.org/D59848
llvm-svn: 357039
Duncan P. N. Exon Smith [Tue, 26 Mar 2019 22:32:06 +0000 (22:32 +0000)]
Basic: Return a reference from FileManager::getVirtualFileSystem, NFC
FileManager constructs a VFS in its constructor if it isn't passed one,
and there's no way to reset it. Make that contract clear by returning a
reference from its accessor.
https://reviews.llvm.org/D59388
llvm-svn: 357038
Duncan P. N. Exon Smith [Tue, 26 Mar 2019 22:18:52 +0000 (22:18 +0000)]
Frontend: Remove CompilerInstance::VirtualFileSystem, NFC
Remove CompilerInstance::VirtualFileSystem and
CompilerInstance::setVirtualFileSystem, instead relying on the VFS in
the FileManager. CompilerInstance and its clients already went to some
trouble to make these match. Now they are guaranteed to match.
As part of this, I added a VFS parameter (defaults to nullptr) to
CompilerInstance::createFileManager, to avoid repeating construction
logic in clients that just wanted to customize the VFS.
https://reviews.llvm.org/D59377
llvm-svn: 357037
Shoaib Meenai [Tue, 26 Mar 2019 22:16:53 +0000 (22:16 +0000)]
[cmake] Reset variable before using it
A bunch of macros use the same variable name, and since CMake macros
don't get their own scope, the value persists across macro invocations,
and we can end up exporting targets which shouldn't be exported. Clear
the variable before each use to avoid this.
Converting these macros to functions would also help, since it would
avoid the variable leaking into its parent scope, and that's something I
plan to follow up with. It won't fully address the problem, however,
since functions still inherit variables from their parent scopes, so if
someone in the parent scope just happened to use the same variable name
we'd still have the same issue.
llvm-svn: 357036
Yi Kong [Tue, 26 Mar 2019 22:01:22 +0000 (22:01 +0000)]
[builtins] Rounding mode support for addxf3/subxf3
Implement rounding mode support for addxf3/subxf3.
On architectures that implemented the support, this will access the
corresponding floating point environment register to apply the
correct rounding. For other architectures, it will keep the current
behaviour and use IEEE-754 default rounding mode (to nearest, ties
to even).
ARM32/AArch64 support implemented in this change. i386 and AMD64
will be added in a follow up change.
Differential Revision: https://reviews.llvm.org/D57143
llvm-svn: 357035
Jonas Devlieghere [Tue, 26 Mar 2019 21:57:02 +0000 (21:57 +0000)]
[Python] Remove dynamic indirection
Now that the Python plugin relies on the SWIG symbols, we no longer need
to dynamically resolve these functions.
llvm-svn: 357034
Guozhi Wei [Tue, 26 Mar 2019 21:27:38 +0000 (21:27 +0000)]
[PPC] Refactor PPCBranchSelector.cpp
This patch splits the huge function PPCBranchSelector.cpp:runOnMachineFunction into several smaller functions.
No functional change.
Differential Revision: https://reviews.llvm.org/D59623
llvm-svn: 357033
Quentin Colombet [Tue, 26 Mar 2019 21:27:15 +0000 (21:27 +0000)]
[LiveRange] Reset the VNIs when splitting subranges
When splitting a subrange we end up with two different subranges covering
two different, non overlapping, lanes.
As part of this splitting the VNIs of the original live-range need
to be dispatched to the subranges according to which lanes they are
actually defining.
Prior to this patch we were assuming that all values were defining
all lanes. This was wrong as demonstrated by llvm.org/PR40835.
Differential Revision: https://reviews.llvm.org/D59731
llvm-svn: 357032
Jessica Paquette [Tue, 26 Mar 2019 21:22:42 +0000 (21:22 +0000)]
Make -mno-outline pass -enable-machine-outliner=never to ld in LTO
Since AArch64 has default outlining behaviour, we need to make sure that
-mno-outline is actually passed along to the linker in this case. Otherwise,
it will run by default on minsize functions even when -mno-outline is specified.
Also fix the darwin-ld test for this, which wasn't actually doing anything.
llvm-svn: 357031
Alex Langford [Tue, 26 Mar 2019 21:00:42 +0000 (21:00 +0000)]
[ExpressionParser] Add swift-lldb case for finding clang resource dir
Summary:
I'm adding this to reduce the difference between swift-lldb and
llvm.org's lldb.
Reviewers: aprantl, davide, compnerd, JDevlieghere, jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D59708
llvm-svn: 357030
Sanjay Patel [Tue, 26 Mar 2019 20:54:15 +0000 (20:54 +0000)]
[SDAG] add simplifications for FP at node creation time
We have the folds for fadd/fsub/fmul already in DAGCombiner,
so it may be possible to remove that code if we can guarantee that
these ops are zapped before they can exist.
llvm-svn: 357029
Stefan Pintilie [Tue, 26 Mar 2019 20:28:21 +0000 (20:28 +0000)]
[PowerPC] Remove UseVSXReg
The UseVSXReg flag can be safely removed and the code cleaned up.
Patch By: Yi-Hong Liu
Differential Revision: https://reviews.llvm.org/D58685
llvm-svn: 357028
Ronald Wampler [Tue, 26 Mar 2019 20:18:14 +0000 (20:18 +0000)]
[clang-format] Add style option AllowShortLambdasOnASingleLine
Summary:
This option `AllowShortLambdasOnASingleLine` similar to the other `AllowShort*` options, but applied to C++ lambdas.
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: MyDeveloperDay, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57687
llvm-svn: 357027
Ali Tamur [Tue, 26 Mar 2019 20:05:27 +0000 (20:05 +0000)]
Revert "[llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5.""
This reverts commit rL357020.
The commit broke the test llvm/test/tools/llvm-objdump/embedded-source.test
on some builds including clang-ppc64be-linux-multistage,
clang-s390x-linux, clang-with-lto-ubuntu, clang-x64-windows-msvc,
llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast (and others).
llvm-svn: 357026
Ali Tamur [Tue, 26 Mar 2019 19:57:13 +0000 (19:57 +0000)]
Revert "[lld] Reapply "Prevent duplicate files in debug line header in dwarf 5.""
This reverts commit rL357020
Reason: rL357018, which this commit depend on breaks the test:
llvm/test/tools/llvm-objdump/embedded-source.test on some architectures.
llvm-svn: 357025
Thomas Anderson [Tue, 26 Mar 2019 19:51:30 +0000 (19:51 +0000)]
[libc++] Fix return value of snprintf_l() on Windows when buffer is too small
When the output buffer is too small to contain the output, `vsnprintf()`
fills the buffer and returns the number of characters that __would have__
been written if the buffer was sufficiently large.
`_vnsprintf_s()` on the other hand fills the buffer and returns -1 when this
happens. We want the former behavior, but we also want to be able to
pass in a locale to prevent having to call `setlocale()`.
`__stdio_common_vsprintf()` is the only function general enough to get
the behavior we want.
Differential Revision: https://reviews.llvm.org/D59727
llvm-svn: 357024
Brian Gesiak [Tue, 26 Mar 2019 19:50:46 +0000 (19:50 +0000)]
Revert "[coroutines] Add std::experimental::task<T> type"
This revision is causing build and test failures, such as
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv8-linux/builds/648/steps/test.libcxx/logs/stdio,
so I'll revert it.
llvm-svn: 357023
Sam Clegg [Tue, 26 Mar 2019 19:46:15 +0000 (19:46 +0000)]
[WebAssembly] Initial implementation of PIC code generation
This change implements lowering of references global symbols in PIC
mode.
This change implements lowering of global references in PIC mode using a
new @GOT reference type. @GOT references can be used with function or
data symbol names combined with the get_global instruction. In this case
the linker will insert the wasm global that stores the address of the
symbol (either in memory for data symbols or in the wasm table for
function symbols).
For now I'm continuing to use the R_WASM_GLOBAL_INDEX_LEB relocation
type for this type of reference which means that this relocation type
can refer to either a global or a function or data symbol. We could
choose to introduce specific relocation types for GOT entries in the
future. See the current dynamic linking proposal:
https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
Differential Revision: https://reviews.llvm.org/D54647
llvm-svn: 357022
Nico Weber [Tue, 26 Mar 2019 19:16:28 +0000 (19:16 +0000)]
gn build: Format all build files
Re-ran `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`.
llvm-svn: 357021
Ali Tamur [Tue, 26 Mar 2019 18:59:52 +0000 (18:59 +0000)]
[lld] Reapply "Prevent duplicate files in debug line header in dwarf 5."
Reapply rL356943; the previous attempt was reverted because the patch rL356941
that this depended on had broken a test.
Original commit message:
[lld] Prevent duplicate files in debug line header in dwarf 5.
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59671
llvm-svn: 357020
Nico Weber [Tue, 26 Mar 2019 18:55:37 +0000 (18:55 +0000)]
gn build: Merge r356929 (effectively relands r353518, reverted in r353621)
llvm-svn: 357019
Ali Tamur [Tue, 26 Mar 2019 18:53:23 +0000 (18:53 +0000)]
[llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5."
Reapply rL356941 after regenerating the object file in the failing test
llvm/test/tools/llvm-objdump/embedded-source.test from source.
Original commit message:
[llvm] Prevent duplicate files in debug line header in dwarf 5.
Motivation: In previous dwarf versions, file name indexes started from 1, and
the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes
the primary source file to be explicitly given an entry with an index number 0.
The current implementation honors the specification by just duplicating the
main source file, once with index number 0, and later maybe with another
index number. While this is compliant with the letter of the standard, the
duplication causes problems for consumers of this information such as lldb.
(Some files are duplicated, where only some of them have a line table although
all refer to the same file)
With this change, dwarf 5 debug line section files always start from 0, and
the zeroth entry is not duplicated whenever possible. This requires different
handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns
an index zero for a file name, it signals an error in dwarf 4, but not in dwarf 5)
However, I think the minor complication is worth it, because it enables all
consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the
file name list homogenously.
Tags: #llvm, #debug-info
Differential Revision: https://reviews.llvm.org/D59515
llvm-svn: 357018
George Rimar [Tue, 26 Mar 2019 18:42:15 +0000 (18:42 +0000)]
[llvm-objcopy] - Strip sections before symbols.
This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40007.
Idea is to swap the order of stripping. So that we strip sections before
symbols what allows us to strip relocation sections without emitting
the error about relative symbols.
Differential revision: https://reviews.llvm.org/D59763
llvm-svn: 357017
Jorge Gorbe Moya [Tue, 26 Mar 2019 18:36:44 +0000 (18:36 +0000)]
Add lldb-vscode as a dependency of lldb tests.
Summary:
In the current state, 'ninja check-lldb' runs the lldb-vscode tests, but it
won't rebuild lldb-vscode if any of its sources has changed. This is very
confusing when you fix something and the tests keep failing, or vice versa.
Reviewers: clayborg
Subscribers: mgorny, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D59828
llvm-svn: 357016
Heejin Ahn [Tue, 26 Mar 2019 18:21:20 +0000 (18:21 +0000)]
[WebAssembly] Don't analyze branches after CFGStackify
Summary:
`WebAssembly::analyzeBranch` now does not analyze anything if the
function is CFG stackified. We were previously doing similar things by
checking if a branch's operand is whether an integer or an MBB, but this
failed to bail out when a BB did not have any terminators.
Consider this case:
```
bb0:
try $label0
call @foo // unwinds to %ehpad
bb1:
...
br $label0 // jumps to %cont. can be deleted
ehpad:
catch
...
cont:
end_try
```
Here `br $label0` will be deleted in CFGStackify's
`removeUnnecessaryInstrs` function, because we jump to the %cont block
even without the branch. But in this case, MachineVerifier fails to
verify this, because `ehpad` is not a successor of `bb1` even if `bb1`
does not have any terminators. MachineVerifier incorrectly thinks `bb1`
falls through to the next block.
This pass now consistently rejects all analysis after CFGStackify
whether a BB has terminators or not, also making the MachineVerifier
work. (MachineVerifier does not try to verify relationships between BBs
if `analyzeBranch` fails, the behavior we want after CFGStackify.)
This also adds a new option `-wasm-disable-ehpad-sort` for testing. This
option helps create the sorted order we want to test, and without the
fix in this patch, the tests in cfg-stackify-eh.ll fail at
MachineVerifier with `-wasm-disable-ehpad-sort`.
Reviewers: dschuff
Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59740
llvm-svn: 357015
Nikita Popov [Tue, 26 Mar 2019 18:05:53 +0000 (18:05 +0000)]
[ConstantRange] Fix outdated comment; NFC
Full/empty is required now, so there is no default.
llvm-svn: 357014
Nikita Popov [Tue, 26 Mar 2019 18:05:43 +0000 (18:05 +0000)]
[InstCombine] Add tests for ssubo X, C -> saddo X, -C; NFC
Add baseline tests for canonicalization of
ssubo X, C -> saddo X, -C.
Patch by Dan Robertson.
Differential Revision: https://reviews.llvm.org/D59653
llvm-svn: 357013
Sanjay Patel [Tue, 26 Mar 2019 17:50:08 +0000 (17:50 +0000)]
[InstCombine] form uaddsat from add+umin (PR14613)
This is the last step towards solving the examples shown in:
https://bugs.llvm.org/show_bug.cgi?id=14613
With this change, x86 should end up with psubus instructions
when those are available.
All known codegen issues with expanding the saturating intrinsics
were resolved with:
D59006 / rL356855
We also have some early evidence in D58872 that using the intrinsics
will lead to better perf. If some target regresses from this, custom
lowering of the intrinsics (as in the above for x86) may be needed.
llvm-svn: 357012
Heejin Ahn [Tue, 26 Mar 2019 17:46:14 +0000 (17:46 +0000)]
[WebAssembly] Add CFGStacikfied field to WebAssemblyFunctionInfo
Summary:
This adds `CFGStackified` field and its serialization to
WebAssemblyFunctionInfo.
Reviewers: dschuff
Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59747
llvm-svn: 357011
Brian Gesiak [Tue, 26 Mar 2019 17:46:06 +0000 (17:46 +0000)]
[coroutines] Add std::experimental::task<T> type
Summary:
Adds the coroutine `std::experimental::task<T>` type described in proposal P1056R0.
See https://wg21.link/P1056R0.
This implementation allows customization of the allocator used to allocate the
coroutine frame by passing std::allocator_arg as the first argument, followed by
the allocator to use.
This supports co_awaiting the same task multiple times. The second and
subsequent times it returns a reference to the already-computed value.
This diff also adds some implementations of other utilities that have potential for
standardization as helpers within the test/... area:
- `sync_wait(awaitable)` - See P1171R0
- `manual_reset_event`
Move the definition of the __aligned_allocation_size helper function
from <experimental/memory_resource> to <experimental/__memory>
so it can be more widely used without pulling in memory_resource.
Outstanding work:
- Use C++14 keywords directly rather than macro versions
eg. use `noexcept` instead of `_NOEXCEPT`).
- Add support for overaligned coroutine frames.
This may need wording in the Coroutines TS to support passing the extra `std::align_val_t`.
- Eliminate use of `if constexpr` if we want it to compile under C++14.
Patch by @lewissbaker (Lewis Baker).
llvm-svn: 357010
Heejin Ahn [Tue, 26 Mar 2019 17:35:35 +0000 (17:35 +0000)]
[WebAssembly] Support WebAssemblyFunctionInfo serialization
Summary:
The framework for supporting target-specific MachineFunctionInfo was
added in r356215. This adds serialization support for
WebAssemblyFunctionInfo on top of that. This patch only adds the
framework and does not actually serialize anything at this point; we
have to add YAML mapping later for the fields in WebAssemblyFunctionInfo
we want to serialize if necessary.
Reviewers: dschuff, arsenm
Subscribers: sunfish, wdng, sbc100, jgravelle-google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59737
llvm-svn: 357009
Heejin Ahn [Tue, 26 Mar 2019 17:29:55 +0000 (17:29 +0000)]
[WebAssembly] Fix a bug when mixing TRY/LOOP markers
Summary:
When TRY and LOOP markers are in the same BB and END_TRY and END_LOOP
markers are in the same BB, END_TRY should be _before_ END_LOOP, because
LOOP is always before TRY if they are in the same BB. (TRY is placed in
the latest possible position, whereas LOOP is in the earliest possible
position.)
Reviewers: dschuff
Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59751
llvm-svn: 357008
Heejin Ahn [Tue, 26 Mar 2019 17:15:55 +0000 (17:15 +0000)]
[WebAssembly] Fix bugs in BLOCK/TRY placement
Summary:
Before we placed all TRY/END_TRY markers before placing BLOCK/END_BLOCK
markers. This couldn't handle this case:
```
bb0:
br bb2
bb1: // nearest common dominator of bb3 and bb4
br_if ... bb3
br bb4
bb2:
...
bb3:
call @foo // unwinds to ehpad
bb4:
call @bar // unwinds to ehpad
ehpad:
catch
...
```
When we placed TRY markers, we placed it in bb1 because it is the
nearest common dominator of bb3 and bb4. But because bb0 jumps to bb2,
when we placed block markers, we ended up with interleaved scopes like
```
block
try
end_block
catch
end_try
```
which was not correct.
This patch fixes the bug by placing BLOCK and TRY markers in one pass
while iterating BBs in a function. This also adds some more routines to
`placeTryMarkers`, because we now have to assume that there can be
previously placed BLOCK and END_BLOCK.
Reviewers: dschuff
Subscribers: sunfish, sbc100, jgravelle-google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59739
llvm-svn: 357007
Davide Italiano [Tue, 26 Mar 2019 16:43:58 +0000 (16:43 +0000)]
[ScriptInterpreterPython] Try to make the sanitizer bot green again.
Removing a use-after-free error.
llvm-svn: 357006
Sanjay Patel [Tue, 26 Mar 2019 16:19:13 +0000 (16:19 +0000)]
[InstCombine] add tests for uaddsat using min; NFC
llvm-svn: 357005
Sanjay Patel [Tue, 26 Mar 2019 15:58:33 +0000 (15:58 +0000)]
[InstCombine] update tests to use FileCheck; NFC
llvm-svn: 357004
Clement Courbet [Tue, 26 Mar 2019 15:44:57 +0000 (15:44 +0000)]
[llvm-exegesis] Allow the target to disable the selection of some registers.
Summary:
This prevents "Cannot encode high byte register in REX-prefixed instruction"
from happening on instructions that require REX encoding when AH & co
get selected.
On the down side, these 4 registers can no longer be selected
automatically, but this avoids having to expose all the X86 encoding
complexity.
Reviewers: gchatelet
Subscribers: tschuett, jdoerfert, llvm-commits, bdb
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59821
llvm-svn: 357003
Luis Marques [Tue, 26 Mar 2019 15:41:45 +0000 (15:41 +0000)]
[RISCV] Update setcc-logic.ll codegen test
This should have been updated as part of D59753.
llvm-svn: 357002
Fangrui Song [Tue, 26 Mar 2019 15:39:45 +0000 (15:39 +0000)]
[CodeGen] Delete never used LValueAlign
It was added by rC176658 but never used since then.
llvm-svn: 357001
Andrea Di Biagio [Tue, 26 Mar 2019 15:38:37 +0000 (15:38 +0000)]
[MCA] Correctly update the UsedResourceGroups mask in the InstrBuilder.
Found by inspection when looking at the debug output of MCA.
This problem was latent, and none of the upstream models were affected by it.
No functional change intended.
llvm-svn: 357000
Ronald Wampler [Tue, 26 Mar 2019 15:26:15 +0000 (15:26 +0000)]
Test commit: fix typo
llvm-svn: 356999
Michael Kruse [Tue, 26 Mar 2019 15:19:15 +0000 (15:19 +0000)]
[libomptarget] Introduce LIBOMPTARGET_ENABLE_DEBUG cmake option.
At the moment, support for runtime debug output using the
OMPTARGET_DEBUG=1 environment variable is only available with
CMAKE_BUILD_TYPE=Debug builds. The patch allows setting it independently
using the LIBOMPTARGET_ENABLE_DEBUG option, which is enabled by default
depending on CMAKE_BUILD_TYPE. That is, unless this option is set
explicitly, nothing changes. This is the same mechanism used by LLVM for
LLVM_ENABLE_ASSERTIONS.
This patch also removes adding -g -O0 in debug builds, it should be
handled by cmake's CMAKE_{C|CXX}_FLAGS_DEBUG configuration option.
Idea by Hal Finkel
Differential Revision: https://reviews.llvm.org/D55952
llvm-svn: 356998
Jonas Paulsson [Tue, 26 Mar 2019 15:13:48 +0000 (15:13 +0000)]
[SystemZ] Remove LRMux pseudo instruction.
This instruction is unused and not needed.
Review: Ulrich Weigand.
llvm-svn: 356997
Nirav Dave [Tue, 26 Mar 2019 15:08:14 +0000 (15:08 +0000)]
[DAG] Avoid smart constructor-based dangling nodes.
Various SelectionDAG non-combine operations (e.g. the getNode smart
constructor and legalization) may leave dangling nodes by applying
optimizations or not fully pruning unused result values. This can
result in nodes that are never added to the worklist and therefore can
not be pruned.
Add a node inserter as the current node deleter to make sure such
nodes have the chance of being pruned.
Many minor changes, mostly positive.
llvm-svn: 356996
Serge Guelton [Tue, 26 Mar 2019 14:46:15 +0000 (14:46 +0000)]
python 2/3 compat: commands vs subprocess
Differential Revision: https://reviews.llvm.org/D59584
llvm-svn: 356995
Mikhail R. Gadelha [Tue, 26 Mar 2019 14:25:12 +0000 (14:25 +0000)]
Moved body of methods dump to .cpp file to fix compilation when modules
are enabled
llvm-svn: 356994
Pavel Labath [Tue, 26 Mar 2019 13:35:54 +0000 (13:35 +0000)]
Remove the TypePair class
Summary:
After D59297, the TypePair class kind of lost its purpose as it was no
longer a "pair". This finishes the job started in that patch and deletes
the class altogether. All usages have been updated to use CompilerType
class directly.
Reviewers: clayborg, jingham, zturner
Subscribers: mehdi_amini, dexonsmith, jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D59414
llvm-svn: 356993
Pavel Labath [Tue, 26 Mar 2019 13:23:01 +0000 (13:23 +0000)]
Minidump: Use minidump types defined in llvm
This is the next step in moving the minidump parsing into llvm. I remove
the minidump structures already defined in the llvm Object library and
convert our parser to use those. NFC.
llvm-svn: 356992
Luis Marques [Tue, 26 Mar 2019 12:55:00 +0000 (12:55 +0000)]
[RISCV] Improve codegen for icmp {ne,eq} with a constant
Adds two patterns to improve the codegen of GPR value comparisons with small
constants. Instead of first loading the constant into another register and then
doing an XOR of those registers, these patterns directly use the constant as an
XORI immediate.
llvm-svn: 356990
Simon Pilgrim [Tue, 26 Mar 2019 12:32:01 +0000 (12:32 +0000)]
[TargetLowering] Add SimplifyDemandedBits support for ISD::INSERT_VECTOR_ELT
This helps us relax the extension of a lot of scalar elements before they are inserted into a vector.
Its exposes an issue in DAGCombiner::convertBuildVecZextToZext as some/all the zero-extensions may be relaxed to ANY_EXTEND, so we need to handle that case to avoid a couple of AVX2 VPMOVZX test regressions.
Once this is in it should be easier to fix a number of remaining failures to fold loads into VBROADCAST nodes.
Differential Revision: https://reviews.llvm.org/D59484
llvm-svn: 356989
Yi Kong [Tue, 26 Mar 2019 12:18:08 +0000 (12:18 +0000)]
Fix nondeterminism introduced in r353954
DenseMap iteration order is not guaranteed, use MapVector instead.
Fix provided by srhines.
Differential Revision: https://reviews.llvm.org/D59807
llvm-svn: 356988
Anastasia Stulova [Tue, 26 Mar 2019 11:22:37 +0000 (11:22 +0000)]
[OpenCL] Allow variadic macros as Clang feature.
llvm-svn: 356987
Javed Absar [Tue, 26 Mar 2019 11:16:01 +0000 (11:16 +0000)]
[TableGen] Let list elements have a trailing comma
Let lists have an trailing comma to allow cleaner diffs e.g:
def : Features<[FeatureA,
FeatureB,
]>;
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D59247
llvm-svn: 356986
Javed Absar [Tue, 26 Mar 2019 10:49:09 +0000 (10:49 +0000)]
[TableGen] Give meaningful msg for def use in multiclass
When one mistakenly specifies 'def' instead of using 'defm',
the error message is quite misleading: 'Couldn't find class..'
Instead, it should recommend using defm if the multiclass of
same name exists.
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D59294
llvm-svn: 356985
Oliver Stannard [Tue, 26 Mar 2019 10:24:03 +0000 (10:24 +0000)]
[ARM][Asm] Accept upper case coprocessor number and registers
Differential revision: https://reviews.llvm.org/D59760
llvm-svn: 356984
Sylvestre Ledru [Tue, 26 Mar 2019 09:48:23 +0000 (09:48 +0000)]
update the release notes after the change of 'clang -dumpversion'
llvm-svn: 356983
Martin Storsjo [Tue, 26 Mar 2019 09:02:44 +0000 (09:02 +0000)]
[llvm-dlltool] Set a proper machine type for weak symbol object files
This makes GNU binutils not reject the libraries outright.
GNU ld handles weak externals slightly differently though, so it
can't use them for aliases in import libraries, but this makes GNU
ld able to use the rest of the import libraries.
LLD accepted object files with machine type 0 aka
IMAGE_FILE_MACHINE_UNKNOWN.
Differential Revision: https://reviews.llvm.org/D59742
llvm-svn: 356982
Roger Ferrer Ibanez [Tue, 26 Mar 2019 08:01:18 +0000 (08:01 +0000)]
[RISCV] Pass -target-abi to -cc1as
The RISC-V assembler needs the target ABI because it defines a flag of the ELF
file, as described in [1].
Make clang (the driver) to pass the target ABI to -cc1as in exactly the same
way it does for -cc1.
Currently -cc1as knows about -target-abi but is not handling it. Handle it and
pass it to the MC layer via MCTargetOptions.
[1] https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#file-header
Differential Revision: https://reviews.llvm.org/D59298
llvm-svn: 356981
Fangrui Song [Tue, 26 Mar 2019 05:33:52 +0000 (05:33 +0000)]
[ADT] Update SmallVectorTest.EmplaceBack tests after rL356312
rL356312 changed the return type of emplace_back from void to reference.
Update the tests to check the behavior.
Reviewers: dblaikie
Reviewed By: dblaikie
Subscribers: dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59809
llvm-svn: 356980
Craig Topper [Tue, 26 Mar 2019 05:31:32 +0000 (05:31 +0000)]
[X86] In matchBitExtract, place all of the new nodes before Node's position in the DAG for the topological sort.
We were using OrigNBits, but that put all the nodes before the node we used to start the control computation. This caused some node earlier than the sequence we inserted to be selected before the sequence we created. We want our new sequence to be selected first since it depends on OrigNBits.
I don't have a test case. Found by reviewing the code.
llvm-svn: 356979
Craig Topper [Tue, 26 Mar 2019 05:12:23 +0000 (05:12 +0000)]
[X86] In matchBitExtract, if we need to truncate the BEXTR make sure we put the BEXTR at Node's position in the DAG for the topological sort.
We were using OrigNBits, but that doesn't guarantee that it will be selected before the nodes that make up X.
llvm-svn: 356978
Craig Topper [Tue, 26 Mar 2019 05:12:21 +0000 (05:12 +0000)]
[X86] Remove unneeded FIXME. NFC
We do fold loads right below this.
llvm-svn: 356977
Thomas Lively [Tue, 26 Mar 2019 04:11:05 +0000 (04:11 +0000)]
Reland "[WebAssembly] Add linker options to control feature checking"
Do not pipe binary data between processes in lit tests this time,
since it turns out that can break on Windows.
This reverts commit
84c8652fc3085155d0f9c355455e5a797c6d9db6.
llvm-svn: 356975