platform/upstream/llvm.git
6 years ago[X86][SSE] Fix PACKSS bitcast test from rL340166
Simon Pilgrim [Mon, 20 Aug 2018 11:47:15 +0000 (11:47 +0000)]
[X86][SSE] Fix PACKSS bitcast test from rL340166

We need the signbits to extends to lower 16-bits of the even elements

llvm-svn: 340167

6 years ago[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle a partial...
Simon Pilgrim [Mon, 20 Aug 2018 11:10:12 +0000 (11:10 +0000)]
[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle a partial sign bits extension through a bitcast

llvm-svn: 340166

6 years ago[X86] Drop unnecessary exact qualifier from packss test
Simon Pilgrim [Mon, 20 Aug 2018 11:01:51 +0000 (11:01 +0000)]
[X86] Drop unnecessary exact qualifier from packss test

llvm-svn: 340165

6 years ago[LLD][ELF] - Fix warning.
George Rimar [Mon, 20 Aug 2018 10:29:21 +0000 (10:29 +0000)]
[LLD][ELF] - Fix warning.

This fixes the following warning when compiling with gcc version 8.0.1 20180319 (experimental) (GCC):

/home/umb/LLVM/llvm/tools/lld/ELF/SyntheticSections.cpp:1951:46: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
     return OS->SectionIndex >= SHN_LORESERVE ? SHN_XINDEX : OS->SectionIndex;

llvm-svn: 340164

6 years ago[DWARF] Refactor DWARF classes to use unified error reporting. NFC.
Victor Leschuk [Mon, 20 Aug 2018 09:59:08 +0000 (09:59 +0000)]
[DWARF] Refactor DWARF classes to use unified error reporting. NFC.

DWARF-related classes in lib/DebugInfo/DWARF contained
duplicating code for creating StringError instances, like:

template <typename... Ts>
static Error createError(char const *Fmt, const Ts &... Vals) {
  std::string Buffer;
  raw_string_ostream Stream(Buffer);
  Stream << format(Fmt, Vals...);
  return make_error<StringError>(Stream.str(), inconvertibleErrorCode());
}

Similar function was placed in Support lib in https://reviews.llvm.org/D49824

This revision makes DWARF classes use this function
instead of their local implementation of it.

Reviewers: aprantl, dblaikie, probinson, wolfgangp, JDevlieghere, jhenderson

Reviewed By: JDevlieghere, jhenderson

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

llvm-svn: 340163

6 years agoUse LLVM_BUILTIN_TRAP not __builtin_trap to appease windows builds. NFCI.
Simon Pilgrim [Mon, 20 Aug 2018 09:49:20 +0000 (09:49 +0000)]
Use LLVM_BUILTIN_TRAP not __builtin_trap to appease windows builds. NFCI.

llvm-svn: 340162

6 years ago[clangd] Simplify the code using UniqueStringSaver, NFC.
Haojian Wu [Mon, 20 Aug 2018 09:47:12 +0000 (09:47 +0000)]
[clangd] Simplify the code using UniqueStringSaver, NFC.

llvm-svn: 340161

6 years ago[ELF] Add support for Armv5 and Armv6 compatible Thunks
Peter Smith [Mon, 20 Aug 2018 09:37:50 +0000 (09:37 +0000)]
[ELF] Add support for Armv5 and Armv6 compatible Thunks

Older Arm architectures do not support the MOVT and MOVW instructions so we
must use an alternative sequence of instructions to transfer control to the
destination.

Assuming at least Armv5 this patch adds support for Thunks that load or add
to the program counter. Note that there are no Armv5 Thumb Thunks as there
is no Thumb branch instruction in Armv5 that supports Thunks. These thunks
will not work for Armv4t (arm7tdmi) as this architecture cannot change state
from using the LDR or ADD instruction.

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

llvm-svn: 340160

6 years ago[ELF] Add support for older Arm Architectures with smaller branch range
Peter Smith [Mon, 20 Aug 2018 09:19:30 +0000 (09:19 +0000)]
[ELF] Add support for older Arm Architectures with smaller branch range

The Thumb BL and BLX instructions on older Arm Architectures such as v5 and
v6 have a constrained encoding J1 and J2 must equal 1, later Architectures
relaxed this restriction allowing J1 and J2 to be used to calculate a larger
immediate.

This patch adds support for the old encoding, it is used when the build
attributes for the input objects only contain older architectures.

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

llvm-svn: 340159

6 years ago[AArch64][SVE] Asm: Add SVE System registers
Sander de Smalen [Mon, 20 Aug 2018 09:16:59 +0000 (09:16 +0000)]
[AArch64][SVE] Asm: Add SVE System registers

This patch adds system registers for controlling aspects of SVE:
- ZCR_EL1  (r/w)   visible at EL1 and EL0.
- ZCR_EL2  (r/w)   visible at EL2 and Non-secure EL1 and EL0.
- ZCR_EL3  (r/w)   visible at all exception levels.

and a system register identifying SVE:
- ID_AA64ZFR0_EL1  (r)  SVE Feature identifier.

Reviewers: SjoerdMeijer, samparker, pbarrio, fhahn, javed.absar

Reviewed By: SjoerdMeijer

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

llvm-svn: 340158

6 years ago[clangd] NFC: Cleanup Dex Iterator comments and simplify tests
Kirill Bobyrev [Mon, 20 Aug 2018 09:16:14 +0000 (09:16 +0000)]
[clangd] NFC: Cleanup Dex Iterator comments and simplify tests

Proposed changes:

* Cleanup comments in `clangd/index/dex/Iterator.h`: Vim's `gq`
  formatting added redundant spaces instead of newlines in few
  places
* Few comments in `OrIterator` are wrong
* Use `EXPECT_TRUE(Condition)` instead of
  `EXPECT_THAT(Condition, true)` (same with `EXPECT_FALSE`)
* Don't expose `dump()` method to the public by misplacing
  `private:`

This patch does not affect functionality.

Reviewed by: ioeric

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

llvm-svn: 340157

6 years ago[clangd] Add missing lock in the lookup.
Haojian Wu [Mon, 20 Aug 2018 09:07:59 +0000 (09:07 +0000)]
[clangd] Add missing lock in the lookup.

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 340156

6 years ago[clangd] Implement TRUE Iterator
Kirill Bobyrev [Mon, 20 Aug 2018 08:47:30 +0000 (08:47 +0000)]
[clangd] Implement TRUE Iterator

This patch introduces TRUE Iterator which efficiently handles posting
lists containing all items within `[0, Size)` range.

Reviewed by: ioeric

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

llvm-svn: 340155

6 years ago[llvm] Make YAML serialization up to 2.5 times faster
Kirill Bobyrev [Mon, 20 Aug 2018 07:00:36 +0000 (07:00 +0000)]
[llvm] Make YAML serialization up to 2.5 times faster

This patch significantly improves performance of the YAML serializer by
optimizing `YAML::isNumeric` function. This function is called on the
most strings and is highly inefficient for two reasons:

* It uses `Regex`, which is parsed and compiled each time this
  function is called
* It uses multiple passes which are not necessary

This patch introduces stateful ad hoc YAML number parser which does not
rely on `Regex`. It also fixes YAML number format inconsistency: current
implementation supports C-stile octal number format (`01234567`) which
was present in YAML 1.0 specialization (http://yaml.org/spec/1.0/),
[Section 2.4. Tags, Example 2.19] but was deprecated and is no longer
present in latest YAML 1.2 specification
(http://yaml.org/spec/1.2/spec.html), see [Section 10.3.2. Tag
Resolution]. Since the rest of the rest of the implementation does not
support other deprecated YAML 1.0 numeric features such as sexagecimal
numbers, commas as delimiters it is treated as inconsistency and not
longer supported. This patch also adds unit tests to ensure the validity
of proposed implementation.

This performance bottleneck was identified while profiling Clangd's
global-symbol-builder tool with my colleague @ilya-biryukov. The
substantial part of the runtime was spent during a single-thread Reduce
phase, which concludes with YAML serialization of collected symbol
collection. Regex matching was accountable for approximately 45% of the
whole runtime (which involves sharded Map phase), now it is reduced to
18% (which is spent in `clang::clangd::CanonicalIncludes` and can be
also optimized because all used regexes are in fact either suffix
matches or exact matches).

`llvm-yaml-numeric-parser-fuzzer` was used to ensure the validity of the
proposed regex replacement. Fuzzing for ~60 hours using 10 threads did
not expose any bugs.

Benchmarking `global-symbol-builder` (using `hyperfine --warmup 2
--min-runs 5 'command 1' 'command 2'`) tool by processing a reasonable
amount of code (26 source files matched by
`clang-tools-extra/clangd/*.cpp` with all transitive includes) confirmed
our understanding of the performance bottleneck nature as it speeds up
the command by the factor of 1.6x:

| Command | Mean [s] | Min…Max [s] |
| this patch (D50839) | 84.7 ± 0.6 | 83.3…84.7 |
| master (rL339849) | 133.1 ± 0.8 | 132.4…134.6 |

Using smaller samples (e.g. by collecting symbols from
`clang-tools-extra/clangd/AST.cpp` only) yields even better performance
improvement, which is expected because Map phase takes less time
compared to Reduce and is 2.05x faster and therefore would significantly
improve the performance of standalone YAML serializations.

| Command | Mean [ms] | Min…Max [ms] |
| this patch (D50839) | 3702.2 ± 48.7 | 3635.1…3752.3 |
| master (rL339849) | 7607.6 ± 109.5 | 7533.3…7796.4 |

Reviewed by: zturner, ilya-biryukov

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

llvm-svn: 340154

6 years ago[SimplifyCFG] Replace some uses of bitwise or with logical or
Justin Bogner [Mon, 20 Aug 2018 06:37:11 +0000 (06:37 +0000)]
[SimplifyCFG] Replace some uses of bitwise or with logical or

It's clearer to use logical or for boolean values. Thanks to Steven
Zhang for noticing!

llvm-svn: 340153

6 years agoRemove unnecessary applyMask() application.
Rui Ueyama [Mon, 20 Aug 2018 06:33:29 +0000 (06:33 +0000)]
Remove unnecessary applyMask() application.

applyMask(0xffffffff, x) is an identity function.

llvm-svn: 340152

6 years ago[NFC] Minor update to comment
Aleksandr Urakov [Mon, 20 Aug 2018 05:59:27 +0000 (05:59 +0000)]
[NFC] Minor update to comment

Update comment after rLLDB339994

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

llvm-svn: 340151

6 years ago[InstCombine] Move some variable declarations into a more appropriate scope. NFC
Craig Topper [Mon, 20 Aug 2018 05:35:12 +0000 (05:35 +0000)]
[InstCombine] Move some variable declarations into a more appropriate scope. NFC

llvm-svn: 340150

6 years ago[PowerPC] Add a peephole post RA to transform the inst that fed by add
QingShan Zhang [Mon, 20 Aug 2018 02:52:55 +0000 (02:52 +0000)]
[PowerPC] Add a peephole post RA to transform the inst that fed by add

If the arch is P8, we will select XFLOAD to load the floating point, and then, expand it to vsx and non-vsx X-form instruction post RA. This patch is trying to convert the X-form to D-form if it meets the requirement that one operand of the x-form inst is the special Zero register, and another operand fed by add inst. i.e.
y = add imm, reg
LFDX. 0, y
-->
LFD imm(reg)

Reviewers: Nemanjai
Differential Revision: https://reviews.llvm.org/D49007

llvm-svn: 340149

6 years ago[bindings/go] Add coroutine passes
whitequark [Sun, 19 Aug 2018 23:40:05 +0000 (23:40 +0000)]
[bindings/go] Add coroutine passes

Add Go bindings for CoroEarly, CoroSplit, CoroElide and CoroCleanup.

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

llvm-svn: 340148

6 years ago[LLVM-C] Add coroutine passes
whitequark [Sun, 19 Aug 2018 23:39:57 +0000 (23:39 +0000)]
[LLVM-C] Add coroutine passes

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

llvm-svn: 340147

6 years ago[C-API][DIBuilder] Added DIFlags in LLVMDIBuilderCreateBasicType
whitequark [Sun, 19 Aug 2018 23:39:47 +0000 (23:39 +0000)]
[C-API][DIBuilder] Added DIFlags in LLVMDIBuilderCreateBasicType

Added DIFlags in LLVMDIBuilderCreateBasicType to add optional DWARF
attributes, such as DW_AT_endianity.

Patch by Chirag Patel.

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

llvm-svn: 340146

6 years ago[Lex] Fix some inconsistent parameter names and duplicate comments. NFC
Fangrui Song [Sun, 19 Aug 2018 22:23:42 +0000 (22:23 +0000)]
[Lex] Fix some inconsistent parameter names and duplicate comments. NFC

llvm-svn: 340145

6 years ago[InstCombine] Add test cases for an icmp combine that is missing support for splat...
Craig Topper [Sun, 19 Aug 2018 18:03:34 +0000 (18:03 +0000)]
[InstCombine] Add test cases for an icmp combine that is missing support for splat vector constants.

llvm-svn: 340144

6 years ago[SelectionDAG] Add basic demanded elements support to ComputeNumSignBits for BITCAST...
Simon Pilgrim [Sun, 19 Aug 2018 17:47:50 +0000 (17:47 +0000)]
[SelectionDAG] Add basic demanded elements support to ComputeNumSignBits for BITCAST nodes

Only adds support to the existing 'large element' scalar/vector to 'small element' vector bitcasts.

The next step would be to support cases where the large elements aren't all sign bits, and determine the small element equivalent based on the demanded elements.

llvm-svn: 340143

6 years ago[CodeGen] add test file that should have been included with r340141
Sanjay Patel [Sun, 19 Aug 2018 17:32:56 +0000 (17:32 +0000)]
[CodeGen] add test file that should have been included with r340141

llvm-svn: 340142

6 years ago[CodeGen] add rotate builtins that map to LLVM funnel shift
Sanjay Patel [Sun, 19 Aug 2018 16:50:30 +0000 (16:50 +0000)]
[CodeGen] add rotate builtins that map to LLVM funnel shift
This is a partial retry of rL340137 (reverted at rL340138 because of gcc host compiler crashing)
with 1 change:
Remove the changes to make microsoft builtins also use the LLVM intrinsics.

This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang
(when both halves of a funnel shift are the same value, it's a rotate).

We're free to name these as we want because we're not copying gcc, but if there's some other
existing art (eg, the microsoft ops) that we want to replicate, we can change the names.

The funnel shift intrinsics were added here:
https://reviews.llvm.org/D49242

With improved codegen in:
https://reviews.llvm.org/rL337966
https://reviews.llvm.org/rL339359

And basic IR optimization added in:
https://reviews.llvm.org/rL338218
https://reviews.llvm.org/rL340022

...so these are expected to produce asm output that's equal or better to the multi-instruction
alternatives using primitive C/IR ops.

In the motivating loop example from PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387#c7
...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source.

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

llvm-svn: 340141

6 years ago[NEON] Define fp16 vld and vst intrinsics conditionally
Ivan A. Kosarev [Sun, 19 Aug 2018 16:30:57 +0000 (16:30 +0000)]
[NEON] Define fp16 vld and vst intrinsics conditionally

This patch fixes definitions of vld and vst NEON intrinsics so
that we only define them if half-precision arithmetic is
supported on the target platform, as prescribed in ACLE 2.0.

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

llvm-svn: 340140

6 years ago[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle demanded...
Simon Pilgrim [Sun, 19 Aug 2018 16:01:47 +0000 (16:01 +0000)]
[X86][SSE] Add PACKSS test showing ComputeNumSignBits failure to handle demanded elts through a bitcast

llvm-svn: 340139

6 years agorevert r340137: [CodeGen] add rotate builtins
Sanjay Patel [Sun, 19 Aug 2018 15:31:42 +0000 (15:31 +0000)]
revert r340137: [CodeGen] add rotate builtins

At least a couple of bots (gcc host compiler on PPC only?) are showing the compiler dying while trying to compile.

llvm-svn: 340138

6 years ago[CodeGen] add/fix rotate builtins that map to LLVM funnel shift (retry)
Sanjay Patel [Sun, 19 Aug 2018 14:44:47 +0000 (14:44 +0000)]
[CodeGen] add/fix rotate builtins that map to LLVM funnel shift (retry)

This is a retry of rL340135 (reverted at rL340136 because of gcc host compiler crashing)
with 2 changes:
1. Move the code into a helper to reduce code duplication (and hopefully work-around the crash).
2. The original commit had a formatting bug in the docs (missing an underscore).

Original commit message:

This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang
(when both halves of a funnel shift are the same value, it's a rotate).

We're free to name these as we want because we're not copying gcc, but if there's some other
existing art (eg, the microsoft ops that are modified in this patch) that we want to replicate,
we can change the names.

The funnel shift intrinsics were added here:
https://reviews.llvm.org/D49242

With improved codegen in:
https://reviews.llvm.org/rL337966
https://reviews.llvm.org/rL339359

And basic IR optimization added in:
https://reviews.llvm.org/rL338218
https://reviews.llvm.org/rL340022

...so these are expected to produce asm output that's equal or better to the multi-instruction
alternatives using primitive C/IR ops.

In the motivating loop example from PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387#c7
...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source.

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

llvm-svn: 340137

6 years agorevert r340135: [CodeGen] add rotate builtins
Sanjay Patel [Sun, 19 Aug 2018 13:48:06 +0000 (13:48 +0000)]
revert r340135: [CodeGen] add rotate builtins

At least a couple of bots (PPC only?) are showing the compiler dying while trying to compile:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/11065/steps/build%20stage%201/logs/stdio
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/18267/steps/build%20stage%201/logs/stdio

llvm-svn: 340136

6 years ago[CodeGen] add rotate builtins
Sanjay Patel [Sun, 19 Aug 2018 13:12:40 +0000 (13:12 +0000)]
[CodeGen] add rotate builtins

This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang
(when both halves of a funnel shift are the same value, it's a rotate).

We're free to name these as we want because we're not copying gcc, but if there's some other
existing art (eg, the microsoft ops that are modified in this patch) that we want to replicate,
we can change the names.

The funnel shift intrinsics were added here:
D49242

With improved codegen in:
rL337966
rL339359

And basic IR optimization added in:
rL338218
rL340022

...so these are expected to produce asm output that's equal or better to the multi-instruction
alternatives using primitive C/IR ops.

In the motivating loop example from PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387#c7
...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source.

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

llvm-svn: 340135

6 years ago[X86] Fix an issue in the matching for ADDUS.
Craig Topper [Sun, 19 Aug 2018 04:26:31 +0000 (04:26 +0000)]
[X86] Fix an issue in the matching for ADDUS.

We were basically assuming only one operand of the compare could be an ADD node and using that to swap operands. But we can have a normal add followed by a saturing add.

This rewrites the canonicalization to just be based on the condition code.

llvm-svn: 340134

6 years ago[X86] Add a test case showing an issue in our addusw pattern matching.
Craig Topper [Sun, 19 Aug 2018 04:26:29 +0000 (04:26 +0000)]
[X86] Add a test case showing an issue in our addusw pattern matching.

We are unable to handle a normal add followed by a saturing add with certain operand orders on the icmp.

llvm-svn: 340133

6 years ago[msan] Remove XFAIL: freebsd from test/msan/tls_reuse.cc
Fangrui Song [Sat, 18 Aug 2018 23:25:55 +0000 (23:25 +0000)]
[msan] Remove XFAIL: freebsd from test/msan/tls_reuse.cc

This passes now.

llvm-svn: 340132

6 years agoUpdating MergeFunctions.rst
Aditya Kumar [Sat, 18 Aug 2018 20:17:19 +0000 (20:17 +0000)]
Updating MergeFunctions.rst

Improving readability, removing redundant contents.

Reviewers: hiraditya
Differential Revision: https://reviews.llvm.org/D50686

llvm-svn: 340131

6 years ago[X86] Use SDValue::operator== instead of DAG.isEqualTo in strictly integer matching.
Craig Topper [Sat, 18 Aug 2018 19:16:56 +0000 (19:16 +0000)]
[X86] Use SDValue::operator== instead of DAG.isEqualTo in strictly integer matching.

isEqualTo is more useful for floating point. operator== is sufficient for integer.

llvm-svn: 340130

6 years ago[X86] Simplify the PADDUS legality check in combineSelect to match PSUBUS. NFC
Craig Topper [Sat, 18 Aug 2018 18:51:04 +0000 (18:51 +0000)]
[X86] Simplify the PADDUS legality check in combineSelect to match PSUBUS. NFC

While there remove some trailing whitespace.

llvm-svn: 340129

6 years ago[X86] Add support for using 512-bit PSUBUS to combineSelect.
Craig Topper [Sat, 18 Aug 2018 18:51:03 +0000 (18:51 +0000)]
[X86] Add support for using 512-bit PSUBUS to combineSelect.

The code already support 128 and 256 and even knows to split 256 for AVX1. So we really just needed to stop looking for specific VTs and subtarget features and just look for legal VTs with i8/i16 elements.

While there, add some curly braces around outer if statement bodies that contain only another if. It makes all the closing curly braces look more regular.

llvm-svn: 340128

6 years ago[X86] Add test cases to show missed opportunities to use 512-bit PSUBUS.
Craig Topper [Sat, 18 Aug 2018 18:50:59 +0000 (18:50 +0000)]
[X86] Add test cases to show missed opportunities to use 512-bit PSUBUS.

llvm-svn: 340127

6 years ago[MS Demangler] Resolve backreferences eagerly, not lazily.
Zachary Turner [Sat, 18 Aug 2018 18:49:48 +0000 (18:49 +0000)]
[MS Demangler] Resolve backreferences eagerly, not lazily.

A while back I submitted a patch to resolve backreferences
lazily, thinking this that it was not always possible to know
in advance what type you were looking at until you had completed
a full pass over the input, and therefore it would be impossible
to resolve backreferences eagerly.

This was mistaken though, and turned out to be an unrelated
problem.  In fact, the reverse is true.  You *must* resolve
backreferences eagerly.  This is because certain types of nested
mangled symbols do not share a backreference context with their
parent symbol, and as such, if you try to resolve them lazily
their backreference context will have been lost by the time you
finish demangling the entire input.  On the other hand, resolving
them eagerly appears to always work, and enables us to port
many more tests over.

llvm-svn: 340126

6 years ago[RuntimeDyld] Fix a bug in RuntimeDyld::loadObjectImpl that was over-allocating
Lang Hames [Sat, 18 Aug 2018 18:38:37 +0000 (18:38 +0000)]
[RuntimeDyld] Fix a bug in RuntimeDyld::loadObjectImpl that was over-allocating
space for common symbols.

Patch by Dmitry Sidorov. Thanks Dmitry!

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

llvm-svn: 340125

6 years ago[X86] Replace all single match schedule class instregexs with instrs entries
Simon Pilgrim [Sat, 18 Aug 2018 18:04:29 +0000 (18:04 +0000)]
[X86] Replace all single match schedule class instregexs with instrs entries

Helps reduce cost of instrw collection

llvm-svn: 340124

6 years ago[X86] Merge shift/rotate schedule class instregexs
Simon Pilgrim [Sat, 18 Aug 2018 15:58:19 +0000 (15:58 +0000)]
[X86] Merge shift/rotate schedule class instregexs

Helps reduce cost of instrw collection

llvm-svn: 340123

6 years ago[DebugInfo] In FastISel, convert llvm.dbg.label to DBG_LABEL MI.
Hsiangkai Wang [Sat, 18 Aug 2018 14:55:34 +0000 (14:55 +0000)]
[DebugInfo] In FastISel, convert llvm.dbg.label to DBG_LABEL MI.

Convert llvm.dbg.label(!label_metadata) to DBG_LABEL !label_metadata.

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

llvm-svn: 340122

6 years ago[X86] Add a signed test case for PR38622. Use nounwind to reduce the output on the...
Craig Topper [Sat, 18 Aug 2018 06:00:16 +0000 (06:00 +0000)]
[X86] Add a signed test case for PR38622. Use nounwind to reduce the output on the unsigned test case.

llvm-svn: 340121

6 years ago[DAGCombiner] Allow divide by constant optimization on opaque constants.
Craig Topper [Sat, 18 Aug 2018 05:52:42 +0000 (05:52 +0000)]
[DAGCombiner] Allow divide by constant optimization on opaque constants.

Summary:
I believe this restores the behavior we had before r339147.

Fixes PR38622.

Reviewers: RKSimon, chandlerc, spatel

Reviewed By: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 340120

6 years agoRevert "Add a basic integration test for C++ smart pointers"
Bruno Cardoso Lopes [Sat, 18 Aug 2018 04:16:50 +0000 (04:16 +0000)]
Revert "Add a basic integration test for C++ smart pointers"

This reverts commit 73786631984289b3d601034b2bf4ba2b8f5845eb.

Revert r339961 since its causing debuginfo-tests to fail:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/48514/

rdar://problem/43449629

llvm-svn: 340119

6 years agoAdd the extended XMM registers mappings for AVX-512.
Zachary Turner [Sat, 18 Aug 2018 03:54:16 +0000 (03:54 +0000)]
Add the extended XMM registers mappings for AVX-512.

After this we should have the entire AVX-512 register set
mapping in place.

llvm-svn: 340118

6 years agoRevert "[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker"
Bruno Cardoso Lopes [Sat, 18 Aug 2018 03:22:11 +0000 (03:22 +0000)]
Revert "[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker"

This reverts commit a786521fa66c72edd308baff0c08961b6d964fb1.

Bots haven't caught up yet, but broke modules build with:

../tools/clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h:18:10:
fatal error: cyclic dependency in module 'Clang_StaticAnalyzer_Core':
Clang_StaticAnalyzer_Core -> Clang_Analysis ->
Clang_StaticAnalyzer_Checkers -> Clang_StaticAnalyzer_Core
         ^

llvm-svn: 340117

6 years ago[ORC] Fix some parameter names. NFC.
Lang Hames [Sat, 18 Aug 2018 02:48:02 +0000 (02:48 +0000)]
[ORC] Fix some parameter names. NFC.

llvm-svn: 340116

6 years ago[ORC] Rename 'finalize' to 'emit' to avoid potential confusion.
Lang Hames [Sat, 18 Aug 2018 02:06:18 +0000 (02:06 +0000)]
[ORC] Rename 'finalize' to 'emit' to avoid potential confusion.

An emitted symbol has had its contents written and its memory protections
applied, but it is not automatically ready to execute.

Prior to ORC supporting concurrent compilation, the term "finalized" could be
interpreted two different (but effectively equivalent) ways: (1) The finalized
symbol's contents have been written and its memory protections applied, and (2)
the symbol is ready to run. Now that ORC supports concurrent compilation, sense
(1) no longer implies sense (2). We have already introduced a new term, 'ready',
to capture sense (2), so rename sense (1) to 'emitted' to avoid any lingering
confusion.

llvm-svn: 340115

6 years ago[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker
George Karpenkov [Sat, 18 Aug 2018 01:45:50 +0000 (01:45 +0000)]
[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker

ARCMigrator is using code from RetainCountChecker, which is a layering
violation (and it also does it badly, by using a different header, and
then relying on implementation being present in a header file).

This change splits up RetainSummaryManager into a separate library in
lib/Analysis, which can be used independently of a checker.

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

llvm-svn: 340114

6 years agoMC: Remove dead code from WinCOFFObjectWriter.cpp. NFCI.
Peter Collingbourne [Sat, 18 Aug 2018 00:54:46 +0000 (00:54 +0000)]
MC: Remove dead code from WinCOFFObjectWriter.cpp. NFCI.

Remove code for writing auxiliary symbols of type function definition
and begin function. These types of symbols are associated with
pre-CodeView debug info and we never emit them.

llvm-svn: 340113

6 years agoSkip tests on Darwin for now. The build bots are not passing due to heavy load and...
Greg Clayton [Sat, 18 Aug 2018 00:33:15 +0000 (00:33 +0000)]
Skip tests on Darwin for now. The build bots are not passing due to heavy load and poor machines.

llvm-svn: 340112

6 years ago[GISel]: Add Legalization/lowering code for bit counting operations
Aditya Nandakumar [Sat, 18 Aug 2018 00:01:54 +0000 (00:01 +0000)]
[GISel]: Add Legalization/lowering code for bit counting operations

https://reviews.llvm.org/D48847#inline-448257

Ported legalization expansions for CTLZ/CTTZ from DAG to GISel.

Reviewed by rtereshin.

llvm-svn: 340111

6 years agoQuickfix for failing tests.
George Karpenkov [Fri, 17 Aug 2018 23:54:00 +0000 (23:54 +0000)]
Quickfix for failing tests.

llvm-svn: 340110

6 years ago[index] For an ObjC message call, also record as receivers the protocols if they...
Argyrios Kyrtzidis [Fri, 17 Aug 2018 23:50:59 +0000 (23:50 +0000)]
[index] For an ObjC message call, also record as receivers the protocols if they are present in the ObjC type

llvm-svn: 340109

6 years ago[AST] Clarify printing of unknown size locations [NFC]
Philip Reames [Fri, 17 Aug 2018 23:17:31 +0000 (23:17 +0000)]
[AST] Clarify printing of unknown size locations [NFC]

Printing "unknown" is much more clear than an arbitrary large integer

llvm-svn: 340108

6 years ago[llvm-objcopy] Implement -G/--keep-global-symbol(s).
Jordan Rupprecht [Fri, 17 Aug 2018 22:34:48 +0000 (22:34 +0000)]
[llvm-objcopy] Implement -G/--keep-global-symbol(s).

Summary:
Port GNU Objcopy -G/--keep-global-symbol(s).

This is slightly different than the already-implemented --globalize-symbol, which marks a symbol as global when copying. When --keep-global-symbol (alias -G) is used, *only* those symbols marked will stay global, and all other globals are demoted to local. (Also note that it doesn't *promote* a symbol to global). Additionally, there is a pluralized version of the flag --keep-global-symbols, which effectively applies --keep-global-symbol for every non-comment in a file.

Reviewers: jakehehrlich, jhenderson, alexshap

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 340105

6 years ago[DebugCounters] don't do redundant map lookups; NFC
George Burgess IV [Fri, 17 Aug 2018 22:34:04 +0000 (22:34 +0000)]
[DebugCounters] don't do redundant map lookups; NFC

llvm-svn: 340104

6 years ago[ObjC] Error out when using forward-declared protocol in a @protocol
Alex Lorenz [Fri, 17 Aug 2018 22:18:08 +0000 (22:18 +0000)]
[ObjC] Error out when using forward-declared protocol in a @protocol
expression

Clang emits invalid protocol metadata when a @protocol expression is used with a
forward-declared protocol. The protocol metadata is missing protocol conformance
list of the protocol since we don't have access to the definition of it in the
compiled translation unit. The linker then might end up picking the invalid
metadata when linking which will lead to incorrect runtime protocol conformance
checks.

This commit makes sure that Clang fails to compile code that uses a @protocol
expression with a forward-declared protocol. This ensures that Clang does not
emit invalid protocol metadata. I added an extra assert in CodeGen to ensure
that this kind of issue won't happen in other places.

rdar://32787811

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

llvm-svn: 340102

6 years agoDon't warn on returning the address of a label from a statement expression
Reid Kleckner [Fri, 17 Aug 2018 22:11:31 +0000 (22:11 +0000)]
Don't warn on returning the address of a label from a statement expression

Summary:
There isn't anything inherently wrong with returning a label from a
statement expression. In practice, the Linux kernel uses this pattern to
materialize PCs.

Fixes PR38569

Reviewers: niravd, rsmith, nickdesaulniers

Subscribers: cfe-commits

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

llvm-svn: 340101

6 years ago[AST][Tests] Clarify what each test is doing
Philip Reames [Fri, 17 Aug 2018 21:58:26 +0000 (21:58 +0000)]
[AST][Tests] Clarify what each test is doing

llvm-svn: 340100

6 years ago[AST[Tests] Shorten tests using noalias params
Philip Reames [Fri, 17 Aug 2018 21:45:57 +0000 (21:45 +0000)]
[AST[Tests] Shorten tests using noalias params

llvm-svn: 340099

6 years ago[analyzer] [NFC] Minor refactoring of ISL-specific code in RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:43:27 +0000 (21:43 +0000)]
[analyzer] [NFC] Minor refactoring of ISL-specific code in RetainCountChecker

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

llvm-svn: 340098

6 years ago[analyzer] Re-instate support for MakeCollectable is RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:42:59 +0000 (21:42 +0000)]
[analyzer] Re-instate support for MakeCollectable is RetainCountChecker

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

llvm-svn: 340097

6 years ago[analyzer] [NFC] Move ObjCRetainCount to include/Analysis
George Karpenkov [Fri, 17 Aug 2018 21:42:32 +0000 (21:42 +0000)]
[analyzer] [NFC] Move ObjCRetainCount to include/Analysis

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

llvm-svn: 340096

6 years ago[AST] Add tests for argmemonly calls [NFC]
Philip Reames [Fri, 17 Aug 2018 21:42:18 +0000 (21:42 +0000)]
[AST] Add tests for argmemonly calls [NFC]

First step towards building a test set to rebase D50730 on top of.  Starting with clone of memtransfer tests, more to come.

llvm-svn: 340095

6 years ago[analyzer] [NFC] Move canEval function from RetainCountChecker to RetainCountSummaries
George Karpenkov [Fri, 17 Aug 2018 21:42:05 +0000 (21:42 +0000)]
[analyzer] [NFC] Move canEval function from RetainCountChecker to RetainCountSummaries

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

llvm-svn: 340094

6 years ago[analyzer] [NFC] Split up summary generation in RetainCountChecker in two methods
George Karpenkov [Fri, 17 Aug 2018 21:41:37 +0000 (21:41 +0000)]
[analyzer] [NFC] Split up summary generation in RetainCountChecker in two methods

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

llvm-svn: 340093

6 years ago[analyzer] [NFC] Split up RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:41:07 +0000 (21:41 +0000)]
[analyzer] [NFC] Split up RetainCountChecker

At some point, staring at 4k+ LOC file becomes a bit hard.

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

llvm-svn: 340092

6 years ago[analyzer] Drop support for GC mode in RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:40:38 +0000 (21:40 +0000)]
[analyzer] Drop support for GC mode in RetainCountChecker

A lot of code in RetainCountChecker deals with GC mode.
Given that GC mode is deprecated, Apple does not ship runtime for it,
and modern compiler toolchain does not support it, it makes sense to
remove the code dealing with it in order to aid understanding of
RetainCountChecker.

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

llvm-svn: 340091

6 years agoValueTracking: Add tests for isKnownNeverNaN
Matt Arsenault [Fri, 17 Aug 2018 21:39:52 +0000 (21:39 +0000)]
ValueTracking: Add tests for isKnownNeverNaN

llvm-svn: 340090

6 years ago[MC] Improve error message when a codeview register is unknown
Reid Kleckner [Fri, 17 Aug 2018 21:35:14 +0000 (21:35 +0000)]
[MC] Improve error message when a codeview register is unknown

This is in MCRegisterInfo, we can print the actual register name easily.

llvm-svn: 340089

6 years ago[MS Demangler] Properly print all thunk types.
Zachary Turner [Fri, 17 Aug 2018 21:32:07 +0000 (21:32 +0000)]
[MS Demangler] Properly print all thunk types.

We were only printing the vtordisp thunk before as the previous
patch was more aimed at getting special operators working, one
of which was a thunk.  This patch gets all thunk types to print
properly, and adds a test for each one.

llvm-svn: 340088

6 years ago[X86] Remove detectAddSubSatPattern.
Craig Topper [Fri, 17 Aug 2018 21:19:28 +0000 (21:19 +0000)]
[X86] Remove detectAddSubSatPattern.

This was added very recently in r339650, but appears to be completely untested and has at least one bug in it.

llvm-svn: 340086

6 years agoDAG: Fix isKnownNeverNaN for basic non-sNaN cases
Matt Arsenault [Fri, 17 Aug 2018 21:19:22 +0000 (21:19 +0000)]
DAG: Fix isKnownNeverNaN for basic non-sNaN cases

fadd/fsub/fmul need to worry about infinities as well
as fdiv.

llvm-svn: 340085

6 years ago[ORC] Rename VSO to JITDylib.
Lang Hames [Fri, 17 Aug 2018 21:18:18 +0000 (21:18 +0000)]
[ORC] Rename VSO to JITDylib.

VSO was a little close to VDSO (an acronym on Linux for Virtual Dynamic Shared
Object) for comfort. It also risks giving the impression that instances of this
class could be shared between ExecutionSessions, which they can not.

JITDylib seems moderately less confusing, while still hinting at how this
class is intended to be used, i.e. as a JIT-compiled stand-in for a dynamic
library (code that would have been a dynamic library if you had wanted to
compile it ahead of time).

llvm-svn: 340084

6 years ago[MS Demangler] Demangle all remaining types of operators.
Zachary Turner [Fri, 17 Aug 2018 21:18:05 +0000 (21:18 +0000)]
[MS Demangler] Demangle all remaining types of operators.

This demangles all remaining special operators including thunks,
RTTI Descriptors, and local static guard variables.

llvm-svn: 340083

6 years agotest commit: add a comment
Mike Rice [Fri, 17 Aug 2018 21:16:21 +0000 (21:16 +0000)]
test commit: add a comment

llvm-svn: 340082

6 years ago[Hexagon] Remove unused functions from HexagonInstPrinter, NFC
Krzysztof Parzyszek [Fri, 17 Aug 2018 21:12:37 +0000 (21:12 +0000)]
[Hexagon] Remove unused functions from HexagonInstPrinter, NFC

llvm-svn: 340081

6 years agoUpdate comments in CGDebugInfo to reflect changes in the MS mangler, NFC
Reid Kleckner [Fri, 17 Aug 2018 20:59:52 +0000 (20:59 +0000)]
Update comments in CGDebugInfo to reflect changes in the MS mangler, NFC

I've tried to elaborate on the purpose of these type identifiers and why
and when clang uses them.

llvm-svn: 340080

6 years ago[MS] Mangle a hash of the main file path into anonymous namespaces
Reid Kleckner [Fri, 17 Aug 2018 20:59:27 +0000 (20:59 +0000)]
[MS] Mangle a hash of the main file path into anonymous namespaces

Summary:
This is needed to avoid conflicts in mangled names for codeview types in
anonymous namespaces. In CodeView, types refer to each other typically
through forward declarations, which contain mangled names. These names
have to be unique, otherwise the debugger will look up the mangled name
and find the wrong definition.

Furthermore, ThinLTO will deduplicate the types, and debug info
verification can fail when the types have the wrong sizes. This is
PR38608.

Fixes PR38609.

Reviewers: majnemer, inglorion, hans

Subscribers: mehdi_amini, aprantl, JDevlieghere, dexonsmith, cfe-commits

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

llvm-svn: 340079

6 years agoSkip the lldb-vscode attach with waitFor test for now, some build bots are having...
Greg Clayton [Fri, 17 Aug 2018 20:42:06 +0000 (20:42 +0000)]
Skip the lldb-vscode attach with waitFor test for now, some build bots are having trouble.

llvm-svn: 340077

6 years ago[clang-tidy] Add missing check documentation.
Haojian Wu [Fri, 17 Aug 2018 19:50:22 +0000 (19:50 +0000)]
[clang-tidy] Add missing check documentation.

llvm-svn: 340075

6 years agoImprove diagnostic for missing comma in template parameter list.
Richard Smith [Fri, 17 Aug 2018 19:43:40 +0000 (19:43 +0000)]
Improve diagnostic for missing comma in template parameter list.

Given 'typename T typename U', we would correctly diagnose the missing
comma, but incorrectly disambiguate the first parameter as being a
non-type parameter and complain that the 'T' is not a qualified-id.

See also gcc.gnu.org/PR86998.

llvm-svn: 340074

6 years ago[WebAssembly] Don't compress LEBs by default
Sam Clegg [Fri, 17 Aug 2018 19:42:46 +0000 (19:42 +0000)]
[WebAssembly] Don't compress LEBs by default

LEB compression breaks debug info so we don't want to enable
it by default, even at high optimization levels.

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

llvm-svn: 340073

6 years ago[AST] Adapt Polly to AnalysisSetTracker changes. NFC.
Michael Kruse [Fri, 17 Aug 2018 19:31:41 +0000 (19:31 +0000)]
[AST] Adapt Polly to AnalysisSetTracker changes. NFC.

The method AliasSetTracker::getAliasSetForPointer was removed and replaced by AliasSetTracker::getAliasSetFor for the restructuring in r339930.

Since Polly uses AliasSetTracker::getAliasSetForPointer, a temporary fix has been committed in r339937 with a comment:

     Can someone from polly please migrate usage and then delete the wrapper?

This commit is doing exactly that.

llvm-svn: 340072

6 years agoFix windows buildbots by removing : from filenames
Jordan Rupprecht [Fri, 17 Aug 2018 19:18:20 +0000 (19:18 +0000)]
Fix windows buildbots by removing : from filenames

llvm-svn: 340071

6 years ago[llvm-objcopy] Add support for -I binary -B <arch>.
Jordan Rupprecht [Fri, 17 Aug 2018 18:51:11 +0000 (18:51 +0000)]
[llvm-objcopy] Add support for -I binary -B <arch>.

Summary:
The -I (--input-target) and -B (--binary-architecture) flags exist but are currently silently ignored. This adds support for -I binary for architectures i386, x86-64 (and alias i386:x86-64), arm, aarch64, sparc, and ppc (powerpc:common64). This is largely based on D41687.

This is done by implementing an additional subclass of Reader, BinaryReader, which works by interpreting the input file as contents for .data field, sets up a synthetic header, and adds additional sections/symbols (e.g. _binary__tmp_data_txt_start).

Reviewers: jakehehrlich, alexshap, jhenderson, javed.absar

Reviewed By: jhenderson

Subscribers: jyknight, nemanjai, kbarton, fedor.sergeev, jrtc27, kristof.beyls, paulsemel, llvm-commits

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

llvm-svn: 340070

6 years agoTest commit
Jun Lim [Fri, 17 Aug 2018 18:40:41 +0000 (18:40 +0000)]
Test commit

I just removed a blank space.

llvm-svn: 340069

6 years agoRemove a hardcoded address in test/DebugInfo/X86/vla-multi.ll
Vedant Kumar [Fri, 17 Aug 2018 18:39:19 +0000 (18:39 +0000)]
Remove a hardcoded address in test/DebugInfo/X86/vla-multi.ll

This relaxes a test to make it less brittle.

llvm-svn: 340068

6 years ago[IDF] Make GD const.
Alina Sbirlea [Fri, 17 Aug 2018 18:37:15 +0000 (18:37 +0000)]
[IDF] Make GD const.

llvm-svn: 340067

6 years ago[llvm-mca] Reformat a few lines (fix spacing). NFC.
Matt Davis [Fri, 17 Aug 2018 18:06:01 +0000 (18:06 +0000)]
[llvm-mca] Reformat a few lines (fix spacing).  NFC.

llvm-svn: 340065

6 years ago[Support] NFC: Fix docstring in FileSystem.h.
Reka Kovacs [Fri, 17 Aug 2018 18:05:38 +0000 (18:05 +0000)]
[Support] NFC: Fix docstring in FileSystem.h.

llvm-svn: 340063

6 years ago[X86][SSE] Lower constant vXi8 ISD::SRL/ISD::SRA using PMULLW
Simon Pilgrim [Fri, 17 Aug 2018 18:03:11 +0000 (18:03 +0000)]
[X86][SSE] Lower constant vXi8 ISD::SRL/ISD::SRA using PMULLW

Extending the concept introduced in D49562, this patch lowers constant vXi8 ISD::SRL/ISD::SRA by zero/sign extending to vXi16 and using PMULLW and then truncating the high 8 bits of the result.

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

llvm-svn: 340062

6 years ago[InstCombine] Refactor the simplification of pow() (NFC)
Evandro Menezes [Fri, 17 Aug 2018 17:59:53 +0000 (17:59 +0000)]
[InstCombine] Refactor the simplification of pow() (NFC)

Refactor all cases dealing with `exp{,2,10}()` into one function in
preparation for D49273.  Otherwise, NFC.

llvm-svn: 340061

6 years ago[NFC] Expand test cases for simplifying pow()
Evandro Menezes [Fri, 17 Aug 2018 17:59:38 +0000 (17:59 +0000)]
[NFC] Expand test cases for simplifying pow()

In prepatration for the improvements that D49273 enables.

llvm-svn: 340060