Commit Graph

329966 Commits

Author SHA1 Message Date
Pavel Labath 0c30491774 SystemInitializerCommon fix compilation on linux
C++ defines two overloads of std::iscntrl. One in <cctype> and one in
<locale>. On linux we seem to include both which makes the std::erase_if
call ambiguous.

Wrap std::iscntrl call in a lambda to ensure regular overload
resolution.

llvm-svn: 375221
2019-10-18 11:47:23 +00:00
Sjoerd Meijer 9c155985f1 [Arm][libsanitizer] Fix arm libsanitizer failure with bleeding edge glibc
Glibc has recently introduced changed to the mode field in ipc_perm in commit
2f959dfe849e0646e27403f2e4091536496ac0f0. For Arm this means that the mode
field no longer has the same size.

This causes an assert failure against libsanitizer's internal copy of ipc_perm.
Since this change can't be easily detected I am adding arm to the list of
targets that are excluded from this check.

Patch by: Tamar Christina

Differential Revision: https://reviews.llvm.org/D69104

llvm-svn: 375220
2019-10-18 11:01:45 +00:00
Eugene Leviant eb34c3e8a4 [ThinLTOCodeGenerator] Add support for index-based WPD
Differential revision: https://reviews.llvm.org/D68950

llvm-svn: 375219
2019-10-18 10:54:14 +00:00
Martin Storsjo b38f577c01 [LLD] [COFF] Try to report source locations for duplicate symbols
This fixes the second part of PR42407.

For files with dwarf debug info, it manually loads and iterates
.debug_info to find the declared location of variables, to allow
reporting them. (This matches the corresponding code in the ELF
linker.)

For functions, it uses the existing getFileLineDwarf which uses
LLVMSymbolizer for translating addresses to file lines.

