platform/upstream/llvm.git
5 years ago[clang-format] Optionally insert a space after unary ! operator
Reuben Thomas [Mon, 8 Apr 2019 12:54:48 +0000 (12:54 +0000)]
[clang-format] Optionally insert a space after unary ! operator

llvm-svn: 357908

5 years agogn build: Merge r357905
Nico Weber [Mon, 8 Apr 2019 12:43:46 +0000 (12:43 +0000)]
gn build: Merge r357905

llvm-svn: 357907

5 years agogn-build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Mon, 8 Apr 2019 12:42:37 +0000 (12:42 +0000)]
gn-build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

llvm-svn: 357906

5 years agoAttempt to recommit r357901
Eugene Leviant [Mon, 8 Apr 2019 12:31:12 +0000 (12:31 +0000)]
Attempt to recommit r357901

llvm-svn: 357905

5 years ago[InstCombine] sdiv exact flag fixup.
Chen Zheng [Mon, 8 Apr 2019 12:08:03 +0000 (12:08 +0000)]
[InstCombine] sdiv exact flag fixup.

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

llvm-svn: 357904

5 years ago[llvm-readobj] Use `reinterpret_cast` instead of C-style casting. NFC.
Xing GUO [Mon, 8 Apr 2019 11:48:36 +0000 (11:48 +0000)]
[llvm-readobj] Use `reinterpret_cast` instead of C-style casting. NFC.

llvm-svn: 357903

5 years agoReverting r357901 as fails to build on some of the buildbots
Eugene Leviant [Mon, 8 Apr 2019 11:37:20 +0000 (11:37 +0000)]
Reverting r357901 as fails to build on some of the buildbots

llvm-svn: 357902

5 years ago[Support] Add zlib independent CRC32
Eugene Leviant [Mon, 8 Apr 2019 11:25:48 +0000 (11:25 +0000)]
[Support] Add zlib independent CRC32

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

llvm-svn: 357901

5 years ago[llvm-exegesis] benchmarkMain(): less cryptic error if built w/o libpfm
Roman Lebedev [Mon, 8 Apr 2019 10:50:31 +0000 (10:50 +0000)]
[llvm-exegesis] benchmarkMain(): less cryptic error if built w/o libpfm

Wanted to check if inablility to measure latency of CMOV32rm
is a regression from D60041 / D60138, but unable to do that
because the llvm-exegesis-{8,9} from debian sid fails
with that cryptic, unhelpful error.

I suspect this will be a better error.

llvm-svn: 357900

5 years ago[CMake] Replace LLVM_ENABLE_CXX1Y and friends with LLVM_CXX_STD
Justin Bogner [Mon, 8 Apr 2019 10:19:17 +0000 (10:19 +0000)]
[CMake] Replace LLVM_ENABLE_CXX1Y and friends with LLVM_CXX_STD

Simplify building with particular C++ standards by replacing the
specific "enable standard X" flags with a flag that allows specifying
the standard you want directly.

We preserve compatibility with the existing flags so that anyone with
those flags in existing caches won't break mysteriously.

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

llvm-svn: 357899

5 years ago[llvm-exegesis][X86] Randomize CMOVcc/SETcc OPERAND_COND_CODE CondCodes
Roman Lebedev [Mon, 8 Apr 2019 10:11:00 +0000 (10:11 +0000)]
[llvm-exegesis][X86] Randomize CMOVcc/SETcc OPERAND_COND_CODE CondCodes

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 357898

5 years agoObject/Minidump: Add support for reading the ModuleList stream
Pavel Labath [Mon, 8 Apr 2019 09:57:29 +0000 (09:57 +0000)]
Object/Minidump: Add support for reading the ModuleList stream

