Rui Ueyama [Wed, 17 Apr 2019 02:12:47 +0000 (02:12 +0000)]
Fix a crash bug caused by a nested call of parallelForEach.
parallelForEach is not reentrant. We use parallelForEach to call
each section's writeTo(), so calling the same function within writeTo()
is not safe.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41508
Differential Revision: https://reviews.llvm.org/D60757
llvm-svn: 358547
Eric Christopher [Wed, 17 Apr 2019 02:12:23 +0000 (02:12 +0000)]
Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).
This reverts commit r358543/
ab70da07286e618016e78247e4a24fcb84077fda.
llvm-svn: 358546
Rui Ueyama [Wed, 17 Apr 2019 01:47:16 +0000 (01:47 +0000)]
lld: Fix initial Mach-O load commands size calculation omitting LC_FUNCTION_STARTS
Patch by Nicholas Allegra.
The Mach-O writer calculates the size of load commands multiple times.
First, Util::assignAddressesToSections() (in MachONormalizedFileFromAtoms.cpp)
calculates the size using headerAndLoadCommandsSize() (in
MachONormalizedFileBinaryWriter.cpp), which creates a temporary
MachOFileLayout for the NormalizedFile, only to retrieve its
headerAndLoadCommandsSize. Later, writeBinary() (in
MachONormalizedFileBinaryWriter.cpp) creates a new layout and uses the offsets
from that layout to actually write out everything in the NormalizedFile.
But the NormalizedFile changes between the first computation and the second.
When Util::assignAddressesToSections is called, file.functionStarts is always
empty because Util::addFunctionStarts has not yet been called. Yet
MachOFileLayout decides whether to include a LC_FUNCTION_STARTS command based
on whether file.functionStarts is nonempty. Therefore, the initial computation
always omits it.
Because padding for the __TEXT segment (to make its size a multiple of the
page size) is added between the load commands and the first section, LLD still
generates a valid binary as long as the amount of padding happens to be large
enough to fit LC_FUNCTION_STARTS command, which it usually is.
However, it's easy to reproduce the issue by adding a section of a precise
size. Given foo.c:
__attribute__((section("__TEXT,__foo")))
char foo[0xd78] = {0};
Run:
clang -dynamiclib -o foo.dylib foo.c -fuse-ld=lld -install_name
/usr/lib/foo.dylib
otool -lvv foo.dylib
This should produce:
truncated or malformed object (offset field of section 1 in LC_SEGMENT_64
command 0 not past the headers of the file)
This commit:
- Changes MachOFileLayout to always assume LC_FUNCTION_STARTS is present for
the initial computation, as long as generating LC_FUNCTION_STARTS is
enabled. It would be slightly better to check whether there are actually
any functions, since no LC_FUNCTION_STARTS will be generated if not, but it
doesn't cause a problem if the initial computation is too high.
- Adds a test.
- Adds an assert in MachOFileLayout::writeSectionContent() that we are not
writing section content into the load commands region (which would happen
if the offset was calculated too low due to the initial load commands size
calculation being too low). Adds an assert in
MachOFileLayout::writeLoadCommands to validate a similar situation where
two size-of-load-commands computations are expected to be equivalent.
llvm-svn: 358545
Fangrui Song [Wed, 17 Apr 2019 01:46:27 +0000 (01:46 +0000)]
[Driver] Simplify -g level computation and its interaction with -gsplit-dwarf
Summary:
When -gsplit-dwarf is used together with other -g options, in most cases
the computed debug info level is decided by the last -g option, with one
special case (see below). This patch drops that special case and thus
makes it easy to reason about:
// If a lower debug level -g comes after -gsplit-dwarf, in some cases
// -gsplit-dwarf is cancelled.
-gsplit-dwarf -g0 => 0
-gsplit-dwarf -gline-directives-only => DebugDirectivesOnly
-gsplit-dwarf -gmlt -fsplit-dwarf-inlining => 1
-gsplit-dwarf -gmlt -fno-split-dwarf-inlining => 1 + split
// If -gsplit-dwarf comes after -g options, with this patch, the net
// effect is 2 + split for all combinations
-g0 -gsplit-dwarf => 2 + split
-gline-directives-only -gsplit-dwarf => 2 + split
-gmlt -gsplit-dwarf -fsplit-dwarf-inlining => 2 + split
-gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 + split (before) 2 + split (after)
The last case has been changed. In general, if the user intends to lower
debug info level, place that -g option after -gsplit-dwarf.
Some context:
In gcc, the last of -gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-*
... decides the debug info level (-gsplit-dwarf -gdwarf-* have level 2).
It is a bit unfortunate that -gsplit-dwarf -gdwarf-* ... participate in
the level computation but that is the status quo.
Reviewers: dblaikie, echristo, probinson
Reviewed By: dblaikie, probinson
Subscribers: probinson, aprantl, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59923
llvm-svn: 358544
Kit Barton [Wed, 17 Apr 2019 01:37:00 +0000 (01:37 +0000)]
Add basic loop fusion pass.
This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
1. Adjacent (no code between them)
2. Control flow equivalent (if one loop executes, the other loop executes)
3. Identical bounds (both loops iterate the same number of iterations)
4. No negative distance dependencies between the loop bodies.
The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.
The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.
Phabricator: https://reviews.llvm.org/D55851
llvm-svn: 358543
Yi Kong [Wed, 17 Apr 2019 01:30:33 +0000 (01:30 +0000)]
[builtins] Add __cmpsf2 for ARM version of comparesf2
The generic version of comparesf2 defines __cmpsf2 alias for libgcc
compatibility, but the ARM overlay is missing the alias.
Differential Revision: https://reviews.llvm.org/D60805
llvm-svn: 358542
Marshall Clow [Wed, 17 Apr 2019 00:11:00 +0000 (00:11 +0000)]
Add tests for stability to list::sort and forward_list::sort. Thanks to Jonathan Wakely for the notice
llvm-svn: 358541
Sam McCall [Tue, 16 Apr 2019 23:53:28 +0000 (23:53 +0000)]
[ADT] llvm::bsearch, binary search for mere mortals
Summary:
Add to STLExtras a binary search function with a simple mental model:
You provide a range and a predicate which is true above a certain point.
bsearch() tells you that point.
Overloads are provided for integers, iterators, and containers.
This is more suitable than std:: alternatives in many cases:
- std::binary_search only indicates presence/absence
- upper_bound/lower_bound give you the opportunity to pick the wrong one
- all of the options have confusing names and definitions when your predicate
doesn't have simple "less than" semantics
- all of the options require iterators
- we plumb around a useless `value` parameter that should be a lambda capture
The API is inspired by Go's standard library, but we add an extra parameter as
well as some overloads and templates to show how clever C++ is.
Reviewers: ilya-biryukov, gribozavr
Subscribers: dexonsmith, kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60779
llvm-svn: 358540
Sanjay Patel [Tue, 16 Apr 2019 23:10:41 +0000 (23:10 +0000)]
[x86] adjust LEA tests for better coverage; NFC
The scale can 1, 2, or 3.
llvm-svn: 358539
Leonard Chan [Tue, 16 Apr 2019 22:59:39 +0000 (22:59 +0000)]
[NFC] Remove unused function (Sema::pushExternalDeclIntoScope)
llvm-svn: 358538
Douglas Yung [Tue, 16 Apr 2019 22:52:05 +0000 (22:52 +0000)]
Modify test to use -S instead of -c so that it works when an external assembler is used that is not present.
llvm-svn: 358537
Peter Collingbourne [Tue, 16 Apr 2019 22:45:14 +0000 (22:45 +0000)]
ELF: Move build id computation to Writer. NFCI.
With partitions, each partition should have the same build id. This means
that the build id needs to be only computed once, otherwise we will end up
with different build ids in each partition as a result of the file contents
changing. This change moves the computation of the build id into Writer so
that it only happens once.
Differential Revision: https://reviews.llvm.org/D60342
llvm-svn: 358536
Mitch Phillips [Tue, 16 Apr 2019 22:16:01 +0000 (22:16 +0000)]
[HWASan] Fixed slow DWARF unwinding.
Summary: CFA was setup incorrectly, as there is an 8-byte gap at the top of the stack for SP 16-byte alignment purposes.
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: kubamracek, javed.absar, #sanitizers, llvm-commits, pcc
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D60798
llvm-svn: 358535
Marshall Clow [Tue, 16 Apr 2019 22:11:26 +0000 (22:11 +0000)]
Fix list/forward_list implementations of remove_if and unique to deal with predicates that are part of the sequence passed in. We already do this for remove.
llvm-svn: 358534
Davide Italiano [Tue, 16 Apr 2019 21:56:07 +0000 (21:56 +0000)]
[tools] Only build lldb-test when needed.
llvm-svn: 358533
Robert Widmann [Tue, 16 Apr 2019 21:39:48 +0000 (21:39 +0000)]
[LLVM-C] Add Accessors For Global Variable Metadata Properties
Summary: Metadata for a global variable is really a (GlobalVariable, Expression) tuple. Allow access to these, then allow retrieving the file, scope, and line for a DIVariable, whether global or local. This should be the last of the accessors required for uniform access to location and file information metadata.
Reviewers: jberdine, whitequark, deadalnix
Reviewed By: jberdine, whitequark
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60725
llvm-svn: 358532
Ali Tamur [Tue, 16 Apr 2019 21:37:43 +0000 (21:37 +0000)]
Fix a typo in comments. [NFC]
llvm-svn: 358531
Alex Langford [Tue, 16 Apr 2019 21:21:28 +0000 (21:21 +0000)]
[Process] Fix linux arm64 single step compilation failure
This was updated in r356703 to use llvm::sys::RetryAfterSignal, which
comes from llvm/Support/Errno.h. The header wasn't added, so it fails if
you compile for arm64/aarch64.
llvm-svn: 358530
Louis Dionne [Tue, 16 Apr 2019 21:16:58 +0000 (21:16 +0000)]
[NFC] Build libc++ verbosely in the macOS CI
llvm-svn: 358529
Davide Italiano [Tue, 16 Apr 2019 21:15:28 +0000 (21:15 +0000)]
[tools] Make vscode and lldb-instr optional.
Summary:
Saves some build times, and they're not part of the usual
developer workflow.
Reviewers: JDevlieghere, friss
Subscribers: mgorny, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D60780
llvm-svn: 358528
Nick Desaulniers [Tue, 16 Apr 2019 21:04:34 +0000 (21:04 +0000)]
[NVPTXAsmPrinter] clean up dead code. NFC
Summary:
The printOperand function takes a default parameter, for which there are
zero call sites that explicitly pass such a parameter. As such, there
is no case to support. This means that the method
printVecModifiedImmediate is purly dead code, and can be removed.
The eventual goal for some of these AsmPrinter refactoring is to have
printOperand be a virtual method; making it easier to print operands
from the base class for more generic Asm printing. It will help if all
printOperand methods have the same function signature (ie. no Modifier
argument when not needed).
Reviewers: echristo, tra
Reviewed By: echristo
Subscribers: jholewinski, hiraditya, llvm-commits, craig.topper, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60727
llvm-svn: 358527
Simon Pilgrim [Tue, 16 Apr 2019 20:57:28 +0000 (20:57 +0000)]
[TargetLowering] Rename preferShiftsToClearExtremeBits and shouldFoldShiftPairToMask (PR41359)
As discussed on PR41359, this patch renames the pair of shift-mask target feature functions to make their purposes more obvious.
shouldFoldShiftPairToMask -> shouldFoldConstantShiftPairToMask
preferShiftsToClearExtremeBits -> shouldFoldMaskToVariableShiftPair
llvm-svn: 358526
Frederic Riss [Tue, 16 Apr 2019 20:54:42 +0000 (20:54 +0000)]
[debugserver] Relax the codesigning identity check
In an effort to help new LLDB developers, we added checks and messaging around
the selection of your codesigning identity on macOS. While helpful, it is not
actually correct. It's perfectly valid to codesign with an identity that is
not named lldb_codesign. Currently this fails the build.
This patch keeps a warning that informs developers how to setup lldb_codesign
and how to pass it to cmake, but it allows the build to proceed with a
different identity.
llvm-svn: 358525
Louis Dionne [Tue, 16 Apr 2019 20:46:03 +0000 (20:46 +0000)]
[libc++] Make sure we use new/delete from libc++abi on CI for Apple platforms
llvm-svn: 358524
Sanjay Patel [Tue, 16 Apr 2019 20:41:20 +0000 (20:41 +0000)]
[EarlyCSE] detect equivalence of selects with inverse conditions and commuted operands (PR41101)
This is 1 of the problems discussed in the post-commit thread for:
rL355741 / http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20190311/635516.html
and filed as:
https://bugs.llvm.org/show_bug.cgi?id=41101
Instcombine tries to canonicalize some of these cases (and there's room for improvement
there independently of this patch), but it can't always do that because of extra uses.
So we need to recognize these commuted operand patterns here in EarlyCSE. This is similar
to how we detect commuted compares and commuted min/max/abs.
Differential Revision: https://reviews.llvm.org/D60723
llvm-svn: 358523
Anton Afanasyev [Tue, 16 Apr 2019 20:36:56 +0000 (20:36 +0000)]
Time profiler: optimize json output time
Summary:
Use llvm::json::Array.reserve() to optimize json output time. Here is motivation:
https://reviews.llvm.org/D60609#1468941. In short: for the json array
with ~32K entries, pushing back each entry takes ~4% of whole time compared
to the method of preliminary memory reservation: (3995-3845)/3995 = 3.75%.
Reviewers: lebedev.ri
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60792
llvm-svn: 358522
Nikita Popov [Tue, 16 Apr 2019 20:31:41 +0000 (20:31 +0000)]
[CVP] Simplify umulo and smulo that cannot overflow
If a umul.with.overflow or smul.with.overflow operation cannot
overflow, simplify it to a simple mul nuw / mul nsw. After the
refactoring in D60668 this is just a matter of removing an
explicit check against multiplications.
Differential Revision: https://reviews.llvm.org/D60791
llvm-svn: 358521
Anton Afanasyev [Tue, 16 Apr 2019 19:43:18 +0000 (19:43 +0000)]
[Support][JSON] Add reserve() to json Array
Summary:
Space reservation increases json lib performance for the arrays with large number of entries.
Here is the example and discussion: https://reviews.llvm.org/D60609#1468941
Reviewers: lebedev.ri, sammccall
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60788
llvm-svn: 358520
Simon Pilgrim [Tue, 16 Apr 2019 19:27:00 +0000 (19:27 +0000)]
[SLP] Refactoring of the operand reordering code.
This is a refactoring patch which should have all the functionality of the current code. Its goal is twofold:
i. Cleanup and simplify the reordering code, and
ii. Generalize reordering so that it will work for an arbitrary number of operands, not just 2.
This is the second patch in a series of patches that will enable operand reordering across chains of operations. An example of this was presented in EuroLLVM'18 https://www.youtube.com/watch?v=gIEn34LvyNo .
Committed on behalf of @vporpo (Vasileios Porpodas)
Differential Revision: https://reviews.llvm.org/D59973
llvm-svn: 358519
Louis Dionne [Tue, 16 Apr 2019 19:26:56 +0000 (19:26 +0000)]
[libc++] Remove old workaround for buildit
Summary:
I'm not sure what the problem was at the time, however I don't think
this is necessary since buildit doesn't exist anymore.
Instead of the workaround, the correct thing to do is to leave out
the get_new_handler/set_new_handler definitions from libc++ when
we're getting them from libc++abi.
Reviewers: EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D60717
llvm-svn: 358518
Nikita Popov [Tue, 16 Apr 2019 19:25:35 +0000 (19:25 +0000)]
[CVP] Add tests for non-overflowing mulo; NFC
Should be simplified to simple mul.
llvm-svn: 358517
Simon Pilgrim [Tue, 16 Apr 2019 19:18:53 +0000 (19:18 +0000)]
[X86][AVX] X86ISD::PERMV/PERMV3 node types can never fold index ops
Improves codegen demonstrated by D60512 - instructions represented by X86ISD::PERMV/PERMV3 can never memory fold the operand used for their index register.
This patch updates the 'isUseOfShuffle' helper into the more capable 'isFoldableUseOfShuffle' that recognises that the op is used for a X86ISD::PERMV/PERMV3 index mask and can't be folded - allowing us to use broadcast/subvector-broadcast ops to reduce the size of the mask constant pool data.
Differential Revision: https://reviews.llvm.org/D60562
llvm-svn: 358516
Nikita Popov [Tue, 16 Apr 2019 19:05:49 +0000 (19:05 +0000)]
[InstCombine] Prune fshl/fshr with masked operands
If a constant shift amount is used, then only some of the LHS/RHS
operand bits are demanded and we may be able to simplify based on
that. InstCombineSimplifyDemanded already had the necessary support
for that, we just weren't calling it with fshl/fshr as root.
In particular, this allows us to relax some masked funnel shifts
into simple shifts, as shown in the tests.
Patch by Shawn Landden.
Differential Revision: https://reviews.llvm.org/D60660
llvm-svn: 358515
Nikita Popov [Tue, 16 Apr 2019 19:05:40 +0000 (19:05 +0000)]
[InstCombine] Add tests for fshl/fshr with masked operands; NFC
Baseline tests for D60660.
Patch by Shawn Landden.
Differential Revision: https://reviews.llvm.org/D60688
llvm-svn: 358514
Sanjay Patel [Tue, 16 Apr 2019 18:58:03 +0000 (18:58 +0000)]
[x86] add more tests for LEA formation; NFC
Promoting the shift to the wider type should allow LEA.
llvm-svn: 358513
Nikita Popov [Tue, 16 Apr 2019 18:55:16 +0000 (18:55 +0000)]
[IR] Add WithOverflowInst class
This adds a WithOverflowInst class with a few helper methods to get
the underlying binop, signedness and nowrap type and makes use of it
where sensible. There will be two more uses in D60650/D60656.
The refactorings are all NFC, though I left some TODOs where things
could be improved. In particular we have two places where add/sub are
handled but mul isn't.
Differential Revision: https://reviews.llvm.org/D60668
llvm-svn: 358512
Harlan Haskins [Tue, 16 Apr 2019 18:00:43 +0000 (18:00 +0000)]
[FileSystemStatCache] Update test for new FileSystemStatCache API
Summary: Update this test to return std::error_code instead of LookupResult.
Reviewers: arphaman
Subscribers: dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60786
llvm-svn: 358511
Matt Morehouse [Tue, 16 Apr 2019 17:38:19 +0000 (17:38 +0000)]
[libFuzzer] Remove tautological compare.
llvm-svn: 358510
Harlan Haskins [Tue, 16 Apr 2019 17:34:26 +0000 (17:34 +0000)]
[FileSystemStatCache] Return std::error_code from stat cache methods
Summary:
Previously, we would return true/false signifying if the cache/lookup
succeeded or failed. Instead, provide clients with the underlying error
that was thrown while attempting to look up in the cache.
Since clang::FileManager doesn't make use of this information, it discards the
error that's received and casts away to bool.
This change is NFC.
Reviewers: benlangmuir, arphaman
Subscribers: dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60735
llvm-svn: 358509
Pavel Labath [Tue, 16 Apr 2019 16:57:41 +0000 (16:57 +0000)]
Fix symtab-macho.test broken by r358500
Put the correct UUID string into the breakpad file.
llvm-svn: 358508
Michael Kruse [Tue, 16 Apr 2019 16:44:45 +0000 (16:44 +0000)]
[Test] Remove obsolete test.
The FIXME of this test case has been addressed in r335084/r338800. Its
execution still does not succeed because of multiple syntax errors.
First, the "clang" namespace is missing on each of the 4 pragmas.
Second, the pragma for defining the vector width is "vectorize_width(4)"
instead of "vectorize(4)". Third, the pragma for defining the interleave
factor is "interleave_count(8)" instead of "interleave(8)".
The file was already using the wrong syntax when added in
r210925 2014-06-13. The file ast-print-pragmas.cpp already checks for
the correct pragma order, making this test redundant even if fixed.
Differential Revision: https://reviews.llvm.org/D60749
llvm-svn: 358507
Philip Reames [Tue, 16 Apr 2019 16:32:59 +0000 (16:32 +0000)]
[Tests] Add branch_weights to latches so that test is not effected by future profitability patch to LoopPredication
llvm-svn: 358506
Krzysztof Parzyszek [Tue, 16 Apr 2019 16:05:07 +0000 (16:05 +0000)]
[Hexagon] Remove indeterministic traversal order
Patch by Sergei Larin.
llvm-svn: 358505
Fangrui Song [Tue, 16 Apr 2019 15:58:42 +0000 (15:58 +0000)]
[llvm-objdump] Test tabs in disassemble-align.s with a more visible character
Summary: Apply rupprecht's suggestion in D60376
Reviewers: rupprecht
Reviewed By: rupprecht
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60777
llvm-svn: 358504
Alexey Bataev [Tue, 16 Apr 2019 15:39:12 +0000 (15:39 +0000)]
[OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.
Combined constructs with parallel and if clauses without modifiers may
be executed in SPMD mode since if the condition is true for the target
region, it is also true for parallel region and the threads must be run
in parallel.
llvm-svn: 358503
Luis Marques [Tue, 16 Apr 2019 15:09:18 +0000 (15:09 +0000)]
[DAGCombiner] Add missing flag to addressing mode check
The checks in `canFoldInAddressingMode` tested for addressing modes that have a
base register but didn't set the `HasBaseReg` flag to true (it's false by
default). This patch fixes that. Although the omission of the flag was
technically incorrect it had no known observable impact, so no tests were
changed by this patch.
Differential Revision: https://reviews.llvm.org/D60314
llvm-svn: 358502
whitequark [Tue, 16 Apr 2019 15:00:19 +0000 (15:00 +0000)]
[OCaml] Update api to account for FNeg and CallBr instructions
Summary:
This diff adds minimal support for the recent FNeg and CallBr
instructions to the OCaml bindings.
Reviewers: whitequark
Reviewed By: whitequark
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60680
llvm-svn: 358501
Pavel Labath [Tue, 16 Apr 2019 14:51:47 +0000 (14:51 +0000)]
Breakpad: Match the new UUID algorithm in minidumps
D59433 and D60501 changed the way UUIDs are computed from minidump
files. This was done to synchronize the U(G)UID representation with the
native tools of given platforms, but it created a mismatch between
minidumps and breakpad files.
This updates the breakpad algorithm to match the one found in minidumps,
and also adds a couple of tests which should fail if these two ever get
out of sync. Incidentally, this means that the module id in the breakpad
files is almost identical to our notion of UUIDs, so the computation
algorithm can be somewhat simplified.
llvm-svn: 358500
Pavel Labath [Tue, 16 Apr 2019 14:51:27 +0000 (14:51 +0000)]
test/PECOFF: Remove REQUIRES: system-windows
These tests run fine on non-windows platforms too. Instead I add
REQUIRES: lld, as that is what they really require.
llvm-svn: 358499
Luis Marques [Tue, 16 Apr 2019 14:38:32 +0000 (14:38 +0000)]
[RISCV] Custom lower SHL_PARTS, SRA_PARTS, SRL_PARTS
When not optimizing for minimum size (-Oz) we custom lower wide shifts
(SHL_PARTS, SRA_PARTS, SRL_PARTS) instead of expanding to a libcall.
Differential Revision: https://reviews.llvm.org/D59477
llvm-svn: 358498
Louis Dionne [Tue, 16 Apr 2019 14:38:08 +0000 (14:38 +0000)]
[pstl] Remove the stdlib headers from the PSTL and move them to the tests
Summary:
PSTL should not provide those headers since they belong to the standard
library. Instead, we define a dummy standard library in the tests that
provides those headers.
Reviewers: rodgert, MikeDvorskiy
Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D60535
llvm-svn: 358497
Eric Liu [Tue, 16 Apr 2019 14:35:49 +0000 (14:35 +0000)]
[clangd] Check file path of declaring header when deciding whether to insert include.
Summary:
Previously, we would use include spelling of the declaring header to check
whether the inserted header is the same as the main file. This doesn't help because
we only have file path of the main file.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60687
llvm-svn: 358496
Ulrich Weigand [Tue, 16 Apr 2019 14:35:18 +0000 (14:35 +0000)]
[SystemZ] Add missing intrinsics to intrinsics-immarg.ll
As of r356091, support for the ImmArg intrinsics was added,
including a SystemZ test case. However, that test case doesn't
actually verify all SystemZ intrinsics with immediate arguments,
only a subset. The rest of them actually works correctly, there's
just no test for them. This patch add all missing intrinsics.
llvm-svn: 358495
Kadir Cetinkaya [Tue, 16 Apr 2019 14:32:43 +0000 (14:32 +0000)]
[llvm][Support] Provide interface to set thread priorities
Summary:
We have a multi-platform thread priority setting function(last piece
landed with D58683), I wanted to make this available to all llvm community,
there seem to be other users of such functionality with portability fixmes:
lib/Support/CrashRecoveryContext.cpp
tools/clang/tools/libclang/CIndex.cpp
Reviewers: gribozavr, ioeric
Subscribers: krytarowski, jfb, kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59130
llvm-svn: 358494
Alexey Bataev [Tue, 16 Apr 2019 14:26:10 +0000 (14:26 +0000)]
[OPENMP]Require aarch arch for the tests, NFC.
llvm-svn: 358493
Nico Weber [Tue, 16 Apr 2019 14:24:42 +0000 (14:24 +0000)]
llvm-undname: Consistently use "return nullptr" in functions returning pointers
llvm-svn: 358492
Nico Weber [Tue, 16 Apr 2019 14:10:34 +0000 (14:10 +0000)]
llvm-undname: Fix nullptr deref on invalid structor names in template args
Similar to r358421: A StructorIndentifierNode has a Class field which
is read when printing it, but if the StructorIndentifierNode appears in
a template argument then demangleFullyQualifiedSymbolName() which sets
Class isn't called. Since StructorIndentifierNodes are always leaf
names, we can just reject them as well.
Found by oss-fuzz.
llvm-svn: 358491
Alexey Bataev [Tue, 16 Apr 2019 13:56:21 +0000 (13:56 +0000)]
[AArch64] Implement Vector Funtion ABI name mangling.
Summary:
The name mangling scheme is defined in section 3.5 of the "Vector function application binary interface specification for AArch64" [1].
[1] https://developer.arm.com/products/software-development-tools/hpc/arm-compiler-for-hpc/vector-function-abi
Reviewers: rengolin, ABataev
Reviewed By: ABataev
Subscribers: sdesmalen, javed.absar, kristof.beyls, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60583
llvm-svn: 358490
Nico Weber [Tue, 16 Apr 2019 13:52:30 +0000 (13:52 +0000)]
llvm-undname: Tweak arena allocator
- Make `allocUnalignedBuffer` look more like `allocArray` and `alloc`.
No behavior change.
- Change `Head->Used < Head->Capacity` to `Head->Used <= Head->Capacity`
in `allocArray` and `alloc`. No intended behavior change, might be a
minuscule memory usage improvement. Noticed this since it was the logic
used in `allocUnalignedBuffer`.
- Don't let `allocArray` alloc too small buffers for names that have
more than 512 levels of nesting (in 64-bit builds). Fixes a heap
buffer overflow found by oss-fuzz.
Differential Revision: https://reviews.llvm.org/D60774
llvm-svn: 358489
Nico Weber [Tue, 16 Apr 2019 13:30:50 +0000 (13:30 +0000)]
llvm-undname: add a missing CHECK: to a passing test
llvm-svn: 358488
Nico Weber [Tue, 16 Apr 2019 13:18:51 +0000 (13:18 +0000)]
Fix llvm-undname tests after r358485
llvm-svn: 358487
Nico Weber [Tue, 16 Apr 2019 12:54:43 +0000 (12:54 +0000)]
gn build: Merge r358422
llvm-svn: 358486
Nico Weber [Tue, 16 Apr 2019 12:51:40 +0000 (12:51 +0000)]
llvm-undname: Add a -raw-file flag to pass a raw buffer to microsoftDemangle
The default handling splits input into lines. Since
llvm-microsoft-demangle-fuzzer doesn't do this, oss-fuzz produces inputs
that only trigger crashes if the input isn't split into lines. This adds
a hidden flag -raw-file which passes file contents to microsoftDemangle() in
the same way the fuzzer does, for reproducing oss-fuzz reports.
Also change llvm-undname to have a non-0 exit code for invalid symbols.
Differential Revision: https://reviews.llvm.org/D60771
llvm-svn: 358485
Hans Wennborg [Tue, 16 Apr 2019 12:13:25 +0000 (12:13 +0000)]
Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)
The original commit caused false positives from AddressSanitizer's
use-after-scope checks, which have now been fixed in r358478.
> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936
llvm-svn: 358483
Dmitri Gribenko [Tue, 16 Apr 2019 09:46:02 +0000 (09:46 +0000)]
Removed CMake cache upgrade code from 2011
Summary:
This code was added in r141266 to make a breaking change to CMake, but
still be compatible with existing cache files. The cache files from
2011 are irrelevant today in 2019.
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60711
llvm-svn: 358482
Raphael Isemann [Tue, 16 Apr 2019 08:06:56 +0000 (08:06 +0000)]
Fix typo in ArmUnwindInfo::GetUnwindPlan
Summary:
As reported in LLVM bug 41486, the check `(byte1 & 0xf8) == 0xc0` is wrong. We want to check for `11010nnn`,
so the proper value we want to compare against is `0xd0` (`0xc0` would check for the value `11000nnn` which we
already checked for above as described in the bug report).
Reviewers: #lldb, jasonmolenda
Reviewed By: #lldb, jasonmolenda
Subscribers: jasonmolenda, javed.absar, kristof.beyls, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D60655
llvm-svn: 358479
Hans Wennborg [Tue, 16 Apr 2019 07:54:20 +0000 (07:54 +0000)]
Asan use-after-scope: don't poison allocas if there were untraced lifetime intrinsics in the function (PR41481)
If there are any intrinsics that cannot be traced back to an alloca, we
might have missed the start of a variable's scope, leading to false
error reports if the variable is poisoned at function entry. Instead, if
there are some intrinsics that can't be traced, fail safe and don't
poison the variables in that function.
Differential revision: https://reviews.llvm.org/D60686
llvm-svn: 358478
Raphael Isemann [Tue, 16 Apr 2019 07:48:11 +0000 (07:48 +0000)]
Correctly check if a warning message lacks a trailing new line
Summary: Fixes LLVM bug 41489.
Reviewers: clayborg
Reviewed By: clayborg
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D60653
llvm-svn: 358477
Anton Afanasyev [Tue, 16 Apr 2019 06:35:07 +0000 (06:35 +0000)]
Use native llvm JSON library for time profiler output
Summary: Replace plain json text output with llvm JSON library wrapper using.
Reviewers: takuto.ikuta, lebedev.ri
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60609
llvm-svn: 358476
Fangrui Song [Tue, 16 Apr 2019 03:56:55 +0000 (03:56 +0000)]
[llvm-objdump] Align instructions to a tab stop in disassembly output
This relands D60376/rL358405, with the difference: sed 'y/\t/ /' -> tr '\t' ' '
BSD sed doesn't support escape characters for the 'y' command.
I didn't use it in rL358405 because it was not listed at
https://llvm.org/docs/GettingStarted.html#software but it
should be available.
Original description:
In GNU objdump, -w/--wide aligns instructions in the disassembly output.
This patch does the same to llvm-objdump. However, we always use the
wide format (-w/--wide is ignored), because the narrow format
(instructions are misaligned) is probably not very useful.
In llvm-readobj, we made a similar decision: always use the wide format,
accept but ignore -W/--wide.
To save some columns, we change the tab before hex bytes (controlled by
--[no-]show-raw-insn) to a space.
llvm-svn: 358474
Fangrui Song [Tue, 16 Apr 2019 03:51:53 +0000 (03:51 +0000)]
[MachO] Add -macho to llvm-objdump commands
llvm-svn: 358473
Fangrui Song [Tue, 16 Apr 2019 02:37:29 +0000 (02:37 +0000)]
[llvm-objdump] Simplify PrintHelpMessage() logic
This relands rL358418. It missed one test that should also use -macho
Note, all the other -private-header -exports-trie tests are used
together with -macho.
llvm-svn: 358472
Quentin Colombet [Tue, 16 Apr 2019 02:12:05 +0000 (02:12 +0000)]
[CodeExtractor] Add a few debug lines to understand why a region is not extracted
The CodeExtractor is not smart enough to compute which basic block is
the entry of a region. Instead it relies on the order of the list
of basic blocks that is handed to it and assumes that the entry
is the first block in the list.
Without the additional debug information, it is hard to understand
why a valid region does not get extracted, because we would miss
that the order of in the list just doesn't match what the CodeExtractor
wants.
NFC
llvm-svn: 358471
Richard Smith [Tue, 16 Apr 2019 01:44:53 +0000 (01:44 +0000)]
Tweak test to pass when using a non-integrated assembler.
llvm-svn: 358470
Julian Lettner [Tue, 16 Apr 2019 01:34:38 +0000 (01:34 +0000)]
[TSan][libdispatch] Port gcd-sync-block-copy.mm to C++
Summary:
Apparently, it makes a difference on where a block lives depending on if
it's passed "inline" versus assigned and then passed via a variable.
Both tests in this commit now give a signal, if `Block_copy` is used in
`dispatch_sync`.
Since these tests use different mechanisms (Objective-C retain versus
C++ copy constructor) as proxies to observe if the block was copied, we
should keep both of them.
Commit, that first avoided the unnecessary copy:
faef7d034a9ec6cb757137adce8e8670ec6c2d7b
Subscribers: kubamracek, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D60639
llvm-svn: 358469
Eric Christopher [Tue, 16 Apr 2019 01:06:03 +0000 (01:06 +0000)]
Remove some more unused headers from MachineFunction.h and friends.
Most of these headers are still included via transitive includes and
so won't likely show any problems or improvements in incremental
rebuild time.
Differential Revision: https://reviews.llvm.org/D60741
llvm-svn: 358468
Richard Smith [Tue, 16 Apr 2019 00:47:45 +0000 (00:47 +0000)]
PR41192: fix cases where "missing ';' after class" error would
incorrectly fire.
llvm-svn: 358467
Shoaib Meenai [Tue, 16 Apr 2019 00:18:50 +0000 (00:18 +0000)]
Reapply [Support] Fix recursive response file expansion guard
The test in the dependent revision has been fixed for Windows.
Original commit message:
Response file expansion limits the amount of expansion to prevent
potential infinite recursion. However, the current logic assumes that
any argument beginning with @ is a response file, which is not true for
e.g. `-Xlinker -rpath -Xlinker @executable_path/../lib` on Darwin.
Having too many of these non-response file arguments beginning with @
prevents actual response files from being expanded. Instead, limit based
on the number of successful response file expansions, which should still
prevent infinite recursion but also avoid false positives.
Differential Revision: https://reviews.llvm.org/D60631
> llvm-svn: 358452
llvm-svn: 358466
Shoaib Meenai [Tue, 16 Apr 2019 00:18:47 +0000 (00:18 +0000)]
Reapply [Support] Add a test for recursive response file expansion
Use the appropriate tokenizer to fix the test on Windows.
Original commit message:
I'm going to be modifying the logic to avoid infinitely recursing on
self-referential response files, so add a unit test to verify the
expected behavior.
Differential Revision: https://reviews.llvm.org/D60630
> llvm-svn: 358451
llvm-svn: 358465
David Blaikie [Tue, 16 Apr 2019 00:16:29 +0000 (00:16 +0000)]
DebugInfo: Default to standalone debug when tuning for LLDB
LLDB can't currently handle Clang's default (limit/no-standalone) DWARF,
so platforms that default to LLDB (Darwin) or anyone else manually
requesting LLDB tuning, should also get standalone DWARF.
That doesn't mean a user can't explicitly enable (because they have
other reasons to prefer standalone DWARF (such as that they're only
building half their application with debug info enabled, and half
without - or because they're tuning for GDB, but want to be able to use
it under LLDB too (this is the default on FreeBSD))) or disable (testing
LLDB fixes/improvements that handle no-standalone mode, building C code,
perhaps, which wouldn't have the LLDB<>no-standalone conflict, etc) the
feature regardless of the tuning.
llvm-svn: 358464
Richard Smith [Mon, 15 Apr 2019 23:55:58 +0000 (23:55 +0000)]
Simplify diagnosis of misplaced attributes in module-declarations.
No functional change intended.
llvm-svn: 358463
Shafik Yaghmour [Mon, 15 Apr 2019 23:05:45 +0000 (23:05 +0000)]
[ASTImporter] Regression test to ensure that we handling importing of anonymous enums correctly
Summary:
https://reviews.llvm.org/D51633 added error handling in the ASTImporter.cpp which uncovered an underlying bug in which we used the wrong name when handling naming conflicts. This could cause a segmentation fault when attempting to cast an int to an enum during expression parsing.
This test should pass once https://reviews.llvm.org/D59665 is committed.
Differential Revision: https://reviews.llvm.org/D59667
llvm-svn: 358462
Shoaib Meenai [Mon, 15 Apr 2019 22:51:54 +0000 (22:51 +0000)]
Revert [Support] Add a test for recursive response file expansion
This reverts r358451 (git commit
c8497467edc5766ae81ffbde58159f8c6af50803)
The test breaks a Windows buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17016/steps/test-check-all/logs/stdio
llvm-svn: 358461
Shoaib Meenai [Mon, 15 Apr 2019 22:51:53 +0000 (22:51 +0000)]
Revert [Support] Fix recursive response file expansion guard
This reverts r358452 (git commit
c8df4fb9c3865eac52a99602c26bbc070098c3d4)
A dependent commit breaks the Windows buildbots.
llvm-svn: 358460
Alex Lorenz [Mon, 15 Apr 2019 22:36:12 +0000 (22:36 +0000)]
Revert r358405: "[llvm-objdump] Align instructions to a tab stop in disassembly output"
The test fails on darwin due to a sed error:
sed: 1: "y/\t/ /": transform strings are not the same length
llvm-svn: 358459
Amara Emerson [Mon, 15 Apr 2019 22:34:08 +0000 (22:34 +0000)]
[AArch64][GlobalISel] Don't do extending loads combine for non-pow-2 types.
Since non-pow-2 types are going to get split up into multiple loads anyway,
don't do the [SZ]EXTLOAD combine for those and save us trouble later in
legalization.
llvm-svn: 358458
Quentin Colombet [Mon, 15 Apr 2019 22:23:46 +0000 (22:23 +0000)]
[LSR] Rewrite misses some fixup locations if it splits critical edge
If LSR split critical edge during rewriting phi operands and
phi node has other pending fixup operands, we need to
update those pending fixups. Otherwise formulae will not be
implemented completely and some instructions will not be eliminated.
llvm.org/PR41445
Differential Revision: https://reviews.llvm.org/D60645
Patch by: Denis Bakhvalov <denis.bakhvalov@intel.com>
llvm-svn: 358457
Sean Silva [Mon, 15 Apr 2019 22:07:56 +0000 (22:07 +0000)]
Only use argv[0] as the main executable name if it exists.
Under some environments, argv[0] doesn't hold a valid file name, but
sys::fs::getMainExecutable will find the main executable properly.
This patch tweaks the logic to fall back to sys::fs::getMainExecutable
in more situations.
Differential Revision: https://reviews.llvm.org/D60730
llvm-svn: 358455
Sanjay Patel [Mon, 15 Apr 2019 21:51:51 +0000 (21:51 +0000)]
[EarlyCSE] add more tests for double-negated select condition; NFC
llvm-svn: 358454
Douglas Yung [Mon, 15 Apr 2019 21:43:28 +0000 (21:43 +0000)]
Fix test on Windows that uses a different path separator character.
llvm-svn: 358453
Shoaib Meenai [Mon, 15 Apr 2019 21:31:28 +0000 (21:31 +0000)]
[Support] Fix recursive response file expansion guard
Response file expansion limits the amount of expansion to prevent
potential infinite recursion. However, the current logic assumes that
any argument beginning with @ is a response file, which is not true for
e.g. `-Xlinker -rpath -Xlinker @executable_path/../lib` on Darwin.
Having too many of these non-response file arguments beginning with @
prevents actual response files from being expanded. Instead, limit based
on the number of successful response file expansions, which should still
prevent infinite recursion but also avoid false positives.
Differential Revision: https://reviews.llvm.org/D60631
llvm-svn: 358452
Shoaib Meenai [Mon, 15 Apr 2019 21:31:25 +0000 (21:31 +0000)]
[Support] Add a test for recursive response file expansion
I'm going to be modifying the logic to avoid infinitely recursing on
self-referential response files, so add a unit test to verify the
expected behavior.
Differential Revision: https://reviews.llvm.org/D60630
llvm-svn: 358451
Craig Topper [Mon, 15 Apr 2019 21:06:32 +0000 (21:06 +0000)]
[X86] Limit the 'x' inline assembly constraint to zmm0-15 when used for a 512 type.
The 'v' constraint is used to select zmm0-31. This makes 512 bit consistent with 128/256-bit.a
llvm-svn: 358450
Craig Topper [Mon, 15 Apr 2019 21:06:23 +0000 (21:06 +0000)]
[X86] Fix a stack folding test to have a full xmm2-31 clobber list instead of stopping at xmm15. Add an additional dependency to keep instruction below inline asm block.
llvm-svn: 358449
Anton Afanasyev [Mon, 15 Apr 2019 21:02:47 +0000 (21:02 +0000)]
Time profiler: small fixes and optimizations
Summary: Fixes from Roman's review here: https://reviews.llvm.org/D58675#1465336
Reviewers: lebedev.ri
Subscribers: hiraditya, mgrang, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D60663
llvm-svn: 358448
Matt Arsenault [Mon, 15 Apr 2019 20:51:12 +0000 (20:51 +0000)]
AMDGPU: Fix unreachable when counting register usage of SGPR96
llvm-svn: 358447
Matt Arsenault [Mon, 15 Apr 2019 20:42:18 +0000 (20:42 +0000)]
AMDGPU: Fix printed format of SReg_96
These are artificial, so I think this should only come up with inline
asm comments.
llvm-svn: 358446
Alexey Bataev [Mon, 15 Apr 2019 20:38:10 +0000 (20:38 +0000)]
[OPENMP][NVPTX]Run parallel regions with num_threads clauses in SPMD
mode.
After the previous patch with the more correct handling of the number of
threads in parallel regions, the parallel regions with num_threads
clauses can be executed in SPMD mode.
llvm-svn: 358445
Sanjay Patel [Mon, 15 Apr 2019 20:25:31 +0000 (20:25 +0000)]
[EarlyCSE] add test for select condition double-negation; NFC
llvm-svn: 358444
Alex Lorenz [Mon, 15 Apr 2019 20:16:19 +0000 (20:16 +0000)]
Revert r358418: "[llvm-objdump] Simplify PrintHelpMessage() logic"
This reverts commit r358418 as it broke `test/Object/objdump-export-list`
on Darwin.
llvm-svn: 358443