Richard Smith [Wed, 1 Aug 2018 01:03:33 +0000 (01:03 +0000)]
Avoid exposing name for range-based for '__range' variables in lifetime warnings.
llvm-svn: 338467
Michael Kruse [Wed, 1 Aug 2018 00:48:01 +0000 (00:48 +0000)]
[JSONExporter] Try to appease buildbot. NFC.
The compiler does not seem to able move a local variable in the
function's return statement.
llvm-svn: 338466
Eli Friedman [Wed, 1 Aug 2018 00:37:20 +0000 (00:37 +0000)]
[MachineOutliner] Clean up subtarget handling.
Call shouldOutlineFromFunctionByDefault, isFunctionSafeToOutlineFrom,
getOutliningType, and getMachineOutlinerMBBFlags using the correct
TargetInstrInfo. And don't create a MachineFunction for a function
declaration.
The call to getOutliningCandidateInfo is still a little weird, but at
least the weirdness is explicitly called out.
Differential Revision: https://reviews.llvm.org/D49880
llvm-svn: 338465
Richard Smith [Wed, 1 Aug 2018 00:33:25 +0000 (00:33 +0000)]
[P0936R0] add [[clang::lifetimebound]] attribute
This patch adds support for a new attribute, [[clang::lifetimebound]], that
indicates that the lifetime of a function result is related to one of the
function arguments. When walking an initializer to make sure that the lifetime
of the initial value is at least as long as the lifetime of the initialized
object, we step through parameters (including the implicit object parameter of
a non-static member function) that are marked with this attribute.
There's nowhere to write an attribute on the implicit object parameter, so in
lieu of that, it may be applied to a function type (where it appears
immediately after the cv-qualifiers and ref-qualifier, which is as close to a
declaration of the implicit object parameter as we have). I'm currently
modeling this in the AST as the attribute appertaining to the function type.
Differential Revision: https://reviews.llvm.org/D49922
llvm-svn: 338464
Evandro Menezes [Wed, 1 Aug 2018 00:30:43 +0000 (00:30 +0000)]
[PATCH] [SLC] Test simplification of pow() for vector types (NFC)
Add test case for the simplification of `pow()` for vector types that D50035
enables.
llvm-svn: 338463
Michael Kruse [Wed, 1 Aug 2018 00:27:29 +0000 (00:27 +0000)]
[Polly-ACC] Fix compilation after r338450. NFC.
llvm-svn: 338462
Michael Kruse [Wed, 1 Aug 2018 00:15:16 +0000 (00:15 +0000)]
[JSONExporter] Replace bundled Jsoncpp with llvm/Support/JSON.h. NFC.
Differential Revision: https://reviews.llvm.org/D49950
llvm-svn: 338461
Eric Christopher [Tue, 31 Jul 2018 23:53:24 +0000 (23:53 +0000)]
Android is an environment and we were comparing the android triple
against the OS rather than the environment. Also update other
uses of OS when we meant environment in the android local code.
NFC intended.
llvm-svn: 338460
Eric Christopher [Tue, 31 Jul 2018 23:53:24 +0000 (23:53 +0000)]
Tidy up comment.
llvm-svn: 338459
Eric Christopher [Tue, 31 Jul 2018 23:53:23 +0000 (23:53 +0000)]
Use UnknownVendor rather than UnknownArch since they're in two different enums
and we're switching on vendor and not arch.
llvm-svn: 338458
Marshall Clow [Tue, 31 Jul 2018 23:39:12 +0000 (23:39 +0000)]
Final bit of P0063 - make sure that aligned_alloc is available when the underlying C library supports it
llvm-svn: 338457
Matt Davis [Tue, 31 Jul 2018 23:37:24 +0000 (23:37 +0000)]
[compiler-rt] Add a routine to specify the mode used when creating profile dirs.
Summary:
This patch introduces `llvm_profile_set_dir_mode` and `llvm_profile_get_dir_mode` to
the compiler-rt profile API.
Originally, profile data was placed into a directory that was created with a hard-coded
mode value of 0755 (for non-win32 builds). In certain cases, it can be helpful to create
directories with a different mode other than 0755. This patch introduces set/get
routines to allow users to specify a desired mode. The default remains at 0755.
Reviewers: void, probinson
Reviewed By: probinson
Subscribers: probinson, dberris, cfe-commits
Differential Revision: https://reviews.llvm.org/D49953
llvm-svn: 338456
Richard Smith [Tue, 31 Jul 2018 23:35:09 +0000 (23:35 +0000)]
[constexpr] Support for constant evaluation of __builtin_memcpy and
__builtin_memmove (in non-type-punning cases).
This is intended to permit libc++ to make std::copy etc constexpr
without sacrificing the optimization that uses memcpy on
trivially-copyable types.
__builtin_strcpy and __builtin_wcscpy are not handled by this change.
They'd be straightforward to add, but we haven't encountered a need for
them just yet.
llvm-svn: 338455
Marshall Clow [Tue, 31 Jul 2018 23:29:06 +0000 (23:29 +0000)]
Test for the presence of a bunch of new macros for c++17. These macros come from C11. Part of P0063
llvm-svn: 338454
Marco Castelluccio [Tue, 31 Jul 2018 23:26:50 +0000 (23:26 +0000)]
[gcov] Add tests using switch, one with break clauses and one with fallthrough
llvm-svn: 338453
Reid Kleckner [Tue, 31 Jul 2018 23:09:42 +0000 (23:09 +0000)]
Revert r338354 "[ARM] Revert r337821"
Disable ARMCodeGenPrepare by default again. It is causing verifier
failues in V8 that look like:
Duplicate integer as switch case
switch i32 %trunc, label %if.end13 [
i32 0, label %cleanup36
i32 0, label %if.then8
], !dbg !4981
i32 0
fatal error: error in backend: Broken function found, compilation aborted!
I will continue reducing the test case and send it along.
llvm-svn: 338452
Michael Kruse [Tue, 31 Jul 2018 23:01:50 +0000 (23:01 +0000)]
[CodeGen] Convert IslNodeBuilder::getNumberOfIterations to isl++. NFC.
llvm-svn: 338451
Michael Kruse [Tue, 31 Jul 2018 22:43:04 +0000 (22:43 +0000)]
[CodeGen] Convert IslNodeBuilder::createForSequential to isl++. NFC.
llvm-svn: 338450
Michael Kruse [Tue, 31 Jul 2018 22:42:59 +0000 (22:42 +0000)]
[CodeGen] Convert IslNodeBuilder::getUpperBound to isl++. NFC.
llvm-svn: 338449
David L. Jones [Tue, 31 Jul 2018 22:24:14 +0000 (22:24 +0000)]
[WebAssembly] Fix debug info tests after r338437.
After r338437, debug_ranges are no longer emitted. Previously, this was only
done for DWARF version 5 and above.
llvm-svn: 338448
Victor Leschuk [Tue, 31 Jul 2018 22:19:19 +0000 (22:19 +0000)]
[DWARF] Support for .debug_addr (consumer)
This patch implements basic support for parsing
and dumping DWARFv5 .debug_addr section.
llvm-svn: 338447
Evandro Menezes [Tue, 31 Jul 2018 22:11:02 +0000 (22:11 +0000)]
[SLC] Refactor the simplication of pow() (NFC)
Reword comments and minor code reformatting.
llvm-svn: 338446
Rumeet Dhindsa [Tue, 31 Jul 2018 21:58:26 +0000 (21:58 +0000)]
Allow oformat to accept format starting with elf as acceptable format. isOutputFormatBinary returns false in such case.
Example: --oformat elf64-x86-64
Differential Revision: https://reviews.llvm.org/D50105
llvm-svn: 338445
Reid Kleckner [Tue, 31 Jul 2018 21:57:35 +0000 (21:57 +0000)]
Revert r337635 "[Driver] Sanitizer support based on runtime library presence"
This change causes issues with distributed build systems, which may only
have compiler binaries without any runtime libraries. See discussion
about this on https://reviews.llvm.org/D15225.
llvm-svn: 338444
Fangrui Song [Tue, 31 Jul 2018 21:26:35 +0000 (21:26 +0000)]
[llvm-objcopy] Make --strip-debug strip .gdb_index
Summary:
See binutils-gdb/bfd/elf.c, GNU objcopy also strips .stab* (STABS)
.line* (DWARF 1) .gnu.linkonce.wi.* (linkonce section for .debug_info) but
I'm not sure we need to be compatible with it.
Reviewers: dblaikie, alexshap, jakehehrlich, jhenderson
Reviewed By: alexshap, jakehehrlich
Subscribers: aprantl, JDevlieghere, jakehehrlich, llvm-commits
Differential Revision: https://reviews.llvm.org/D50100
llvm-svn: 338443
George Burgess IV [Tue, 31 Jul 2018 21:18:44 +0000 (21:18 +0000)]
Revert r338431: "Add DebugCounters to DivRemPairs"
This reverts r338431; the test it added is making buildbots unhappy.
Locally, I can repro the failure on reverse-iteration builds.
llvm-svn: 338442
Artem Dergachev [Tue, 31 Jul 2018 21:17:40 +0000 (21:17 +0000)]
[analyzer] Fix eliding the same destructor twice due to buggy default arguments.
Because of incomplete support for CXXDefaultArgExpr, we cannot yet commit to
asserting that the same destructor won't be elided twice.
Suppress the assertion failure for now. Proper support is still an open problem.
Differential Revision: https://reviews.llvm.org/D49213
llvm-svn: 338441
David L. Jones [Tue, 31 Jul 2018 21:15:58 +0000 (21:15 +0000)]
[lld] Fix test RUN commands so they don't fail when run in a read-only filesystem.
Some test setups run tests in a read-only path, which means that opening the
default output path (a.out) for write will fail. This change adds appropriate -o
flags so the tests will not fail spuriously.
llvm-svn: 338440
Artem Dergachev [Tue, 31 Jul 2018 21:12:42 +0000 (21:12 +0000)]
[CFG] [analyzer] NFC: Enumerate construction context layer kinds.
This is a refactoring patch; no functional change intended.
The common part of ConstructionContextLayer and ConstructedObjectKey is
factored out into a new structure, ConstructionContextItem.
Various sub-kinds of ConstructionContextItem are enumerated in order to
provide richer information about construction contexts.
Differential Revision: https://reviews.llvm.org/D49210.
llvm-svn: 338439
Richard Smith [Tue, 31 Jul 2018 21:01:53 +0000 (21:01 +0000)]
[serialization] PR34728: Don't assume that only a suffix of template
parameters can have default arguments.
At least for function templates and class template partial
specializations, it's possible for a template parameter with a default
argument to be followed by a non-pack template parameter with no default
argument, and this case was not properly handled here.
Testcase by Steve O'Brien!
llvm-svn: 338438
Wolfgang Pieb [Tue, 31 Jul 2018 20:56:32 +0000 (20:56 +0000)]
[DWARF] Do not create a .debug_ranges section when no ranges are needed.
Reviewers: aprantl
Differential Revision: https://reviews.llvm.org/D50089
llvm-svn: 338437
Artem Dergachev [Tue, 31 Jul 2018 20:45:53 +0000 (20:45 +0000)]
[CFG] [analyzer] Implement function argument construction contexts.
In r330377 and r338425 we have already identified what constitutes function
argument constructors and added stubs in order to prevent confusing them
with other temporary object constructors.
Now we implement a ConstructionContext sub-class to carry all the necessary
information about the construction site, namely call expression and argument
index.
On the analyzer side, the patch interacts with the recently implemented
pre-C++17 copy elision support in an interesting manner. If on the CFG side we
didn't find a construction context for the elidable constructor, we build
the CFG as if the elidable constructor is not elided, and the non-elided
constructor within it is a simple temporary. But the same problem may occur
in the analyzer: if the elidable constructor has a construction context but
the analyzer doesn't implement such context yet, the analyzer should also
try to skip copy elision and still inline the non-elided temporary constructor.
This was implemented by adding a "roll back" mechanism: when elision fails,
roll back the changes and proceed as if it's a simple temporary. The approach
is wonky, but i'm fine with that as long as it's merely a defensive mechanism
that should eventually go away once all construction contexts become supported.
Differential Revision: https://reviews.llvm.org/D48681.
llvm-svn: 338436
Matt Arsenault [Tue, 31 Jul 2018 20:38:42 +0000 (20:38 +0000)]
AMDGPU: Split amdgcn/r600 fminnum/fmaxnum tests
R600 breaks on too many things to usefully test changes
with ieee_mode on vs. off.
llvm-svn: 338435
Peter Collingbourne [Tue, 31 Jul 2018 20:36:17 +0000 (20:36 +0000)]
ELF: Add libcall symbols to the link when LTO is being used.
If any of our inputs are bitcode files, the LTO code generator may create
references to certain library functions that might not be explicit in the
bitcode file's symbol table. If any of those library functions are defined
in a bitcode file in an archive member, we need to arrange to use LTO to
compile those archive members by adding them to the link beforehand.
Differential Revision: https://reviews.llvm.org/D50017
llvm-svn: 338434
Reka Kovacs [Tue, 31 Jul 2018 20:27:11 +0000 (20:27 +0000)]
[analyzer] Move InnerPointerChecker out of alpha.
Differential Revision: https://reviews.llvm.org/D49058
llvm-svn: 338433
Alexey Sotkin [Tue, 31 Jul 2018 20:26:43 +0000 (20:26 +0000)]
[OpenCL] Forbid size dependent types used as kernel arguments
Summary:
Size_t, intptr_t, uintptr_t and ptrdiff_t cannot be used as kernel
arguments, according to OpenCL Specification s6.9k:
The size in bytes of these types are implementation-defined and in
addition can also be different for the OpenCL device and the host
processor making it difficult to allocate buffer objects to be passed
as arguments to a kernel declared as pointer to these types.
Patch by: Andrew Savonichev
Reviewers: Anastasia, yaxunl
Subscribers: yaxunl, Anastasia, cfe-commits
Differential Revision: https://reviews.llvm.org/D49725
llvm-svn: 338432
George Burgess IV [Tue, 31 Jul 2018 20:07:46 +0000 (20:07 +0000)]
Add DebugCounters to DivRemPairs
For people who don't use DebugCounters, NFCI.
Patch by Zhizhou Yang!
Differential Revision: https://reviews.llvm.org/D50033
llvm-svn: 338431
Matt Davis [Tue, 31 Jul 2018 20:05:08 +0000 (20:05 +0000)]
[llvm-mca] Update the help text to reflect "physical" registers. NFC.
llvm-svn: 338430
Jonas Paulsson [Tue, 31 Jul 2018 19:58:42 +0000 (19:58 +0000)]
[SystemZ] Fix bad assert composition.
Use '&&' before the string instead of '||'
llvm-svn: 338429
Matt Arsenault [Tue, 31 Jul 2018 19:51:20 +0000 (19:51 +0000)]
DAG: Correct pointer type used for stack slot
Correct the address space for the inserted argument
stack slot.
AMDGPU seems to not do anything with this information,
so I don't think this was breaking anything.
llvm-svn: 338428
Alexey Sotkin [Tue, 31 Jul 2018 19:47:19 +0000 (19:47 +0000)]
[OpenCL] Check for invalid kernel arguments in array types
Summary:
OpenCL specification forbids use of several types as kernel arguments.
This patch improves existing diagnostic to look through arrays.
Patch by: Andrew Savonichev
Reviewers: Anastasia, yaxunl
Subscribers: yaxunl, Anastasia, cfe-commits
Differential Revision: https://reviews.llvm.org/D49723
llvm-svn: 338427
Artem Dergachev [Tue, 31 Jul 2018 19:46:14 +0000 (19:46 +0000)]
[CFG] [analyzer] Add construction contexts for returning C++ objects in ObjC++.
Like any normal funciton, Objective-C message can return a C++ object
in Objective-C++. Such object would require a construction context.
This patch, therefore, is an extension of r327343 onto Objective-C++.
Differential Revision: https://reviews.llvm.org/D48608
llvm-svn: 338426
Artem Dergachev [Tue, 31 Jul 2018 19:39:37 +0000 (19:39 +0000)]
[CFG] [analyzer] Add stubs for constructor and message argument constructors.
CFG now correctly identifies construction context for temporaries constructed
for the purpose of passing into a function as an argument.
Such context is still not fully implemented because the information it provides
is not rich enough: it doens't contain information about argument index.
It will be addresssed later.
This patch is an extension of r330377 to C++ construct-expressions and
Objective-C message expressions which aren't call-expressions but require
similar handling. C++ new-expressions with placement arguments still remain to
be handled.
Differential Revision: https://reviews.llvm.org/D49826
llvm-svn: 338425
Wolfgang Pieb [Tue, 31 Jul 2018 19:37:29 +0000 (19:37 +0000)]
[DWARF] Change a test to ensure the creation of a __debug_ranges section.
Reviewer: aprantl
llvm-svn: 338424
Alexandre Ganea [Tue, 31 Jul 2018 19:30:03 +0000 (19:30 +0000)]
[CodeView] Add coverage test for r338308 (Fixed crash in type merging)
llvm-svn: 338423
Artem Dergachev [Tue, 31 Jul 2018 19:29:25 +0000 (19:29 +0000)]
[analyzer] Reuse some code in simplifySVal().
No functional change intended.
Differential Revision: https://reviews.llvm.org/D49826
llvm-svn: 338422
Matt Arsenault [Tue, 31 Jul 2018 19:29:04 +0000 (19:29 +0000)]
AMDGPU: Break 64-bit arguments into 32-bit pieces
llvm-svn: 338421
Artem Dergachev [Tue, 31 Jul 2018 19:26:34 +0000 (19:26 +0000)]
[analyzer] Don't try to simplify mixed Loc/NonLoc expressions.
This fix is similar to r337769 and addresses a regression caused by r337167.
When an operation between a nonloc::LocAsInteger and a non-pointer symbol
is performed, the LocAsInteger-specific part of information is lost.
When the non-pointer symbol is collapsing into a constant, we cannot easily
re-evaluate the result, because we need to recover the missing
LocAsInteger-specific information (eg., integer type, or the very fact that
this pointer was at some point converted to an integer).
Add one more defensive check to prevent crashes on trying to simplify a
SymSymExpr with different Loc-ness of operands.
Differential Revision:
llvm-svn: 338420
Marshall Clow [Tue, 31 Jul 2018 19:25:00 +0000 (19:25 +0000)]
import timespec and timespec_get into namespace std if we're under c++17 or later AND the underlying C library has them. Fixes PR#38220, but doesn't implement all of P0063 yet.
llvm-svn: 338419
Matt Arsenault [Tue, 31 Jul 2018 19:17:47 +0000 (19:17 +0000)]
AMDGPU: Split wide vectors of i16/f16 into 32-bit regs on calls
This improves code for the same reasons as scalarizing 32-bit
element vectors.
llvm-svn: 338418
Alexandre Ganea [Tue, 31 Jul 2018 19:15:50 +0000 (19:15 +0000)]
[CodeView] Minimal support for S_UNAMESPACE records
Differential Revision: https://reviews.llvm.org/D50007
llvm-svn: 338417
Matt Arsenault [Tue, 31 Jul 2018 19:05:14 +0000 (19:05 +0000)]
AMDGPU: Scalarize vector argument types to calls
When lowering calling conventions, prefer to decompose vectors
into the constitute register types. This avoids artifical constraints
to satisfy a wide super-register.
This improves code quality because now optimizations don't need to
deal with the super-register constraint. For example the immediate
folding code doesn't deal with 4 component reg_sequences, so by
breaking the register down earlier the existing immediate folding
code is able to work.
This also avoids the need for the shader input processing code
to manually split vector types.
llvm-svn: 338416
Matt Davis [Tue, 31 Jul 2018 18:59:46 +0000 (18:59 +0000)]
[llvm-mca][docs] Replace "temporary" with "physical registers". NFC.
llvm-svn: 338415
Jonas Hahnfeld [Tue, 31 Jul 2018 18:47:48 +0000 (18:47 +0000)]
Fix riscv32-toolchain.c with CLANG_DEFAULT_CXX_STDLIB
This configuration was (again) broken after r338385 because Clang
might be configured to always use libc++.
llvm-svn: 338414
Alexey Bataev [Tue, 31 Jul 2018 18:27:42 +0000 (18:27 +0000)]
[OPENMP] Change linkage of offloading symbols to support dropping
offload targets.
Changed the linkage of omp_offloading.img_start.<triple> and omp_offloading.img_end.<triple> symbols from external to external weak to allow dropping of some targets during linking.
llvm-svn: 338413
Simon Pilgrim [Tue, 31 Jul 2018 18:24:24 +0000 (18:24 +0000)]
[X86] WriteBSWAP sched classes are reg-reg only.
Don't declare them as X86SchedWritePair when the folded class will never be used.
Note: MOVBE (load/store endian conversion) instructions tend to have a very different behaviour to BSWAP.
llvm-svn: 338412
Marshall Clow [Tue, 31 Jul 2018 18:23:57 +0000 (18:23 +0000)]
Introduce a new test macro TEST_HAS_C11_FEATURES which is set when the underlying C library has C11 features. In C++17, we use those features. <__config> defines a similar macro, _LIBCPP_HAS_C11_FEATURES, but we don't want to use that in the library-independent parts of the tests, so define the new one. Also add a libc++-specific test to make sure the two stay in sync.
llvm-svn: 338411
Andrea Di Biagio [Tue, 31 Jul 2018 18:19:15 +0000 (18:19 +0000)]
[llvm-mca][docs] Improve the "How LLVM-MCA works" section.
llvm-svn: 338410
Rui Ueyama [Tue, 31 Jul 2018 18:13:36 +0000 (18:13 +0000)]
Simplify. NFC.
llvm-svn: 338409
Vlad Tsyrklevich [Tue, 31 Jul 2018 18:10:37 +0000 (18:10 +0000)]
Revert "[DebugInfo] Generate DWARF debug information for labels."
This reverts commits r338390 and r338398, they were causing LSan
failures on the ASan bot.
llvm-svn: 338408
Simon Pilgrim [Tue, 31 Jul 2018 18:05:56 +0000 (18:05 +0000)]
[X86][SSE] Use ISD::MULHU for constant/non-zero ISD::SRL lowering (PR38151)
As was done for vector rotations, we can efficiently use ISD::MULHU for vXi8/vXi16 ISD::SRL lowering.
Shift-by-zero cases are still problematic (mainly on v32i8 due to extra AND/ANDN/OR or VPBLENDVB blend masks but v8i16/v16i16 aren't great either if PBLENDW fails) so I've limited this first patch to known non-zero cases if we can't easily use PBLENDW.
Differential Revision: https://reviews.llvm.org/D49562
llvm-svn: 338407
Rui Ueyama [Tue, 31 Jul 2018 18:04:58 +0000 (18:04 +0000)]
Make ICF log output order deterministic.
This patch does the same thing as r338153 for COFF.
Note that this patch affects only the order of log messages.
The output file is already deterministic.
Differential Revision: https://reviews.llvm.org/D50023
llvm-svn: 338406
Mandeep Singh Grang [Tue, 31 Jul 2018 17:42:05 +0000 (17:42 +0000)]
[COFF, ARM64] Enable SEH for ARM64 Windows
Reviewers: rnk, mstorsjo, ssijaric, haripul, TomTan
Reviewed By: rnk
Subscribers: kristof.beyls, chrib, cfe-commits
Differential Revision: https://reviews.llvm.org/D50029
llvm-svn: 338405
Simon Pilgrim [Tue, 31 Jul 2018 17:33:08 +0000 (17:33 +0000)]
[llvm-mca][x86] Add 32-bit instruction resource tests
These aren't exhaustive, but cover some instructions that are only available in 32-bit mode (where would we be without good BCD math performance?).
llvm-svn: 338404
Zachary Turner [Tue, 31 Jul 2018 17:16:44 +0000 (17:16 +0000)]
Resubmit r338340 "[MS Demangler] Better demangling of template arguments."
This broke the build with GCC, but has since been fixed.
llvm-svn: 338403
Craig Topper [Tue, 31 Jul 2018 17:12:08 +0000 (17:12 +0000)]
[X86] Add pattern matching for PMADDUBSW
Summary:
Similar to D49636, but for PMADDUBSW. This instruction has the additional complexity that the addition of the two products saturates to 16-bits rather than wrapping around. And one operand is treated as signed and the other as unsigned.
A C example that triggers this pattern
```
static const int N = 128;
int8_t A[2*N];
uint8_t B[2*N];
int16_t C[N];
void foo() {
for (int i = 0; i != N; ++i)
C[i] = MIN(MAX((int16_t)A[2*i]*(int16_t)B[2*i] + (int16_t)A[2*i+1]*(int16_t)B[2*i+1], -32768), 32767);
}
```
Reviewers: RKSimon, spatel, zvi
Reviewed By: RKSimon, zvi
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49829
llvm-svn: 338402
Craig Topper [Tue, 31 Jul 2018 17:12:06 +0000 (17:12 +0000)]
[X86] Add test cases that could use PMADDUBSW.
llvm-svn: 338401
Francis Visoiu Mistrih [Tue, 31 Jul 2018 16:41:12 +0000 (16:41 +0000)]
[X86] Preserve more liveness information in emitStackProbeInline
This commit fixes two issues with the liveness information after the
call:
1) The code always spills RCX and RDX if InProlog == true, which results
in an use of undefined phys reg.
2) FinalReg, JoinReg, RoundedReg, SizeReg are not added as live-ins to
the basic blocks that use them, therefore they are seen undefined.
https://llvm.org/PR38376
Differential Revision: https://reviews.llvm.org/D50020
llvm-svn: 338400
Alexey Bataev [Tue, 31 Jul 2018 16:40:15 +0000 (16:40 +0000)]
[OPENMP] Prevent problems with linking of the static variables.
No need to change the linkage, we can avoid the problem using special variable. That points to the original variable and, thus, prevent some of the optimizations that might break the compilation.
llvm-svn: 338399
Hsiangkai Wang [Tue, 31 Jul 2018 16:22:09 +0000 (16:22 +0000)]
[DebugInfo] Fix build failed in 'clang-cmake-armv8-full'.
Builder clang-cmake-armv8-full failed due to the assembly 'comment'
notation is not '#' in the target. So, I use CHECK-SAME to avoid to
check the comment notation in the same line in the test case.
llvm-svn: 338398
Jakub Kuderski [Tue, 31 Jul 2018 15:53:10 +0000 (15:53 +0000)]
[Dominators] Make slow walks shorter
Summary:
When DFS numbers are not yet calculated for a dominator tree, we have to walk it up to say whether one node dominates some other.
This patch makes the slow walks shorter by only walking until the level of the node we check against is reached. This is because a node cannot possibly dominate something higher in its tree.
When running opt with -O3, the patch results in:
* 25% fewer loop iterations for `opt` (fullLTO)
* 30% fewer loop iterations for sqlite
Reviewers: brzycki, asbirlea, chandlerc, NutshellySima, grosser
Reviewed By: NutshellySima
Subscribers: mehdi_amini, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D49955
llvm-svn: 338396
Ewan Crawford [Tue, 31 Jul 2018 15:53:03 +0000 (15:53 +0000)]
Fix InstCombine address space assert
Workaround bug where the InstCombine pass was asserting on the IR added in lit
test, where we have a bitcast instruction after a GEP from an addrspace cast.
The second bitcast in the test was getting combined into
`bitcast <16 x i32>* %0 to <16 x i32> addrspace(3)*`, which looks like it should
be an addrspace cast instruction instead. Otherwise if control flow is allowed
to continue as it is now we create a GEP instruction
`<badref> = getelementptr inbounds <16 x i32>, <16 x i32>* %0, i32 0`. However
because the type of this instruction doesn't match the address space we hit an
assert when replacing the bitcast with that GEP.
```
void llvm::Value::doRAUW(llvm::Value*, bool): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed.
```
Differential Revision: https://reviews.llvm.org/D50058
llvm-svn: 338395
Andrea Di Biagio [Tue, 31 Jul 2018 15:29:10 +0000 (15:29 +0000)]
[llvm-mca][docs] Always use `llvm-mca` in place of `MCA`.
llvm-svn: 338394
Jonas Toth [Tue, 31 Jul 2018 15:23:49 +0000 (15:23 +0000)]
[clang-tidy] add all clang-tidy modules to plugin
Summary:
This patch addresses PR38359 and adds all existing clang-tidy
modules to the plugin that can be used together with libclang.
Reviewers: alexfh, aaron.ballman, hokein, ilya-biryukov
Reviewed By: alexfh
Subscribers: srhines, mgorny, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D50060
llvm-svn: 338393
Sanjay Patel [Tue, 31 Jul 2018 15:07:32 +0000 (15:07 +0000)]
[InstCombine] regenerate checks and add tests for D50035; NFC
llvm-svn: 338392
Anastasis Grammenos [Tue, 31 Jul 2018 14:54:52 +0000 (14:54 +0000)]
[DebugInfo][LCSSA] Preserve debug location in lcssa phis
Summary:
When inserting lcssa Phi Nodes in the exit block
mak sure to preserve the original instructions DL.
Reviewers: vsk
Subscribers: JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D50009
llvm-svn: 338391
Hsiangkai Wang [Tue, 31 Jul 2018 14:48:32 +0000 (14:48 +0000)]
[DebugInfo] Generate DWARF debug information for labels.
There are two forms for label debug information in DWARF format.
1. Labels in a non-inlined function:
DW_TAG_label
DW_AT_name
DW_AT_decl_file
DW_AT_decl_line
DW_AT_low_pc
2. Labels in an inlined function:
DW_TAG_label
DW_AT_abstract_origin
DW_AT_low_pc
We will collect label information from DBG_LABEL. Before every DBG_LABEL,
we will generate a temporary symbol to denote the location of the label.
The symbol could be used to get DW_AT_low_pc afterwards. So, we create a
mapping between 'inlined label' and DBG_LABEL MachineInstr in DebugHandlerBase.
The DBG_LABEL in the mapping is used to query the symbol before it.
The AbstractLabels in DwarfCompileUnit is used to process labels in inlined
functions.
We also keep a mapping between scope and labels in DwarfFile to help to
generate correct tree structure of DIEs.
It also generates label debug information under global isel.
Differential Revision: https://reviews.llvm.org/D45556
llvm-svn: 338390
David Bolvansky [Tue, 31 Jul 2018 14:47:22 +0000 (14:47 +0000)]
Revert Enrich inline messages
llvm-svn: 338389
Sanjay Patel [Tue, 31 Jul 2018 14:27:30 +0000 (14:27 +0000)]
[InstCombine] auto-generate checks; NFC
llvm-svn: 338388
David Bolvansky [Tue, 31 Jul 2018 14:25:24 +0000 (14:25 +0000)]
Enrich inline messages
Summary:
This patch improves Inliner to provide causes/reasons for negative inline decisions.
1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message.
2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision.
3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost.
4. Adjusted tests for changed printing.
Patch by: yrouban (Yevgeny Rouban)
Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00
Reviewed By: tejohnson, xbolva00
Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith
Differential Revision: https://reviews.llvm.org/D49412
llvm-svn: 338387
Andrea Di Biagio [Tue, 31 Jul 2018 14:23:49 +0000 (14:23 +0000)]
[llvm-mca] Remove README.txt
A detailed description of the tool has been recently added by Matt to
CommandGuide/llvm-mca.rst. File README.txt is now redundant and can be removed;
all the relevant user-guide information has been improved and then moved to
llvm-mca.rst.
In future, we should add another .rst for the "llvm-mca developer manual" to
provide infromation about:
- llvm-mca internals.
- How to add custom stages to the simulated pipeline.
- How to provide extra processor info in the scheduling model to improve the
analysis performed by llvm-mca.
llvm-svn: 338386
David Bolvansky [Tue, 31 Jul 2018 14:21:46 +0000 (14:21 +0000)]
[RISCV] Add driver for riscv32-unknown-elf baremetal target
Summary:
This patch adds a driver for the baremetal RISC-V target (i.e. riscv32-unknown-elf). For reference, D39963 added basic target info and added support for riscv32-linux-unknown-elf.
Patch by: asb (Alex Bradbury)
Reviewers: efriedma, phosek, apazos, espindola, mgrang
Reviewed By: mgrang
Subscribers: jrtc27, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, emaste, mgorny, arichardson, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, cfe-commits
Differential Revision: https://reviews.llvm.org/D46822
llvm-svn: 338385
John Brawn [Tue, 31 Jul 2018 14:19:29 +0000 (14:19 +0000)]
[MemDep] Use PhiValuesAnalysis to improve alias analysis results
This is being done in order to make GVN able to better optimize certain inputs.
MemDep doesn't use PhiValues directly, but does need to notifiy it when things
get invalidated.
Differential Revision: https://reviews.llvm.org/D48489
llvm-svn: 338384
David Bolvansky [Tue, 31 Jul 2018 14:17:15 +0000 (14:17 +0000)]
[InstSimplify] Fold another Select with And/Or pattern
Summary: Proof: https://rise4fun.com/Alive/L5J
Reviewers: lebedev.ri, spatel
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49975
llvm-svn: 338383
Matt Arsenault [Tue, 31 Jul 2018 14:15:22 +0000 (14:15 +0000)]
DAG: Fix PromoteFloatResult for fcanonicalize
llvm-svn: 338382
Matt Arsenault [Tue, 31 Jul 2018 14:15:16 +0000 (14:15 +0000)]
AMDGPU: Don't handle FP16_TO_FP in isCanonicalized
This needs more special handling to do correctly.
Fixes test in subsequent commit.
llvm-svn: 338381
Alexey Bataev [Tue, 31 Jul 2018 14:02:43 +0000 (14:02 +0000)]
[SLP] Fix PR38339: Instruction does not dominate all uses!
Summary:
If the ExtractElement instructions can be optimized out during the
vectorization and we need to reshuffle the parent vector, this
ShuffleInstruction may be inserted in the wrong place causing compiler
to produce incorrect code.
Reviewers: spatel, RKSimon, mkuper, hfinkel, javed.absar
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D49928
llvm-svn: 338380
George Rimar [Tue, 31 Jul 2018 13:55:25 +0000 (13:55 +0000)]
[LLD][ELF] - ICF: Check we do not fold sections which relocations reffering to absolute symbols with a different values.
This adds a test for the following uncovered piece of code:
https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L263
Without that lines we would crash.
llvm-svn: 338379
Ilya Biryukov [Tue, 31 Jul 2018 13:45:37 +0000 (13:45 +0000)]
[clangd] Do not build AST if no diagnostics were requested
Summary:
It can be removed from the cache before the first access anyway, so
building it can be a waste of time.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: javed.absar, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D49991
llvm-svn: 338378
Peter Smith [Tue, 31 Jul 2018 13:41:59 +0000 (13:41 +0000)]
[ELF][ARM] Implement support for Tag_ABI_VFP_args
The Tag_ABI_VFP_args build attribute controls the procedure call standard
used for floating point parameters on ARM. The values are:
0 - Base AAPCS (FP Parameters passed in Core (Integer) registers
1 - VFP AAPCS (FP Parameters passed in FP registers)
2 - Toolchain specific (Neither Base or VFP)
3 - Compatible with all (No use of floating point parameters)
If the Tag_ABI_VFP_args build attribute is missing it has an implicit value
of 0.
We use the attribute in two ways:
- Detect a clash in calling convention between Base, VFP and Toolchain.
we follow ld.bfd's lead and do not error if there is a clash between an
implicit Base AAPCS caused by a missing attribute. Many projects
including the hard-float (VFP AAPCS) version of glibc contain assembler
files that do not use floating point but do not have Tag_ABI_VFP_args.
- Set the EF_ARM_ABI_FLOAT_SOFT or EF_ARM_ABI_FLOAT_HARD ELF header flag
for Base or VFP AAPCS respectively. This flag is used by some ELF
loaders.
References:
- Addenda to, and Errata in, the ABI for the ARM Architecture for
Tag_ABI_VFP_args
- Elf for the ARM Architecture for ELF header flags
Fixes PR36009
Differential Revision: https://reviews.llvm.org/D49993
llvm-svn: 338377
Matt Arsenault [Tue, 31 Jul 2018 13:34:31 +0000 (13:34 +0000)]
AMDGPU: Fold undef fcanonicalize to qNaN
We could choose a free 0 for this, but this
matches the behavior for fmul undef, 1.0. Also,
the NaN use is more useful for folding use operations
although if it's not eliminated it is more expensive
in terms of code size.
llvm-svn: 338376
George Rimar [Tue, 31 Jul 2018 13:32:16 +0000 (13:32 +0000)]
[LLD][ELF] - ICF: add test case testing we do not fold sections with the different flags. NFCI.
Previously the following condition was not tested at all:
https://github.com/llvm-mirror/lld/blob/master/ELF/ICF.cpp#L300
Patch adds a test for `A->Flags != B->Flags` part.
llvm-svn: 338375
Matt Arsenault [Tue, 31 Jul 2018 13:25:23 +0000 (13:25 +0000)]
AMDGPU: Fix test check line bugs
llvm-svn: 338374
Peter Smith [Tue, 31 Jul 2018 13:24:49 +0000 (13:24 +0000)]
[ARM] Complete enumeration values for Tag_ABI_VFP_args
The LLD implementation of Tag_ABI_VFP_args needs to check the rarely seen
values of 3 (toolchain specific) and 4 compatible with both Base and VFP.
Add the missing enumeration values so that LLD can refer to them without
having to use the raw numbers.
Differential Revision: https://reviews.llvm.org/D50049
llvm-svn: 338373
Andrea Di Biagio [Tue, 31 Jul 2018 13:21:43 +0000 (13:21 +0000)]
[llvm-mca][BtVer2] Teach how to identify dependency-breaking idioms.
This patch teaches llvm-mca how to identify dependency breaking instructions on
btver2.
An example of dependency breaking instructions is the zero-idiom XOR (example:
`XOR %eax, %eax`), which always generates zero regardless of the actual value of
the input register operands.
Dependency breaking instructions don't have to wait on their input register
operands before executing. This is because the computation is not dependent on
the inputs.
Not all dependency breaking idioms are also zero-latency instructions. For
example, `CMPEQ %xmm1, %xmm1` is independent on
the value of XMM1, and it generates a vector of all-ones.
That instruction is not eliminated at register renaming stage, and its opcode is
issued to a pipeline for execution. So, the latency is not zero.
This patch adds a new method named isDependencyBreaking() to the MCInstrAnalysis
interface. That method takes as input an instruction (i.e. MCInst) and a
MCSubtargetInfo.
The default implementation of isDependencyBreaking() conservatively returns
false for all instructions. Targets may override the default behavior for
specific CPUs, and return a value which better matches the subtarget behavior.
In future, we should teach to Tablegen how to automatically generate the body of
isDependencyBreaking from scheduling predicate definitions. This would allow us
to expose the knowledge about dependency breaking instructions to the machine
schedulers (and, potentially, other codegen passes).
Differential Revision: https://reviews.llvm.org/D49310
llvm-svn: 338372
Tim Northover [Tue, 31 Jul 2018 13:19:01 +0000 (13:19 +0000)]
[debuginfo-tests] tweak new test to be compatible with wider range of compilers.
emplace_back was added in C++11, and its usage isn't critical to what's being
tested so using push_back instead will allow this test to work with more
compilers.
llvm-svn: 338371
Peter Smith [Tue, 31 Jul 2018 13:03:54 +0000 (13:03 +0000)]
[ELF][ARM] Add Arm ABI names for float ABI ELF Header flags
The ELF for the Arm architecture document defines, for EF_ARM_EABI_VER5 and
above, the flags EF_ARM_ABI_FLOAT_HARD and EF_ARM_ABI_FLOAT_SOFT. These
have been defined to be compatible with the existing EF_ARM_VFP_FLOAT and
EF_ARM_SOFT_FLOAT used by gcc for EF_ARM_EABI_UNKNOWN.
This patch adds the flags in addition to the existing ones so that any code
depending on the old names will still work.
Differential Revision: https://reviews.llvm.org/D49992
llvm-svn: 338370
Simon Pilgrim [Tue, 31 Jul 2018 13:00:51 +0000 (13:00 +0000)]
Revert r338365: [X86] Improved sched models for X86 BT*rr instructions.
https://reviews.llvm.org/D49243
Contains WIP code that should not have been included.
llvm-svn: 338369
Jonas Paulsson [Tue, 31 Jul 2018 13:00:42 +0000 (13:00 +0000)]
[SystemZ] Improve decoding in case of instructions with four register operands.
Since z13, the max group size will be 2 if any μop has more than 3 register
sources.
This has been ignored sofar in the SystemZHazardRecognizer, but is now
handled by recognizing those instructions and adjusting the tracking of
decoding and the cost heuristic for grouping.
Review: Ulrich Weigand
https://reviews.llvm.org/D49847
llvm-svn: 338368
Sanjay Patel [Tue, 31 Jul 2018 13:00:03 +0000 (13:00 +0000)]
[InstCombine] simplify code for A & (A ^ B) --> A & ~B
This fold was written in an odd way and tried to avoid
an endless loop by bailing out on all constants instead
of the supposedly problematic case of -1. But (X & -1)
should always be simplified before we reach here, so I'm
not sure how that is a problem.
There were no tests for the commuted patterns, so I added
those at rL338364.
llvm-svn: 338367