Summary:
The ModuleList stream consists of an integer giving the number of
entries in the list, followed by the list itself. Each entry in the list
describes a module (dynamically loaded objects which were loaded in the
process when it crashed (or when the minidump was generated).

The code for reading the list is relatively straight-forward, with a
single gotcha. Some minidump writers are emitting padding after the
"count" field in order to align the subsequent list on 8 byte boundary
(this depends on how their ModuleList type was defined and the native
alignment of various types on their platform). Fortunately, the minidump
format contains enough redundancy (in the form of the stream length
field in the stream directory), which allows us to detect this situation
and correct it.

This patch just adds the ability to parse the stream. Code for
conversion to/from yaml will come in a follow-up patch.

Reviewers: zturner, amccarth, jhenderson, clayborg

Subscribers: jdoerfert, markmentovai, lldb-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 357897

5 years agoMinidumpParser: parse SystemInfo stream via llvm
Pavel Labath [Mon, 8 Apr 2019 09:53:03 +0000 (09:53 +0000)]
MinidumpParser: parse SystemInfo stream via llvm

I also update the tests for SystemInfo parsing to use the yaml2minidump
capabilities in llvm instead of relying on checked-in binaries.

llvm-svn: 357896

5 years agoPDBFPO: add dyn_cast support
Pavel Labath [Mon, 8 Apr 2019 09:52:57 +0000 (09:52 +0000)]
PDBFPO: add dyn_cast support

This adds the necessary glue so we can use llvm::dyn_cast, instead of
doing a manual type-check followed by a cast. NFC.

llvm-svn: 357895

5 years ago[InstCombine] add more testcases for sdiv exact flag fixup.
Chen Zheng [Mon, 8 Apr 2019 09:19:42 +0000 (09:19 +0000)]
[InstCombine] add more testcases for sdiv exact flag fixup.

llvm-svn: 357894

5 years agoFix signed-unsigned comparison warning in Driver.cpp
Pavel Labath [Mon, 8 Apr 2019 09:17:56 +0000 (09:17 +0000)]
Fix signed-unsigned comparison warning in Driver.cpp

llvm-svn: 357893

5 years ago[Sanitizer] Make wcrtomb test posix-only
Pavel Labath [Mon, 8 Apr 2019 09:13:13 +0000 (09:13 +0000)]
[Sanitizer] Make wcrtomb test posix-only

wcrtomb is not intercepted on windows, so this test fails there. It's
not clear to me why we do not intercept this function there (I'll look
into that separately), but for now this should at least make the windows
sanitizer bot green again (broken by r357889, when I added this test).

I also add "UNSUPPORTED: android" as this function is also not
intercepted there.

llvm-svn: 357892

5 years agomodify-python-lldb.py: Remove ifdef SWIG-removing code
Pavel Labath [Mon, 8 Apr 2019 08:43:07 +0000 (08:43 +0000)]
modify-python-lldb.py: Remove ifdef SWIG-removing code

There are no patterns like that in the generated swig files (there
probably were some back in the days when we were running swig over the
header files directly), so this is dead code and has no effect on the
generated file.

llvm-svn: 357890

5 years ago[Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptor
Pavel Labath [Mon, 8 Apr 2019 08:39:50 +0000 (08:39 +0000)]
[Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptor

Summary:
r357240 added an interceptor for wctomb, which uses a temporary local
buffer to make sure we don't write to unallocated memory. This patch
applies the same technique to wcrtomb, and adds some additional tests
for this function.

Reviewers: vitalybuka, eugenis

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

Tags: #llvm, #sanitizers

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

llvm-svn: 357889

5 years ago[X86] Make LowerOperationWrapper more robust. Remove now unnecessary ReplaceAllUsesWi...
Craig Topper [Mon, 8 Apr 2019 07:39:17 +0000 (07:39 +0000)]
[X86] Make LowerOperationWrapper more robust. Remove now unnecessary ReplaceAllUsesWith from LowerMSCATTER.

Previously LowerOperationWrapper took the number of results from the original
node and counted that many results from the new node. This was intended to drop
chain operands from FP_TO_SINT lowering that uses X87 with memory operations to
stack temporaries. The final load had an extra chain output that needs to be
ignored.

Unfortunately, it didn't work with scatter which has 2 result operands, the
mask output which is discarded and a chain output. The chain output is the one
that is needed but it comes second and it would be dropped by the previous
logic here. To workaround this we were doing a ReplaceAllUses in the lowering
code so that the generic legalization code wouldn't see any uses to replace
since it had been given the wrong result/type.

After this change we take the LowerOperation result directly if the original
node has one result. This allows us to directly return the chain from scatter
or the load data from the FP_TO_SINT case. When the original node has multiple
results we'll ensure the returned node has the same number and copy them over.
For cases where the original node has multiple results and the new code for some
reason has even more results, MERGE_VALUES can be used to pass only the needed
results.

llvm-svn: 357887

5 years ago[ConstantRange] Delete redundnt {z,s}extOrSelf for multiplication
Fangrui Song [Mon, 8 Apr 2019 07:29:24 +0000 (07:29 +0000)]
[ConstantRange] Delete redundnt {z,s}extOrSelf for multiplication

These calls are redundant because the quotients have the same BitWidth
as MinValue/MaxValue.

llvm-svn: 357886

5 years agoFix -emit-reloc against local symbols.
Rui Ueyama [Mon, 8 Apr 2019 06:45:07 +0000 (06:45 +0000)]
Fix -emit-reloc against local symbols.

Previously, we drop symbols starting with .L from the symbol table, so
if there is a relocation that refers a .L symbol, it ended up
referencing a null -- which happened to be interpreted as an absolute
symbol.

This patch copies all symbols including local ones if -emit-reloc is
given.

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

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

llvm-svn: 357885

5 years ago[InstCombine] add testcases for sdiv exact flag fixing - NFC.
Chen Zheng [Mon, 8 Apr 2019 05:49:15 +0000 (05:49 +0000)]
[InstCombine] add testcases for sdiv exact flag fixing - NFC.

llvm-svn: 357884

5 years ago[InstCombine]add testcase for sdiv canonicalizetion - NFC
Chen Zheng [Mon, 8 Apr 2019 03:07:32 +0000 (03:07 +0000)]
[InstCombine]add testcase for sdiv canonicalizetion - NFC

llvm-svn: 357883

5 years ago[X86] Split floating point tests out of atomic-mi.ll into atomic-fp.ll. Add avx and...
Craig Topper [Mon, 8 Apr 2019 01:54:27 +0000 (01:54 +0000)]
[X86] Split floating point tests out of atomic-mi.ll into atomic-fp.ll. Add avx and avx512f command lines. NFC

llvm-svn: 357882

5 years ago[X86] Add avx and avx512f command lines to atomic-non-integer.ll. NFC
Craig Topper [Mon, 8 Apr 2019 01:54:24 +0000 (01:54 +0000)]
[X86] Add avx and avx512f command lines to atomic-non-integer.ll. NFC

llvm-svn: 357881

5 years ago[llvm-objdump] Fix MC/ARM/arm-macho-calls.s
Fangrui Song [Mon, 8 Apr 2019 01:22:38 +0000 (01:22 +0000)]
[llvm-objdump] Fix MC/ARM/arm-macho-calls.s

llvm-svn: 357880

5 years agoIAS is now enabled for all OS on MIPS64
Brad Smith [Mon, 8 Apr 2019 00:03:01 +0000 (00:03 +0000)]
IAS is now enabled for all OS on MIPS64

llvm-svn: 357879

5 years agoEnable IAS for FreeBSD SPARC64.
Brad Smith [Sun, 7 Apr 2019 23:12:31 +0000 (23:12 +0000)]
Enable IAS for FreeBSD SPARC64.

llvm-svn: 357878

5 years ago[clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413
Owen Pan [Sun, 7 Apr 2019 21:05:52 +0000 (21:05 +0000)]
[clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413

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

llvm-svn: 357877

5 years ago[ConstantRange] Add signed/unsigned unionWith()
Nikita Popov [Sun, 7 Apr 2019 20:20:24 +0000 (20:20 +0000)]
[ConstantRange] Add signed/unsigned unionWith()

This extends D59959 to unionWith(), allowing to specify that a
non-wrapping unsigned/signed range is preferred. This is somewhat
less useful than the intersect case, because union operations are
rarer. An example use would the the phi union computed in SCEV.

The implementation is mostly a straightforward use of getPreferredRange(),
but I also had to adjust some <=/< checks to make sure that no ranges with
lower==upper get constructed before they're passed to getPreferredRange(),
as these have additional constraints.

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

llvm-svn: 357876

5 years ago[X86] Use (SUBREG_TO_REG (MOV32rm)) for extloadi64i8/extloadi64i16 when the load...
Craig Topper [Sun, 7 Apr 2019 19:19:44 +0000 (19:19 +0000)]
[X86] Use (SUBREG_TO_REG (MOV32rm)) for extloadi64i8/extloadi64i16 when the load is 4 byte aligned or better and not volatile.

Summary:
Previously we would use MOVZXrm8/MOVZXrm16, but those are longer encodings.

This is similar to what we do in the loadi32 predicate.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357875

5 years ago[ConstantRangeTest] Generalize intersection testing code; NFC
Nikita Popov [Sun, 7 Apr 2019 18:55:45 +0000 (18:55 +0000)]
[ConstantRangeTest] Generalize intersection testing code; NFC

Extract the exhaustive intersection tests into a separate function,
so that it may be reused for unions as well.

llvm-svn: 357874

5 years ago[ConstantRange] Add unsigned and signed intersection types
Nikita Popov [Sun, 7 Apr 2019 18:44:36 +0000 (18:44 +0000)]
[ConstantRange] Add unsigned and signed intersection types

The intersection of two ConstantRanges may consist of two disjoint
ranges. As we can only return one range as the result, we need to
return one of the two possible ranges that cover both. Currently the
result is picked based on set size. However, this is not always
optimal: If we're in an unsigned context, we'd prefer to get a large
unsigned range over a small signed range -- the latter effectively
becomes a full set in the unsigned domain.

This revision adds a PreferredRangeType, which can be either Smallest,
Unsigned or Signed. Smallest is the current behavior and Unsigned and
Signed are new variants that prefer not to wrap the unsigned/signed
domain. The new type isn't used anywhere yet (but SCEV will be a good
first user, see D60035).

I've also added some comments to illustrate the various cases in
intersectWith(), which should hopefully make it more obvious what is
going on.

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

llvm-svn: 357873

5 years ago[LLVM-C] Allow Access to the Type of a Binary
Robert Widmann [Sun, 7 Apr 2019 18:18:42 +0000 (18:18 +0000)]
[LLVM-C] Allow Access to the Type of a Binary

Summary:  Add an accessor for the type of a binary file.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, aheejin, llvm-commits

Tags: #llvm

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

llvm-svn: 357872

5 years ago[ConstantRange] Add isAllNegative() and isAllNonNegative() methods
Nikita Popov [Sun, 7 Apr 2019 17:52:40 +0000 (17:52 +0000)]
[ConstantRange] Add isAllNegative() and isAllNonNegative() methods

Add isAllNegative() and isAllNonNegative() methods to ConstantRange,
which determine whether all values in the constant range are
negative/non-negative.

This is useful for replacing KnownBits isNegative() and isNonNegative()
calls when changing code to use constant ranges.

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

llvm-svn: 357871

5 years agoReapply [ValueTracking] Support min/max selects in computeConstantRange()
Nikita Popov [Sun, 7 Apr 2019 17:22:16 +0000 (17:22 +0000)]
Reapply [ValueTracking] Support min/max selects in computeConstantRange()

Add support for min/max flavor selects in computeConstantRange(),
which allows us to fold comparisons of a min/max against a constant
in InstSimplify. This fixes an infinite InstCombine loop, with the
test case taken from D59378.

Relative to the previous iteration, this contains some adjustments for
AMDGPU med3 tests: The AMDGPU target runs InstSimplify prior to codegen,
which ends up constant folding some existing med3 tests after this
change. To preserve these tests a hidden -amdgpu-scalar-ir-passes option
is added, which allows disabling scalar IR passes (that use InstSimplify)
for testing purposes.

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

llvm-svn: 357870

5 years ago[llvm-objdump] Split disassembleObject and simplify --{start,stop}-address handling
Fangrui Song [Sun, 7 Apr 2019 16:33:24 +0000 (16:33 +0000)]
[llvm-objdump] Split disassembleObject and simplify --{start,stop}-address handling

The main disassembly loop is hard to read due to special handling of ARM
ELF data & ELF data. Split off the logic into two functions
dumpARMELFData and dumpELFData. Hoist some checks outside of the loop.

--start-address --stop-address have redundant checks and minor off-by-1
issues. Fix them.

llvm-svn: 357869

5 years agolast changes for now
Chris Lattner [Sun, 7 Apr 2019 14:34:24 +0000 (14:34 +0000)]
last changes for now

llvm-svn: 357868

5 years agovarious improvements in wording, also unbreak the bot
Chris Lattner [Sun, 7 Apr 2019 14:23:11 +0000 (14:23 +0000)]
various improvements in wording, also unbreak the bot

llvm-svn: 357867

5 years ago[DWARF] DWARFDebugLine: delete unused parameter `Offset`
Fangrui Song [Sun, 7 Apr 2019 13:56:14 +0000 (13:56 +0000)]
[DWARF] DWARFDebugLine: delete unused parameter `Offset`

llvm-svn: 357866

5 years agomake a bunch of cleanups in wording and tone
Chris Lattner [Sun, 7 Apr 2019 13:42:29 +0000 (13:42 +0000)]
make a bunch of cleanups in wording and tone

llvm-svn: 357865

5 years ago[CostModel][X86] Masked load legalization requires an binary-shuffle not a select...
Simon Pilgrim [Sun, 7 Apr 2019 13:26:09 +0000 (13:26 +0000)]
[CostModel][X86] Masked load legalization requires an binary-shuffle not a select (PR39812)

Expansion/truncation is better described by SK_PermuteTwoSrc than SK_Select

llvm-svn: 357864

5 years agoremove some unhelpful language from the tutorial
Chris Lattner [Sun, 7 Apr 2019 13:17:16 +0000 (13:17 +0000)]
remove some unhelpful language from the tutorial

llvm-svn: 357863

5 years agoCopy the C++ kaleidoscope tutorial into a subdirectory and clean up various things...
Chris Lattner [Sun, 7 Apr 2019 13:14:23 +0000 (13:14 +0000)]
Copy the C++ kaleidoscope tutorial into a subdirectory and clean up various things, aligning with the direction of the WiCT workshop, and Meike Baumgärtner's view of how this should work.  The old version of the documentation is unmodified, this is an experiment.

llvm-svn: 357862

5 years ago[DAG] Pull out ComputeNumSignBits call to make debugging easier. NFCI.
Simon Pilgrim [Sun, 7 Apr 2019 11:49:33 +0000 (11:49 +0000)]
[DAG] Pull out ComputeNumSignBits call to make debugging easier. NFCI.

llvm-svn: 357861

5 years ago[X86][SSE] SimplifyDemandedBitsForTargetNode - Add initial PACKSS support
Simon Pilgrim [Sun, 7 Apr 2019 10:40:01 +0000 (10:40 +0000)]
[X86][SSE] SimplifyDemandedBitsForTargetNode - Add initial PACKSS support

In the case where we only want the sign bit (e.g. when using PACKSS truncation of comparison results for MOVMSK) then we can just demand the sign bit of the source operands.

This makes use of the fact that PACKSS saturates out of range values to the min/max int values - so the sign bit is always preserved.

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

llvm-svn: 357859

5 years ago[llvm-objdump] Fix split of source lines; don't ltrim source lines
Fangrui Song [Sun, 7 Apr 2019 10:16:46 +0000 (10:16 +0000)]
[llvm-objdump] Fix split of source lines; don't ltrim source lines

If the file does not end with a newline, it may be dropped. Fix the
splitting algorithm.

Also delete an unnecessary SourceCache lookup.

llvm-svn: 357858

5 years ago[llvm-objdump] Simplify some ELF typename: ELFFile<ELFT>::Elf_xxx -> ELFT::xxx
Fangrui Song [Sun, 7 Apr 2019 08:29:04 +0000 (08:29 +0000)]
[llvm-objdump] Simplify some ELF typename: ELFFile<ELFT>::Elf_xxx -> ELFT::xxx

llvm-svn: 357857

5 years ago.
Fangrui Song [Sun, 7 Apr 2019 08:28:56 +0000 (08:28 +0000)]
.

llvm-svn: 357856

5 years ago[llvm-objdump] Simplify Expected<T> handling with unwrapOrError
Fangrui Song [Sun, 7 Apr 2019 08:19:55 +0000 (08:19 +0000)]
[llvm-objdump] Simplify Expected<T> handling with unwrapOrError

llvm-svn: 357855

5 years ago[ConstantRange] Shl considers full-set shifting to last bit position.
Marcello Maggioni [Sun, 7 Apr 2019 06:12:44 +0000 (06:12 +0000)]
[ConstantRange] Shl considers full-set shifting to last bit position.

if we do SHL of two 16-bit ranges like [0, 30000) with [1,2) we get
"full-set" instead of what I would have expected [0, 60000) which is
still in the 16-bit unsigned range.

This patch changes the SHL algorithm to allow getting a usable range
even in this case.

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

llvm-svn: 357854

5 years ago[llvm-objdump] Simplify disassembleObject
Fangrui Song [Sun, 7 Apr 2019 05:32:16 +0000 (05:32 +0000)]
[llvm-objdump] Simplify disassembleObject

* Use std::binary_search to replace some std::lower_bound
* Use llvm::upper_bound to replace some std::upper_bound
* Use format_hex and support::endian::read{16,32}

llvm-svn: 357853

5 years agoChange some StringRef::data() reinterpret_cast to bytes_begin() or arrayRefFromString...
Fangrui Song [Sun, 7 Apr 2019 03:58:42 +0000 (03:58 +0000)]
Change some StringRef::data() reinterpret_cast to bytes_begin() or arrayRefFromStringRef()

llvm-svn: 357852

5 years ago[clang-format] Fix Bug 41407
Owen Pan [Sat, 6 Apr 2019 23:10:11 +0000 (23:10 +0000)]
[clang-format] Fix Bug 41407
Differential Revision: https://reviews.llvm.org/D60359

llvm-svn: 357851

5 years ago[gn] Support for per-target runtime directory layout
Petr Hosek [Sat, 6 Apr 2019 23:05:56 +0000 (23:05 +0000)]
[gn] Support for per-target runtime directory layout

This change also introduces the clang_enable_per_target_runtime_dir
to enable the use of per-target runtime directory layout which is the
equivalent of LLVM_ENABLE_PER_TARGET_RUNTIME_DIR CMake option.

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

llvm-svn: 357850

5 years ago[NFC] Fix typo in comment.
Nick Lewycky [Sat, 6 Apr 2019 22:05:24 +0000 (22:05 +0000)]
[NFC] Fix typo in comment.

llvm-svn: 357849

5 years ago[X86] When converting (x << C1) AND C2 to (x AND (C2>>C1)) << C1 during isel, try...
Craig Topper [Sat, 6 Apr 2019 19:00:11 +0000 (19:00 +0000)]
[X86] When converting (x << C1) AND C2 to (x AND (C2>>C1)) << C1 during isel, try using andl over andq by favoring 32-bit unsigned immediates.

llvm-svn: 357848

5 years ago[X86] combineBitcastvxi1 - provide dst VT and src SDValue directly. NFCI.
Simon Pilgrim [Sat, 6 Apr 2019 18:54:17 +0000 (18:54 +0000)]
[X86] combineBitcastvxi1 - provide dst VT and src SDValue directly. NFCI.

Prep work to make it easier to reuse the BITCAST->MOVSMK combine in other cases.

llvm-svn: 357847

5 years ago[X86] Use a signed mask in foldMaskedShiftToScaledMask to enable a shorter immediate...
Craig Topper [Sat, 6 Apr 2019 18:00:50 +0000 (18:00 +0000)]
[X86] Use a signed mask in foldMaskedShiftToScaledMask to enable a shorter immediate encoding.

This function reorders AND and SHL to enable the SHL to fold into an LEA. The
upper bits of the AND will be shifted out by the SHL so it doesn't matter what
mask value we use for these bits. By using sign bits from the original mask in
these upper bits we might enable a shorter immediate encoding to be used.

llvm-svn: 357846

5 years ago[X86] Add test cases to show missed opportunities to use a sign extended 8 or 32...
Craig Topper [Sat, 6 Apr 2019 18:00:45 +0000 (18:00 +0000)]
[X86] Add test cases to show missed opportunities to use a sign extended 8 or 32 bit immediate AND when reversing SHL+AND to form an LEA.

When we shift the AND mask over we should shift in sign bits instead of zero bits. The scale in the LEA will shift these bits out so it doesn't matter whether we mask the bits off or not. Using sign bits will potentially allow a sign extended immediate to be used.

Also add some other test cases for cases that are currently optimal.

llvm-svn: 357845

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sat, 6 Apr 2019 18:00:41 +0000 (18:00 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 357844

5 years agoFix spelling mistake. NFCI.
Simon Pilgrim [Sat, 6 Apr 2019 15:38:34 +0000 (15:38 +0000)]
Fix spelling mistake. NFCI.

llvm-svn: 357843

5 years ago[X86] Add AVX-target expandload and compressstore tests
Simon Pilgrim [Sat, 6 Apr 2019 14:40:52 +0000 (14:40 +0000)]
[X86] Add AVX-target expandload and compressstore tests

llvm-svn: 357842

5 years ago[llvm-exegesis][X86] Handle CMOVcc/SETcc OPERAND_COND_CODE OperandType
Roman Lebedev [Sat, 6 Apr 2019 14:16:26 +0000 (14:16 +0000)]
[llvm-exegesis][X86] Handle CMOVcc/SETcc OPERAND_COND_CODE OperandType

Summary:
D60041 / D60138 refactoring changed how CMOV/SETcc opcodes
are handled. concode is now an immediate, with it's own operand type.

This at least allows to not crash on the opcode.
However, this still won't generate all the snippets
with all the condcode enumerators. D60066 does that.

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 357841

5 years ago[X86] Split expandload and compressstore tests
Simon Pilgrim [Sat, 6 Apr 2019 14:14:54 +0000 (14:14 +0000)]
[X86] Split expandload and compressstore tests

llvm-svn: 357840

5 years ago[X86][SSE] Add more exhaustive masked load/store tests
Simon Pilgrim [Sat, 6 Apr 2019 14:01:37 +0000 (14:01 +0000)]
[X86][SSE] Add more exhaustive masked load/store tests

Reordered/renamed some existing tests to match the cleaned up order

llvm-svn: 357839

5 years ago[CostModel][X86] Add more exhaustive masked load/store/gather/scatter/expand/compress...
Simon Pilgrim [Sat, 6 Apr 2019 12:08:37 +0000 (12:08 +0000)]
[CostModel][X86] Add more exhaustive masked load/store/gather/scatter/expand/compress cost tests

llvm-svn: 357838

5 years ago[clang-format] BreakAfterReturnType ignored on functions with numeric template parameters
Paul Hoad [Sat, 6 Apr 2019 10:13:04 +0000 (10:13 +0000)]
[clang-format] BreakAfterReturnType ignored on functions with numeric template parameters

Summary:
Addresses PR40696 - https://bugs.llvm.org/show_bug.cgi?id=40696

The BreakAfterReturnType didn't work if it had a single arguments which was a template with an integer template parameter

```
int  foo(A<8> a) { return a; }
```

When run with the Mozilla style. would not break after the `int`

```
int TestFn(A<8> a)
{
  return a;
}

```

This revision resolves this issue by allowing numeric constants to be considered function parameters if if seen inside `<>`

Reviewers: djasper, klimek, JonasToth, krasimir, reuk, alexfh

Reviewed By: klimek

Subscribers: cfe-commits, llvm-commits

Tags: #clang-tools-extra

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

llvm-svn: 357837

5 years ago[AMDGPU] Sort out and rename multiple CI/VI predicates
Stanislav Mekhanoshin [Sat, 6 Apr 2019 09:20:48 +0000 (09:20 +0000)]
[AMDGPU] Sort out and rename multiple CI/VI predicates

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

llvm-svn: 357835

5 years ago[DWARF] Simplify DWARFDebugAranges::findAddress
Fangrui Song [Sat, 6 Apr 2019 09:12:53 +0000 (09:12 +0000)]
[DWARF] Simplify DWARFDebugAranges::findAddress

The current lower_bound approach has to check two iterators pos and pos-1.
Changing it to upper_bound allows us to check one iterator (similar to
DWARFUnitVector::getUnitFor*).

llvm-svn: 357834

5 years ago[Symbolize] Uniquify sorted vector<pair<SymbolDesc, StringRef>>
Fangrui Song [Sat, 6 Apr 2019 02:18:56 +0000 (02:18 +0000)]
[Symbolize] Uniquify sorted vector<pair<SymbolDesc, StringRef>>

llvm-svn: 357833

5 years ago[TSan][libdispatch] Remove Darwin-only version of fully-ported tests
Julian Lettner [Sat, 6 Apr 2019 01:41:40 +0000 (01:41 +0000)]
[TSan][libdispatch] Remove Darwin-only version of fully-ported tests

Remove 10 tests that already have a copy in tsan/libdispatch, without
dependencies on Darwin-specifis.

llvm-svn: 357832

5 years agotsan: Update test expectations.
Peter Collingbourne [Sat, 6 Apr 2019 00:43:17 +0000 (00:43 +0000)]
tsan: Update test expectations.

llvm-svn: 357831

5 years agogn build: Pacify `gn format`
Nico Weber [Fri, 5 Apr 2019 23:57:10 +0000 (23:57 +0000)]
gn build: Pacify `gn format`

llvm-svn: 357830

5 years agoUnify random timeouts throughout LLDB and make them configurable.
Adrian Prantl [Fri, 5 Apr 2019 22:43:42 +0000 (22:43 +0000)]
Unify random timeouts throughout LLDB and make them configurable.

Since these timeouts guard against catastrophic error in debugserver,
I also increased all of them to the maximum value among them.

The motivation for this test was the observation that an asanified
LLDB would often exhibit seemingly random test failures that could be
traced back to debugserver packets getting out of sync. With this path
applied I can no longer reproduce the one particular failure mode that
I was investigating.

rdar://problem/49441261

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

llvm-svn: 357829

5 years agoAfter rL357618, quote ${CMAKE_THREAD_LIBS_INIT} so CMake does not
Dimitry Andric [Fri, 5 Apr 2019 22:19:40 +0000 (22:19 +0000)]
After rL357618, quote ${CMAKE_THREAD_LIBS_INIT} so CMake does not
complain when the variable is empty.  Fixes PR 41401.

llvm-svn: 357828

5 years agoRevert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."
Artem Dergachev [Fri, 5 Apr 2019 22:11:28 +0000 (22:11 +0000)]
Revert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."

This reverts commit r357823.

Was breaking clang-tidy!

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

llvm-svn: 357827

5 years ago[PDB Docs] Add documentation for the hash table format.
Zachary Turner [Fri, 5 Apr 2019 22:09:30 +0000 (22:09 +0000)]
[PDB Docs] Add documentation for the hash table format.

llvm-svn: 357826

5 years ago[PDB Docs] The IPI Stream actually has index 4.
Zachary Turner [Fri, 5 Apr 2019 22:09:14 +0000 (22:09 +0000)]
[PDB Docs] The IPI Stream actually has index 4.

llvm-svn: 357825

5 years ago[testsuite] Split Objective-C new syntax test
Jonas Devlieghere [Fri, 5 Apr 2019 22:06:53 +0000 (22:06 +0000)]
[testsuite] Split Objective-C new syntax test

This splits the second longest test into separate test cases. Similar to
what we did for the Objective-C data formatters in r357786.

llvm-svn: 357824

5 years ago[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().
Artem Dergachev [Fri, 5 Apr 2019 21:48:52 +0000 (21:48 +0000)]
[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().

As the unit test demonstrates, subtracting 1 from the offset was unnecessary.

The only user of this function was the plist file emitter (in Static Analyzer
and ARCMigrator). It means that a lot of Static Analyzer's plist arrows
are in fact off by one character. The patch carefully preserves this
completely incorrect behavior and causes no functional change,
i.e. no plist format breakage.

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

llvm-svn: 357823

5 years ago[LLVM-C] Begin to Expose A More General Binary Interface
Robert Widmann [Fri, 5 Apr 2019 21:36:50 +0000 (21:36 +0000)]
[LLVM-C] Begin to Expose A More General Binary Interface

Summary:
Provides a new type, `LLVMBinaryRef`, and a binding to `llvm::object::createBinary` for more general interoperation with binary files than `LLVMObjectFileRef`.  It also provides the proper non-consuming API for input buffers and populates an out parameter for error handling if necessary - two things the previous API did not do.

In a follow-up, I'll define section and symbol iterators and begin to build upon the existing test infrastructure.

This patch is a first step towards deprecating that API and replacing it with something more robust.

Reviewers: deadalnix, whitequark

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357822

5 years ago[gn] Support for building compiler-rt builtins
Petr Hosek [Fri, 5 Apr 2019 21:30:40 +0000 (21:30 +0000)]
[gn] Support for building compiler-rt builtins

This is support for building compiler-rt builtins, The library build
should be complete for a subset of supported platforms, but not all
CMake options have been replicated in GN.

We always use the just built compiler to build all the runtimes, which
is equivalent to the CMake runtimes build. This simplifies the build
configuration because we don't need to support arbitrary host compiler
and can always assume the latest Clang. With GN's toolchain support,
this is significantly more efficient than the CMake runtimes build.

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

llvm-svn: 357821

5 years ago[globalisel] Allow combiners to query legality
Daniel Sanders [Fri, 5 Apr 2019 21:22:17 +0000 (21:22 +0000)]
[globalisel] Allow combiners to query legality

llvm-svn: 357820

5 years ago[PDB Docs] Delete * LINKER * Stream information.
Zachary Turner [Fri, 5 Apr 2019 21:16:00 +0000 (21:16 +0000)]
[PDB Docs] Delete * LINKER * Stream information.

This is actually just a module debug info stream, so it should
technically be covered by a discussion of the module list.

llvm-svn: 357819

5 years ago[libc++][CMake] Make sure the benchmarks link against libc++abi
Louis Dionne [Fri, 5 Apr 2019 21:05:32 +0000 (21:05 +0000)]
[libc++][CMake] Make sure the benchmarks link against libc++abi

The refactoring in r357811 made it so that we didn't add the ABI library
to the list of LIBCXX_LIBRARIES. As a result, benchmarks didn't link to
the ABI library and were missing symbols. This broke the build bots.

As a drive-by fix, we also provide the SHARED ABI library to the linker
script instead of the STATIC ABI library.

This couldn't be discovered on Apple platforms because libc++.dylib
re-exports libc++abi.dylib symbols there.

llvm-svn: 357818

5 years ago[CMake] Don't explicitly use LLVM_LIBRARY_DIR in standalone builds
Alex Langford [Fri, 5 Apr 2019 21:01:50 +0000 (21:01 +0000)]
[CMake] Don't explicitly use LLVM_LIBRARY_DIR in standalone builds

Summary:
This line is unnecessary because add_llvm_executable will handle
linking the correct LLVM libraries for you. LLDB standalone builds are totally
fine without this.

In the best case, having this line here is harmless. In the worst case it can
cause link issues.

If you build lldb-server for android using the standalone build, this line
will cause LLVM_LIBRARY_DIR to be the first place you look for libraries.
This is an issue because if you built libc++, it will try to link against
that one instead of the one from the android NDK.  Meanwhile, the LLVM libraries
you're linking against were linked against the libc++ from the NDK.

Ideally, we would take advantage of the AFTER option for link_directories(), but
that was not available in LLDB's minimum supported version of CMake (CMake 3.4.3).

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

llvm-svn: 357817

5 years ago[InstCombine] add more tests for fmul+fdiv+sqrt; NFC
Sanjay Patel [Fri, 5 Apr 2019 20:54:35 +0000 (20:54 +0000)]
[InstCombine] add more tests for fmul+fdiv+sqrt; NFC

llvm-svn: 357816

5 years ago[globalisel] Support 3-type legalForCartesianProduct()
Daniel Sanders [Fri, 5 Apr 2019 20:47:13 +0000 (20:47 +0000)]
[globalisel] Support 3-type legalForCartesianProduct()

llvm-svn: 357815

5 years agoFix PR41395 - __cxa_vec_new may overflow in allocation size calculation.
Eric Fiselier [Fri, 5 Apr 2019 20:38:43 +0000 (20:38 +0000)]
Fix PR41395 - __cxa_vec_new may overflow in allocation size calculation.

llvm-svn: 357814

5 years ago[Test] Remove no_debug_info_test decorator from Obj-C data formatters.
Jonas Devlieghere [Fri, 5 Apr 2019 20:37:52 +0000 (20:37 +0000)]
[Test] Remove no_debug_info_test decorator from Obj-C data formatters.

As discussed in https://reviews.llvm.org/D60300.

llvm-svn: 357813

5 years ago[LLVM-C] Add bindings to insert basic blocks
Robert Widmann [Fri, 5 Apr 2019 20:32:43 +0000 (20:32 +0000)]
[LLVM-C] Add bindings to insert basic blocks

Summary:
Now that we can create standalone basic blocks, it's useful to be able to append them.  Add bindings to

- Insert a basic block after the current insertion block
- Append a basic block to the end of a function's list of basic blocks

Reviewers: whitequark, deadalnix, harlanhaskins

Reviewed By: whitequark, harlanhaskins

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357812

5 years ago[libc++] Localize CMake code only related to the shared library
Louis Dionne [Fri, 5 Apr 2019 20:29:54 +0000 (20:29 +0000)]
[libc++] Localize CMake code only related to the shared library

Summary:
There's a lot of CMake logic that's only relevant to the shared library,
yet it was using a code path and setting variables that impact both the
shared and the static libraries. This patch moves this logic so that it
clearly only impacts the shared library.

Reviewers: phosek, smeenai, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 357811

5 years ago[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.
Artem Dergachev [Fri, 5 Apr 2019 20:18:53 +0000 (20:18 +0000)]
[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.

The idea behind this heuristic is that normally the visitor is there to
inform the user that a certain function may fail to initialize a certain
out-parameter. For system header functions this is usually dictated by the
contract, and it's unlikely that the header function has accidentally
forgot to put the value into the out-parameter; it's more likely
that the user has intentionally skipped the error check.

Warnings on skipped error checks are more like security warnings;
they aren't necessarily useful for all users, and they should instead
be introduced on a per-API basis.

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

llvm-svn: 357810

5 years ago[X86] Enable tail calls for CallingConv::Swift
Francis Visoiu Mistrih [Fri, 5 Apr 2019 20:18:25 +0000 (20:18 +0000)]
[X86] Enable tail calls for CallingConv::Swift

It's currently only enabled on AArch64 (enabled in r281376).

llvm-svn: 357809

5 years ago[X86] Preserve operand flag when expanding TCRETURNri
Francis Visoiu Mistrih [Fri, 5 Apr 2019 20:18:21 +0000 (20:18 +0000)]
[X86] Preserve operand flag when expanding TCRETURNri

The expansion of TCRETURNri(64) would not keep operand flags like
undef/renamable/etc. which can result in machine verifier issues.

Also add plumbing to be able to use `-run-pass=x86-pseudo`.

llvm-svn: 357808

5 years agoUse binary write mode in WriteToFile function to avoid appended \r characters on...
Vitaly Buka [Fri, 5 Apr 2019 20:17:03 +0000 (20:17 +0000)]
Use binary write mode in WriteToFile function to avoid appended \r characters on Windows

Summary:
When using libfuzzer on Windows, in the contents of a crash sample, bytes that can be mistaken for a \n are replaced by a \r\n sequence. As a consequence, crashes are not reproducible. This patch will open files in binary mode to fix this issue. The patch does not affect POSIX systems.

Patch by tuktuk

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: dexonsmith, jdoerfert, llvm-commits, #sanitizers

Tags: #llvm, #sanitizers

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

llvm-svn: 357807

5 years agoELF: De-template ELFFileBase. NFCI.
Peter Collingbourne [Fri, 5 Apr 2019 20:16:26 +0000 (20:16 +0000)]
ELF: De-template ELFFileBase. NFCI.

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

llvm-svn: 357806

5 years ago[AMDGPU] Add MachineDCE pass after RenameIndependentSubregs
Stanislav Mekhanoshin [Fri, 5 Apr 2019 20:11:32 +0000 (20:11 +0000)]
[AMDGPU] Add MachineDCE pass after RenameIndependentSubregs

Detect dead lanes can create some dead defs. Then RenameIndependentSubregs
will break a REG_SEQUENCE which may use these dead defs. At this point
a dead instruction can be removed but we do not run a DCE anymore.

MachineDCE was only running before live variable analysis. The patch
adds a mean to preserve LiveIntervals and SlotIndexes in case it works
past this.

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

llvm-svn: 357805