In object files with codeview debug info, only the source location
of duplicate functions is printed. (And even there, only for the
first input file. The getFileLineCodeView function requires the
object file to be fully loaded and initialized to properly resolve
source locations, but duplicate symbols are reported at a stage when
the second object file isn't fully loaded yet.)

Differential Revision: https://reviews.llvm.org/D68975

llvm-svn: 375218
2019-10-18 10:43:15 +00:00
David Green 651f07908a [AArch64] Don't combine callee-save and local stack adjustment when optimizing for size
For arm64, D18619 introduced the ability to combine bumping the stack pointer
upfront in case it needs to be bumped for both the callee-save area as well as
the local stack area.

That diff already remarks that "This change can cause an increase in
instructions", but argues that even when that happens, it should be still be a
performance benefit because the number of micro-ops is reduced.

We have observed that this code-size increase can be significant in practice.
This diff disables combining stack bumping for methods that are marked as
optimize-for-size.

Example of a prologue with the behavior before this diff (combining stack bumping when possible):
  sub        sp, sp, #0x40
  stp        d9, d8, [sp, #0x10]
  stp        x20, x19, [sp, #0x20]
  stp        x29, x30, [sp, #0x30]
  add        x29, sp, #0x30
  [... compute x8 somehow ...]
  stp        x0, x8, [sp]

And after this  diff, if the method is marked as optimize-for-size:
  stp        d9, d8, [sp, #-0x30]!
  stp        x20, x19, [sp, #0x10]
  stp        x29, x30, [sp, #0x20]
  add        x29, sp, #0x20
  [... compute x8 somehow ...]
  stp        x0, x8, [sp, #-0x10]!

Note that without combining the stack bump there are two auto-decrements,
nicely folded into the stp instructions, whereas otherwise there is a single
sub sp, ... instruction, but not folded.

Patch by Nikolai Tillmann!

Differential Revision: https://reviews.llvm.org/D68530

llvm-svn: 375217
2019-10-18 10:35:46 +00:00
Simon Pilgrim ef04598e14 [X86] Regenerate memcmp tests and add X64-AVX512 common prefix
Should help make the changes in D69157 clearer

llvm-svn: 375215
2019-10-18 09:59:51 +00:00
Simon Pilgrim 3bd61b2655 Fix MSVC "not all control paths return a value" warning. NFCI.
llvm-svn: 375214
2019-10-18 09:59:40 +00:00
Simon Pilgrim da40d4e4e1 Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warnings. NFCI.
llvm-svn: 375213
2019-10-18 09:59:31 +00:00
David Green e6f313b380 [Codegen] Alter the default promotion for saturating adds and subs
The default promotion for the add_sat/sub_sat nodes currently does:
    ANY_EXTEND iN to iM
    SHL by M-N
    [US][ADD|SUB]SAT
    L/ASHR by M-N

If the promoted add_sat or sub_sat node is not legal, this can produce code
that effectively does a lot of shifting (and requiring large constants to be
materialised) just to use the overflow flag. It is simpler to just do the
saturation manually, using the higher bitwidth addition and a min/max against
the saturating bounds. That is what this patch attempts to do.

Differential Revision: https://reviews.llvm.org/D68926

llvm-svn: 375211
2019-10-18 09:47:48 +00:00
Kerry McLaughlin 0c7cc383e5 [AArch64][SVE] Implement unpack intrinsics
Summary:
Implements the following intrinsics:
  - int_aarch64_sve_sunpkhi
  - int_aarch64_sve_sunpklo
  - int_aarch64_sve_uunpkhi
  - int_aarch64_sve_uunpklo

This patch also adds AArch64ISD nodes for UNPK instead of implementing
the intrinsics directly, as they are required for a future patch which
implements the sign/zero extension of legal vectors.

This patch includes tests for the Subdivide2Argument type added by D67549

Reviewers: sdesmalen, SjoerdMeijer, greened, rengolin, rovka

Reviewed By: greened

Subscribers: tschuett, kristof.beyls, rkruppe, psnobl, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D67550

llvm-svn: 375210
2019-10-18 09:40:16 +00:00
Bjorn Pettersson 6456252dbf [InstCombine] Fix miscompile bug in canEvaluateShuffled
Summary:
Add restrictions in canEvaluateShuffled to prevent that we for example
transform

  %0 = insertelement <2 x i16> undef, i16 %a, i32 0
  %1 = srem <2 x i16> %0, <i16 2, i16 1>
  %2 = shufflevector <2 x i16> %1, <2 x i16> undef, <2 x i32> <i32 undef, i32 0>

into

   %1 = insertelement <2 x i16> undef, i16 %a, i32 1
   %2 = srem <2 x i16> %1, <i16 undef, i16 2>

as having an undef denominator makes the srem undefined (for all
vector elements).

Fixes: https://bugs.llvm.org/show_bug.cgi?id=43689

Reviewers: spatel, lebedev.ri

Reviewed By: spatel, lebedev.ri

Subscribers: lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69038

llvm-svn: 375208
2019-10-18 07:42:02 +00:00
Bjorn Pettersson 459134064d [InstCombine] Pre-commit of test case showing miscompile bug in canEvaluateShuffled
Adding the reproducer from  https://bugs.llvm.org/show_bug.cgi?id=43689,
showing that instcombine is doing a bad transform. It transforms

  %0 = insertelement <2 x i16> undef, i16 %a, i32 0
  %1 = srem <2 x i16> %0, <i16 2, i16 1>
  %2 = shufflevector <2 x i16> %1, <2 x i16> undef, <2 x i32> <i32 undef, i32 0>

into

   %1 = insertelement <2 x i16> undef, i16 %a, i32 1
   %2 = srem <2 x i16> %1, <i16 undef, i16 2>

The undef denominator makes the whole srem undefined.

llvm-svn: 375207
2019-10-18 07:41:53 +00:00
Rui Ueyama 9a5ad9bd5a Update release notes
llvm-svn: 375206
2019-10-18 06:11:16 +00:00
Thomas Lively 807cecad5d [WebAssembly] -pthread implies -target-feature +sign-ext
Summary:
The sign extension proposal was motivated by a desire to not have
separate sign-extending atomic operations, so it is meant to be
enabled when threads are used.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69075

llvm-svn: 375199
2019-10-18 04:34:26 +00:00
David Zarzycki 7b9fd37fa1 [X86] Emit KTEST when possible
https://reviews.llvm.org/D69111

llvm-svn: 375197
2019-10-18 03:45:52 +00:00
Julian Lettner a3d2f9b53a [lit] Move resolving of XFAIL result codes out of Test.setResult
This will allow us to serialize just the result object instead of the
whole lit.Test object back from the worker to the main lit process.

llvm-svn: 375195
2019-10-18 00:50:37 +00:00
Julian Lettner 13bf5eb1f4 [lit] worker.py: Improve code for executing a single test
llvm-svn: 375194
2019-10-18 00:50:34 +00:00
Michael Kruse d72637f5cc [ScopBuilder] Fix bug 38358 by preserving correct order of ScopStmts.
ScopBuilder::buildEqivClassBlockStmts creates ScopStmts for instruction
groups in basic block and inserts these ScopStmts into Scop::StmtMap,
however, as described in llvm.org/PR38358, comment #5, StmtScops are
inserted into vector ScopStmt[BB] in wrong order.  As a result,
ScopBuilder::buildSchedule creates wrong order sequence node.

Looking closer to code, it's clear there is no equivalent classes with
interleaving isOrderedInstruction(memory access) instructions after
joinOrderedInstructions.  Afterwards, ScopStmts need to be created and
inserted in the original order of memory access instructions, however,
at the moment ScopStmts are inserted in the order of leader instructions
which are probably not memory access instructions.

The fix is simple with a standalone loop scanning
isOrderedInstruction(memory access) instructions in basic block and
inserting elements into LeaderToInstList one by one.  The patch also
removes double reversing operations which are now unnecessary.

New test preserve-equiv-class-order-in-basic_block.ll is also added.

Differential Revision: https://reviews.llvm.org/D68941

llvm-svn: 375192
2019-10-17 23:55:35 +00:00
Philip Reames 8eaa5b9aba [IndVars] Factor out some common code into a utility function
As requested in review of D69009

llvm-svn: 375191
2019-10-17 23:49:46 +00:00
Philip Reames 3266eac714 [Test] Precommit test for D69006
llvm-svn: 375190
2019-10-17 23:32:35 +00:00
Artem Dergachev 8b3ef1e45b [analyzer] exploded-graph-rewriter: Fix typo in r375186. Unbreaks tests.
llvm-svn: 375189
2019-10-17 23:27:35 +00:00
Raphael Isemann b31c624156 [lldb][NFC] Fix typo in DWARFASTParserClang.cpp
llvm-svn: 375187
2019-10-17 23:11:32 +00:00
Artem Dergachev 14e9eb3d7c [analyzer] Assign truly stable identifiers to exploded nodes.
ExplodedGraph nodes will now have a numeric identifier stored in them
which will keep track of the order in which the nodes were created
and it will be fully deterministic both accross runs and across machines.

This is extremely useful for debugging as it allows reliably setting
conditional breakpoints by node IDs.

llvm-svn: 375186
2019-10-17 23:10:09 +00:00
Artem Dergachev d325196f19 [analyzer] Display cast kinds in program point dumps.
Because cast expressions have their own hierarchy, it's extremely useful
to have some information about what kind of casts are we dealing with.

llvm-svn: 375185
2019-10-17 23:10:05 +00:00
Artem Dergachev 73b67f0b1a [analyzer] exploded-graph-rewriter: Make node headers a bit lighter.
The 50% grey color is too dark on some monitors.

llvm-svn: 375184
2019-10-17 23:10:02 +00:00
David Blaikie 2941cda5be DebugInfo: Move loclist base address from DwarfFile to DebugLocStream
There's no need to have more than one of these (there can be two
DwarfFiles - one for the .o, one for the .dwo - but only one loc/loclist
section (either in the .o or the .dwo) & certainly one per
DebugLocStream, which is currently singular in DwarfDebug)

llvm-svn: 375183
2019-10-17 23:02:19 +00:00
Lawrence D'Anna 03819d1c80 eliminate one form of PythonObject::Reset()
Summary:
I'd like to eliminate all forms of Reset() and all public constructors
on these objects, so the only way to make them is with Take<> and Retain<>
and the only way to copy or move them is with actual c++ copy, move, or
assignment.

This is a simple place to start.

Reviewers: JDevlieghere, clayborg, labath, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D69080

llvm-svn: 375182
2019-10-17 22:22:09 +00:00
Lawrence D'Anna c86a6acaee clean up the implementation of PythonCallable::GetNumArguments
Summary:
The current implementation of PythonCallable::GetNumArguments
is not exception safe, has weird semantics, and is just plain
incorrect for some kinds of functions.

Python 3.3 introduces inspect.signature, which lets us easily
query for function signatures in a sane and documented way.

This patch leaves the old implementation in place for < 3.3,
but uses inspect.signature for modern pythons.   It also leaves
the old weird semantics in place, but with FIXMEs grousing about
it.   We should update the callers and fix the semantics in a
subsequent patch.    It also adds some tests.

Reviewers: JDevlieghere, clayborg, labath, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68995

llvm-svn: 375181
2019-10-17 22:22:06 +00:00
David Blaikie 3d737b642a DebugInfo: Remove unused parameter (from DwarfDebug.cpp:emitListsTableHeaderStart)
llvm-svn: 375180
2019-10-17 22:11:40 +00:00
Eli Friedman 5b0e039a7a [ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 3
It's completely impossible to check that I've actually found all the
issues, due to the use of macros in arm_neon.h, but hopefully this time
it'll take more than a few hours for someone to find another issue.

I have no idea why, but apparently there's a rule that some, but not
all, builtins which should take an fp16 vector actually take an int8
vector as an argument.  Fix this, and add test coverage.

Differential Revision: https://reviews.llvm.org/D68838

llvm-svn: 375179
2019-10-17 21:57:28 +00:00
Jordan Rupprecht 98a2ae7dad Reland [llvm-objdump] Use a counter for llvm-objdump -h instead of the section index.
This relands r374931 (reverted in r375088). It fixes 32-bit builds by using the right format string specifier for uint64_t (PRIu64) instead of `%d`.

Original description:

When listing the index in `llvm-objdump -h`, use a zero-based counter instead of the actual section index (e.g. shdr->sh_index for ELF).

While this is effectively a noop for now (except one unit test for XCOFF), the index values will change in a future patch that filters certain sections out (e.g. symbol tables). See D68669 for more context. Note: the test case in `test/tools/llvm-objdump/X86/section-index.s` already covers the case of incrementing the section index counter when sections are skipped.

Reviewers: grimar, jhenderson, espindola

Reviewed By: grimar

Subscribers: emaste, sbc100, arichardson, aheejin, arphaman, seiya, llvm-commits, MaskRay

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68848

llvm-svn: 375178
2019-10-17 21:55:43 +00:00
Sergey Dmitriev 6caada4eb4 [clang-offload-wrapper][NFC] Use captured name of the entry type in LIT test
Differential Revision: https://reviews.llvm.org/D69140

llvm-svn: 375177
2019-10-17 21:55:39 +00:00
Don Hinton ecb310b3a7 [Error] Make llvm::cantFail include the original error messages
Summary:
The current implementation eats the current errors and just outputs
the message parameter passed to llvm::cantFail.  This change appends
the original error message(s), so the user can see exactly why
cantFail failed.  New logic is conditional on NDEBUG.

Reviewed By: lhames

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69057

llvm-svn: 375176
2019-10-17 21:54:15 +00:00
Stanislav Mekhanoshin befab66a2c [AMDGPU] drop getIsFP td helper
We already have isFloatType helper, and they are out of sync.
Drop one and merge the type list.

Differential Revision: https://reviews.llvm.org/D69138

llvm-svn: 375175
2019-10-17 21:46:56 +00:00
Sterling Augustine bbbc873f83 (NFC) Delete variable made unused by llvm-svn: 375160
Reviewers: aprantl

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69143

llvm-svn: 375174
2019-10-17 21:40:12 +00:00
Raphael Isemann 69b3363a53 [lldb] X-fail tests that use constructors in expressions on Windows
These tests were testing a bug related to constructors. It seems that
on Windows the expression command can't construct objects (or at least,
call their constructor explicitly which is required for the tests), so
this is just x-failing them until Windows actually supports constructor calls.

llvm-svn: 375173
2019-10-17 21:27:26 +00:00
Jonas Devlieghere a0f6c6434c [test] Add a .clang-format file for the shell test.
The API tests have a .clang-format file that disables formatting
altogether. While this is needed for some tests, it also leads to
inconsistency between test files. The shell tests suffer from a similar
problem: a test with a source-file extension (.c, .cpp) will get
formatted, potentially breaking up lines and leading to invalid RUN
commands.

Rather than completely disabling formatting here, I propose to not
enforce a line limit instead. That way tests will be consistent, but you
can still have long run commands (as is not uncommon in LLVM either) and
use breakpoints with patters that extend beyond 80 cols.

Differential revision: https://reviews.llvm.org/D69058

llvm-svn: 375172
2019-10-17 21:23:35 +00:00
Julian Lettner 9a335b6eda [lit] Move computation of deadline up into base class
llvm-svn: 375171
2019-10-17 21:12:45 +00:00
Adrian Prantl 3ebbda0f08 Adapt Windows test to API change.
llvm-svn: 375170
2019-10-17 20:51:55 +00:00
Jordan Rupprecht edeebad771 [llvm-objcopy] Add support for shell wildcards
Summary: GNU objcopy accepts the --wildcard flag to allow wildcard matching on symbol-related flags. (Note: it's implicitly true for section flags).

The basic syntax is to allow *, ?, \, and [] which work similarly to how they work in a shell. Additionally, starting a wildcard with ! causes that wildcard to prevent it from matching a flag.

Use an updated GlobPattern in libSupport to handle these patterns. It does not fully match the `fnmatch` used by GNU objcopy since named character classes (e.g. `[[:digit:]]`) are not supported, but this should support most existing use cases (mostly just `*` is what's used anyway).

Reviewers: jhenderson, MaskRay, evgeny777, espindola, alexshap

Reviewed By: MaskRay

Subscribers: nickdesaulniers, emaste, arichardson, hiraditya, jakehehrlich, abrachet, seiya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66613

llvm-svn: 375169
2019-10-17 20:51:00 +00:00
Alexey Bataev 9c5d76ff4d [OPENMP]Dow not emit warnings for uninitialized loop counters.
In OpenMP constructs all counters are initialized and we should not emit
warnings about uninitialized privatized loop control variables.

llvm-svn: 375167
2019-10-17 20:35:08 +00:00
Evgeniy Stepanov d5282dfc41 libhwasan initialisation include kernel syscall ABI relaxation
Summary:
Until now AArch64 development has been on patched kernels that have an always
on relaxed syscall ABI where tagged pointers are accepted.
The patches that have gone into the mainline kernel rely on each process opting
in to this relaxed ABI.

This commit adds code to choose that ABI into __hwasan_init.

The idea has already been agreed with one of the hwasan developers
(http://lists.llvm.org/pipermail/llvm-dev/2019-September/135328.html).

The patch ignores failures of `EINVAL` for Android, since there are older versions of the Android kernel that don't require this `prctl` or even have the relevant values.  Avoiding EINVAL will let the library run on them.

I've tested this on an AArch64 VM running a kernel that requires this
prctl, having compiled both with clang and gcc.

Patch by Matthew Malcomson.

Reviewers: eugenis, kcc, pcc

Reviewed By: eugenis

Subscribers: srhines, kristof.beyls, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D68794

llvm-svn: 375166
2019-10-17 20:32:54 +00:00
Julian Lettner 2ca8e27bd0 Reland "[lit] Synthesize artificial deadline"
We always want to use a deadline when calling `result.await`.  Let's
synthesize an artificial deadline (now plus one year) to simplify code
and do less busy waiting.

Thanks to Reid Kleckner for diagnosing that a deadline for of "positive
infinity" does not work with Python 3 anymore.  See commit:
4ff1e34b60

I tested this patch with Python 2 and Python 3.

llvm-svn: 375165
2019-10-17 20:22:32 +00:00
Martin Storsjo 54017d0f52 Revert "[LLDB] [test] Use %clang_cl instead of build.py in a few tests"
This reverts SVN r375156, as it seems to have broken tests when run
on macOS: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/2706/console

llvm-svn: 375163
2019-10-17 20:14:19 +00:00
Dan Liew dc748816e2 [Builtins] Downgrade duplicate source file warning from a fatal error to a warning.
This is a follow up to r375150 to unbreak the `clang-ppc64be-linux` bot.
The commit caused running the tests to fail due to

```
llvm-lit:
/home/buildbots/ppc64be-clang-multistage-test/clang-ppc64be-multistage/llvm/projects/compiler-rt/test/builtins/Unit/lit.cfg.py:116:
fatal: builtins_source_features contains duplicates:
['librt_has_divtc3']
```

This commit should be reverted once the build system bug for powerpc is
fixed.

llvm-svn: 375162
2019-10-17 20:14:04 +00:00
Adrian Prantl 1ad655e255 Modernize the rest of the Find.* API (NFC)
This patch removes the size_t return value and the append parameter
from the remainder of the Find.* functions in LLDB's internal API. As
in the previous patches, this is motivated by the fact that these
parameters aren't really used, and in the case of the append parameter
were frequently implemented incorrectly.

Differential Revision: https://reviews.llvm.org/D69119

llvm-svn: 375160
2019-10-17 19:56:40 +00:00
Sanjay Patel e3905dee00 [x86] add test for setcc to shift transform; NFC
llvm-svn: 375158
2019-10-17 19:32:24 +00:00
Shoaib Meenai c9499264ec [cmake] Pass external project source directories to sub-configures
We're passing LLVM_EXTERNAL_PROJECTS to cross-compilation configures, so
we also need to pass the source directories of those projects, otherwise
configuration can fail from not finding them.

Differential Revision: https://reviews.llvm.org/D69076

llvm-svn: 375157
2019-10-17 19:24:58 +00:00
Martin Storsjo 95980409e6 [LLDB] [test] Use %clang_cl instead of build.py in a few tests
This allows explicitly specifying the intended target architecture,
for tests that aren't supposed to be executed, and that don't
require MSVC headers or libraries to be available.

(These tests already implicitly assumed to be built for x86; one
didn't specify anything, assuming x86_64, while the other specified
--arch=32, which only picks the 32 bit variant of the default target
architecture).

Join two comment lines in disassembly.cpp, to keep row numbers
checked in the test unchanged.

This fixes running check-lldb on arm linux.

Differential Revision: https://reviews.llvm.org/D69031

llvm-svn: 375156
2019-10-17 19:22:50 +00:00
Alexander Shaposhnikov 68db51d5c6 [Object] Fix the return type of getOffset/getSize
Header64.offset/Header64.size are uint64_t, thus we should not 
truncate them to unit32_t. Moreover, there are a number of places 
where we sum the offset and the size (e.g. in various checks in MachOUniversal.cpp),
the truncation causes issues since the offset/size can perfectly fit into uint32_t, 
while the sum overflows.

Differential revision: https://reviews.llvm.org/D69126

Test plan: make check-all

llvm-svn: 375154
2019-10-17 18:48:07 +00:00