platform/upstream/llvm.git
6 years agoHandle --plugin-opt= options as alias options.
Rui Ueyama [Tue, 22 May 2018 02:53:11 +0000 (02:53 +0000)]
Handle --plugin-opt= options as alias options.

Previously, we had a loop to iterate over options starting with
`--plugin-opt=` and parse them by hand. But we can make OptTable
do that job for us.

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

llvm-svn: 332935

6 years agoMissed the tests for the deduction guides for prority_queue
Marshall Clow [Tue, 22 May 2018 02:19:38 +0000 (02:19 +0000)]
Missed the tests for the deduction guides for prority_queue

llvm-svn: 332931

6 years agoAMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers
Tom Stellard [Tue, 22 May 2018 02:03:23 +0000 (02:03 +0000)]
AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers

Summary:
MCTargetDesc/AMDGPUMCTargetDesc.h contains enums for all the instuction
and register defintions, which are huge so we only want to include
them where needed.

This will also make it easier if we want to split the R600 and GCN
definitions into separate tablegenerated files.

I was unable to remove AMDGPUMCTargetDesc.h from SIMachineFunctionInfo.h
because it uses some enums from the header to initialize default values
for the SIMachineFunction class, so I ended up having to remove includes of
SIMachineFunctionInfo.h from headers too.

Reviewers: arsenm, nhaehnle

Reviewed By: nhaehnle

Subscribers: MatzeB, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits

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

llvm-svn: 332930

6 years ago[X86] Prevent inclusion of __wmmintrin_aes.h and __wmmintrin_pclmul.h without includi...
Craig Topper [Tue, 22 May 2018 02:02:13 +0000 (02:02 +0000)]
[X86] Prevent inclusion of __wmmintrin_aes.h and __wmmintrin_pclmul.h without including wmmintrin.h

llvm-svn: 332929

6 years agoDeduction guides for the container adaptors - queue, stack, and priority_queue
Marshall Clow [Tue, 22 May 2018 01:57:53 +0000 (01:57 +0000)]
Deduction guides for the container adaptors - queue, stack, and priority_queue

llvm-svn: 332927

6 years agoMC: Remove dead code. NFCI.
Peter Collingbourne [Tue, 22 May 2018 01:20:46 +0000 (01:20 +0000)]
MC: Remove dead code. NFCI.

This code appears to have been copied from the mach-o streamer. It has
no effect in ELF because indirect symbols are specific to mach-o.

llvm-svn: 332926

6 years agoRevert "[llvm-objcopy] Add --strip-unneeded option"
Paul Semel [Tue, 22 May 2018 01:04:36 +0000 (01:04 +0000)]
Revert "[llvm-objcopy] Add --strip-unneeded option"

There is a use after free I didn't see. Need to investigate.

This reverts commit f7624abeb1f0d012309baf2e78cf2499fbfe5e5f.

llvm-svn: 332925

6 years ago[CMake] Use a different source depending on C++ support
Petr Hosek [Tue, 22 May 2018 01:01:56 +0000 (01:01 +0000)]
[CMake] Use a different source depending on C++ support

When using system C++ library, assume we have a working C++ compiler and
try to compile a complete C++ program. When using in tree C++ library,
only check the C compiler since the C++ library likely won't have been
built yet at time of running the check.

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

llvm-svn: 332924

6 years ago[CMake] Pass Clang defaults to runtimes builds
Petr Hosek [Tue, 22 May 2018 00:43:04 +0000 (00:43 +0000)]
[CMake] Pass Clang defaults to runtimes builds

This enables the use of Clang default options from runtimes CMake files.

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

llvm-svn: 332923

6 years agoWork around some odd instruction single-step behavior on macOS.
Jim Ingham [Tue, 22 May 2018 00:06:55 +0000 (00:06 +0000)]
Work around some odd instruction single-step behavior on macOS.

We've seen some cases on macOS where you go to instruction single
step (over a breakpoint), and single step returns but the instruction
hasn't been executed (and the pc hasn't moved.)  The ThreadPlanStepOverBreakpoint
used to handle this case by accident, but the patches to handle two adjacent
breakpoints broke that accident.

This patch fixes the logic of ExplainsStop to explicitly handle the case where
the pc didn't move.  It also adds a WillPop that re-enables the breakpoint we
were stepping over.  We never want an unexpected path through the plan to
fool us into not doing that.

I have no idea how to make this bug happen.  It is very inconsistent when it
occurs IRL.  We really need a full MockProcess Plugin before we can start to write
tests for this sort of system hiccup.

<rdar://problem/38505726>

llvm-svn: 332922

6 years ago[DAG] fold FP binops with undef operands to NaN
Sanjay Patel [Mon, 21 May 2018 23:54:19 +0000 (23:54 +0000)]
[DAG] fold FP binops with undef operands to NaN

This is the FP sibling of D43141 with the corresponding IR change in rL327212.

We can't propagate undef here because if a variable operand is a NaN, these
binops must propagate NaN. Neither global nor node-level fast-math makes a
difference. If we have 'nnan', I think later folds can turn the NaN into undef.

The tests in X86/fp-undef.ll are meant to be the definitive verification for
these folds - everything reduces identically now.

The other test changes are collateral damage. They may need to be altered to
preserve their intent.

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

llvm-svn: 332920

6 years ago[ORC] Make some more operations on VSO private. These should be done via a
Lang Hames [Mon, 21 May 2018 23:46:29 +0000 (23:46 +0000)]
[ORC] Make some more operations on VSO private. These should be done via a
MaterializationResponsibility instance.

llvm-svn: 332919

6 years ago[LKH] Add a replacement RTDyldLayer.
Lang Hames [Mon, 21 May 2018 23:45:40 +0000 (23:45 +0000)]
[LKH] Add a replacement RTDyldLayer.

llvm-svn: 332918

6 years agoReapply r332907 "[GlobalISel] Improving InstructionSelect's performance by reducing...
Roman Tereshin [Mon, 21 May 2018 23:28:51 +0000 (23:28 +0000)]
Reapply r332907 "[GlobalISel] Improving InstructionSelect's performance by reducing MatchTable..."

Apparently the compile time problem was caused by the fact that not
all compilers / STL implementations can automatically convert
std::unique_ptr<Derived> to std::unique_ptr<Base>. Fixed (hopefully)
by making sure it's std::unique_ptr<Derived>&& (rvalue ref) to
std::unique_ptr<Base> conversion instead.

llvm-svn: 332917

6 years ago[X86] Remove 128/256-bit cvtdq2ps, cvtudq2ps, cvtqq2pd, cvtuqq2pd intrinsics.
Craig Topper [Mon, 21 May 2018 23:15:00 +0000 (23:15 +0000)]
[X86] Remove 128/256-bit cvtdq2ps, cvtudq2ps, cvtqq2pd, cvtuqq2pd intrinsics.

These can all be implemented with sitofp/uitofp instructions.

llvm-svn: 332916

6 years ago[llvm-objcopy] Add --strip-unneeded option
Paul Semel [Mon, 21 May 2018 22:50:32 +0000 (22:50 +0000)]
[llvm-objcopy] Add --strip-unneeded option

This option removes symbols that are not needed by relocations.

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

llvm-svn: 332915

6 years agoFix the Xcode project for the refactoring of the
Jim Ingham [Mon, 21 May 2018 22:41:28 +0000 (22:41 +0000)]
Fix the Xcode project for the refactoring of the
DWARF reader.

llvm-svn: 332914

6 years agoAdd missing include for cstdint to Visibility.h
Raphael Isemann [Mon, 21 May 2018 22:27:22 +0000 (22:27 +0000)]
Add missing include for cstdint to Visibility.h

Summary: We use uint8_t in this header, so we need to include cstdint.

Subscribers: cfe-commits

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

llvm-svn: 332913

6 years agoRevert r332907 "[GlobalISel] Improving InstructionSelect's performance by reducing...
Roman Tereshin [Mon, 21 May 2018 22:21:24 +0000 (22:21 +0000)]
Revert r332907 "[GlobalISel] Improving InstructionSelect's performance by reducing MatchTable..."

There is a compile time error I didn't see locally, investigating now.

llvm-svn: 332912

6 years agoAdd missing x86-registered-target.
Peter Collingbourne [Mon, 21 May 2018 22:14:02 +0000 (22:14 +0000)]
Add missing x86-registered-target.

llvm-svn: 332911

6 years agoFix warning from r332654 with LLVM_ATTRIBUTE_USED
Diego Caballero [Mon, 21 May 2018 22:12:38 +0000 (22:12 +0000)]
Fix warning from r332654 with LLVM_ATTRIBUTE_USED

r332654 tried to fix an unused function warning with
a void cast. This approach worked for clang and gcc
but not for MSVC. This commit replaces the void cast
with the LLVM_ATTRIBUTE_USED approach.

llvm-svn: 332910

6 years ago[X86] Remove a builtin that should have been removed in r332882.
Craig Topper [Mon, 21 May 2018 22:10:02 +0000 (22:10 +0000)]
[X86] Remove a builtin that should have been removed in r332882.

llvm-svn: 332909

6 years agoUnbreak kaleidoscope example.
Peter Collingbourne [Mon, 21 May 2018 22:09:45 +0000 (22:09 +0000)]
Unbreak kaleidoscope example.

llvm-svn: 332908

6 years ago[GlobalISel] Improving InstructionSelect's performance by reducing MatchTable, mostly...
Roman Tereshin [Mon, 21 May 2018 22:04:39 +0000 (22:04 +0000)]
[GlobalISel] Improving InstructionSelect's performance by reducing MatchTable, mostly NFC, perf patch 1

This patch starts a series of patches that decrease time spent by
GlobalISel in its InstructionSelect pass by roughly 60% for -O0 builds
for large inputs as measured on sqlite3-amalgamation
(http://sqlite.org/download.html) targeting AArch64.

The performance improvements are achieved solely by reducing the
number of matching GIM_* opcodes executed by the MatchTable's
interpreter during the selection by approx. a factor of 30, which also
brings contribution of this particular part of the selection process
to the overall runtime of InstructionSelect pass down from approx.
60-70% to 5-7%, thus making further improvements in this particular
direction not very profitable.

The improvements described above are expected for any target that
doesn't have many complex patterns. The targets that do should
strictly benefit from the changes, but by how much exactly is hard to
estimate beforehand. It's also likely that such target WILL benefit
from further improvements to MatchTable, most likely the ones that
bring it closer to a perfect decision tree.

This commit specifically is rather large mostly NFC commit that does
necessary preparation work and refactoring, there will be a following
series of small patches introducing a specific optimization each
shortly after.

This commit specifically is expected to cause a small compile time
regression (around 2.5% of InstructionSelect pass time), which should
be fixed by the next commit of the series.

Every commit planned shares the same Phabricator Review.

Reviewers: qcolombet, dsanders, bogner, aemerson, javed.absar

Reviewed By: qcolombet

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 332907

6 years agoFix another make_unique ambiguity.
Peter Collingbourne [Mon, 21 May 2018 21:48:17 +0000 (21:48 +0000)]
Fix another make_unique ambiguity.

llvm-svn: 332906

6 years ago[DAGCombiner] isAllOnesConstantOrAllOnesSplatConstant(): look through bitcasts
Roman Lebedev [Mon, 21 May 2018 21:41:10 +0000 (21:41 +0000)]
[DAGCombiner] isAllOnesConstantOrAllOnesSplatConstant(): look through bitcasts

Summary:
As pointed out in D46528, we errneously transform cases like `xor X, -1`,
even though we use said function.
It's because the `-1` is actually a bitcast there.
So i think we can just look through it in the function.

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

llvm-svn: 332905

6 years ago[DAGCombine][X86][AArch64] Masked merge unfolding: vector edition.
Roman Lebedev [Mon, 21 May 2018 21:41:02 +0000 (21:41 +0000)]
[DAGCombine][X86][AArch64] Masked merge unfolding: vector edition.

Summary:
This **appears** to be the last missing piece for the masked merge pattern handling in the backend.

This is [[ https://bugs.llvm.org/show_bug.cgi?id=37104 | PR37104 ]].

[[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]] will introduce an IR canonicalization that is likely bad for the end assembly.
Previously, `andps`+`andnps` / `bsl` would be generated. (see `@out`)
Now, they would no longer be generated  (see `@in`), and we need to make sure that they are generated.

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

llvm-svn: 332904

6 years ago[X86][AArch64][NFC] Add tests for vector masked merge unfolding
Roman Lebedev [Mon, 21 May 2018 21:40:51 +0000 (21:40 +0000)]
[X86][AArch64][NFC] Add tests for vector masked merge unfolding

Summary:
This is [[ https://bugs.llvm.org/show_bug.cgi?id=37104 | PR37104 ]].

[[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]] will introduce an IR canonicalization that is likely bad for the end assembly.
Previously, `andps`+`andnps` / `bsl` would be generated. (see `@out`)
Now, they would no longer be generated  (see `@in`).

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

llvm-svn: 332903

6 years agoImplement deduction guides for vector
Marshall Clow [Mon, 21 May 2018 21:30:12 +0000 (21:30 +0000)]
Implement deduction guides for vector

llvm-svn: 332901

6 years ago[ORC] Preserve Materializing symbol flag during resolution.
Lang Hames [Mon, 21 May 2018 21:11:22 +0000 (21:11 +0000)]
[ORC] Preserve Materializing symbol flag during resolution.

llvm-svn: 332899

6 years ago[ORC] Lookup now returns an error if any symbols are not found.
Lang Hames [Mon, 21 May 2018 21:11:21 +0000 (21:11 +0000)]
[ORC] Lookup now returns an error if any symbols are not found.

Also tightens the behavior of ExecutionSession::failQuery. Queries can usually
only be failed by marking a symbol as failed-to-materialize, but
ExecutionSession::failQuery provides a second route, and both routes may be
executed from different threads. In the case that a query has already been
failed due to a materialization error, ExecutionSession::failQuery will
direct the error to ExecutionSession::reportError instead.

llvm-svn: 332898

6 years ago[ORC] Remove the optional MaterializationResponsibility argument from lookup.
Lang Hames [Mon, 21 May 2018 21:11:21 +0000 (21:11 +0000)]
[ORC] Remove the optional MaterializationResponsibility argument from lookup.

The lookup function provides blocking symbol resolution for JIT clients (not
layers themselves) so it does not need to track symbol dependencies via a
MaterializationResponsibility.

llvm-svn: 332897

6 years ago[ORC] Add IRLayer and ObjectLayer interfaces and related MaterializationUnits.
Lang Hames [Mon, 21 May 2018 21:11:13 +0000 (21:11 +0000)]
[ORC] Add IRLayer and ObjectLayer interfaces and related MaterializationUnits.

llvm-svn: 332896

6 years ago[DAGCombiner] Use computeKnownBits to match rotate patterns that have had their amoun...
Craig Topper [Mon, 21 May 2018 21:09:18 +0000 (21:09 +0000)]
[DAGCombiner] Use computeKnownBits to match rotate patterns that have had their amount masking modified by simplifyDemandedBits

SimplifyDemandedBits can remove bits from the masks for the shift amounts we need to see to detect rotates.

This patch uses zeroes from computeKnownBits to fill in some of these mask bits to make the match work.

As currently written this calls computeKnownBits even when the mask hasn't been simplified because it made the code simpler. If we're worried about compile time performance we can improve this.

I know we're talking about making a rotate intrinsic, but hopefully we can go ahead and do this change and just make sure the rotate intrinsic also handles it.

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

llvm-svn: 332895

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Mon, 21 May 2018 21:09:14 +0000 (21:09 +0000)]
[InstCombine] regenerate checks; NFC

llvm-svn: 332894

6 years ago[X86] Simplify some X86 address mode folding code, NFCI
Reid Kleckner [Mon, 21 May 2018 21:03:19 +0000 (21:03 +0000)]
[X86] Simplify some X86 address mode folding code, NFCI

This code should really do exactly the same thing for 32-bit x86 and
64-bit small code models, with the exception that RIP-relative
addressing can't use base and index registers.

llvm-svn: 332893

6 years ago[X86] Remove some unneeded check lines that I copy and pasted when I made vector...
Craig Topper [Mon, 21 May 2018 21:01:13 +0000 (21:01 +0000)]
[X86] Remove some unneeded check lines that I copy and pasted when I made vector tests from some scalar test cases.

llvm-svn: 332892

6 years ago[X86] Remove masking from pternlog llvm intrinsics and use a select instruction instead.
Craig Topper [Mon, 21 May 2018 20:58:23 +0000 (20:58 +0000)]
[X86] Remove masking from pternlog llvm intrinsics and use a select instruction instead.

Because the intrinsics in the headers are implemented as macros, we can't just use a select builtin and pternlog builtin. This would require one of the macro arguments to be used twice. Depending on what was passed to the macro we could expand an expression twice leading to weird behavior. We could maybe declare our local variable in the macro, but that would need to worry about name collisions.

To avoid that just generate IR directly in CGBuiltin.cpp.

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

llvm-svn: 332891

6 years ago[X86] Remove masking from vpternlog intrinsics. Use a select in IR instead.
Craig Topper [Mon, 21 May 2018 20:58:09 +0000 (20:58 +0000)]
[X86] Remove masking from vpternlog intrinsics. Use a select in IR instead.

This removes 6 intrinsics since we no longer need separate mask and maskz intrinsics.

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

llvm-svn: 332890

6 years agoFix a make_unique ambiguity.
Peter Collingbourne [Mon, 21 May 2018 20:56:28 +0000 (20:56 +0000)]
Fix a make_unique ambiguity.

llvm-svn: 332889

6 years ago[asan] Make GetCurrentThread RTEMS-friendly
Walter Lee [Mon, 21 May 2018 20:43:36 +0000 (20:43 +0000)]
[asan] Make GetCurrentThread RTEMS-friendly

On RTEMS, system and user code all live in a single binary and address
space. There is no clean separation, and instrumented code may
execute before the ASan run-time is initialized (or after it has been
destroyed).

Currently, GetCurrentThread() may crash if it's called before ASan
run-time is initialized. Make it return nullptr instead.

Similarly, fix __asan_handle_no_return so that it gives up rather than
try something that may crash.

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

llvm-svn: 332888

6 years ago[InstCombine] remove fptrunc (select) code; NFCI
Sanjay Patel [Mon, 21 May 2018 20:39:35 +0000 (20:39 +0000)]
[InstCombine] remove fptrunc (select) code; NFCI

This pattern is handled within commonCastTransforms(),
so the code here is dead AFAICT.

llvm-svn: 332887

6 years agoRevert r332847; it caused us to miscompile certain forms of reference initialization.
Richard Smith [Mon, 21 May 2018 20:36:58 +0000 (20:36 +0000)]
Revert r332847; it caused us to miscompile certain forms of reference initialization.

llvm-svn: 332886

6 years agoCodeGen, Driver: Start using direct split dwarf emission in clang.
Peter Collingbourne [Mon, 21 May 2018 20:31:59 +0000 (20:31 +0000)]
CodeGen, Driver: Start using direct split dwarf emission in clang.

Fixes PR37466.

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

llvm-svn: 332885

6 years agoLTO: Replace split dwarf implementation that uses objcopy with one that uses direct...
Peter Collingbourne [Mon, 21 May 2018 20:26:49 +0000 (20:26 +0000)]
LTO: Replace split dwarf implementation that uses objcopy with one that uses direct emission.

Part of PR37466.

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

llvm-svn: 332884

6 years ago[InstCombine] add tests for cast-of-select; NFC
Sanjay Patel [Mon, 21 May 2018 20:23:58 +0000 (20:23 +0000)]
[InstCombine] add tests for cast-of-select; NFC

In all cases, we're pulling the cast above the select.
That's not a good canonicalization if we're creating
a select that then mismatches the operand size of its
condition.

llvm-svn: 332883

6 years ago[X86] Use __builtin_convertvector to implement some of the packed integer to packed...
Craig Topper [Mon, 21 May 2018 20:19:17 +0000 (20:19 +0000)]
[X86] Use __builtin_convertvector to implement some of the packed integer to packed float conversion intrinsics.

I believe this is safe assuming default default FP environment. The conversion might be inexact, but it can never overflow the FP type so this shouldn't be undefined behavior for the uitofp/sitofp instructions.

We already do something similar for scalar conversions.

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

llvm-svn: 332882

6 years agoCodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to...
Peter Collingbourne [Mon, 21 May 2018 20:16:41 +0000 (20:16 +0000)]
CodeGen: Add a dwo output file argument to addPassesToEmitFile and hook it up to dwo output.

Part of PR37466.

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

llvm-svn: 332881

6 years agoRemove CMake workaround for LLD PR24476 which is no longer needed
Reid Kleckner [Mon, 21 May 2018 20:14:46 +0000 (20:14 +0000)]
Remove CMake workaround for LLD PR24476 which is no longer needed

llvm-svn: 332880

6 years agoRevert r332028; see PR37545 for details.
Richard Smith [Mon, 21 May 2018 20:10:54 +0000 (20:10 +0000)]
Revert r332028; see PR37545 for details.

llvm-svn: 332879

6 years ago[DebugInfo] Fix typo "DWARG" in test comment (NFC)
Brian Gesiak [Mon, 21 May 2018 19:48:27 +0000 (19:48 +0000)]
[DebugInfo] Fix typo "DWARG" in test comment (NFC)

Summary:
The correct spelling is "DWARF", the debugging format, not "DWARG".
The typo is in a (not executed by lit) comment in a test file, so
fixing it does not result in any functional change.

Test Plan: check-llvm, just in case

llvm-svn: 332878

6 years agoEnable Python API for OpenBSD.
Zachary Turner [Mon, 21 May 2018 19:47:45 +0000 (19:47 +0000)]
Enable Python API for OpenBSD.

Patch by David Carlier

llvm-svn: 332877

6 years ago[libFuzzer] reinstate -dump_coverage, which is still in use (reverts r332036)
Kostya Serebryany [Mon, 21 May 2018 19:47:00 +0000 (19:47 +0000)]
[libFuzzer] reinstate -dump_coverage, which is still in use (reverts r332036)

llvm-svn: 332876

6 years agoMC: Introduce an ELF dwo object writer and teach llvm-mc about it.
Peter Collingbourne [Mon, 21 May 2018 19:44:54 +0000 (19:44 +0000)]
MC: Introduce an ELF dwo object writer and teach llvm-mc about it.

Part of PR37466.

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

llvm-svn: 332875

6 years agoAMDGPU: Update GCCBuiltin names for DS FP atomic intrinsics
Matt Arsenault [Mon, 21 May 2018 19:43:02 +0000 (19:43 +0000)]
AMDGPU: Update GCCBuiltin names for DS FP atomic intrinsics

llvm-svn: 332874

6 years ago[DebugInfo] Use absolute addresses in location lists
Jonas Devlieghere [Mon, 21 May 2018 19:36:54 +0000 (19:36 +0000)]
[DebugInfo] Use absolute addresses in location lists

Rather than relying on the user to do the address calculating in
DW_AT_location we should just dump the absolute address.

rdar://problem/38513870

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

llvm-svn: 332873

6 years ago[X86] Add test cases for D47012.
Craig Topper [Mon, 21 May 2018 19:33:42 +0000 (19:33 +0000)]
[X86] Add test cases for D47012.

Patch by Thomasz Krupa.

llvm-svn: 332872

6 years agoRevert "[CMake] Reland "Make simple source used for CMake checks a C file""
Petr Hosek [Mon, 21 May 2018 19:32:43 +0000 (19:32 +0000)]
Revert "[CMake] Reland "Make simple source used for CMake checks a C file""

This reverts commit rCRT332679 which doesn't quite work and will be
replaced by D47100 and D47115 which is a cleaner solution.

llvm-svn: 332871

6 years agoMC: Extract a derived class from ELFObjectWriter. NFCI.
Peter Collingbourne [Mon, 21 May 2018 19:30:59 +0000 (19:30 +0000)]
MC: Extract a derived class from ELFObjectWriter. NFCI.

This class will be used to create regular, non-split ELF files.

Part of PR37466.

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

llvm-svn: 332870

6 years ago[X86] Add test cases for missed vector rotate matching due to SimplifyDemandedBits...
Craig Topper [Mon, 21 May 2018 19:27:50 +0000 (19:27 +0000)]
[X86] Add test cases for missed vector rotate matching due to SimplifyDemandedBits interfering with the AND masks

As requested in D47116

llvm-svn: 332869

6 years agoMC: Separate creating a generic object writer from creating a target object writer...
Peter Collingbourne [Mon, 21 May 2018 19:20:29 +0000 (19:20 +0000)]
MC: Separate creating a generic object writer from creating a target object writer. NFCI.

With this we gain a little flexibility in how the generic object
writer is created.

Part of PR37466.

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

llvm-svn: 332868

6 years agoMC: Extract ELFObjectWriter's ELF writing functionality into an ELFWriter class....
Peter Collingbourne [Mon, 21 May 2018 19:18:28 +0000 (19:18 +0000)]
MC: Extract ELFObjectWriter's ELF writing functionality into an ELFWriter class. NFCI.

The idea is that we will be able to use this class to create multiple
files.

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

llvm-svn: 332867

6 years agoFix ubsan bounds check failure.
Peter Collingbourne [Mon, 21 May 2018 19:09:47 +0000 (19:09 +0000)]
Fix ubsan bounds check failure.

llvm-svn: 332866

6 years ago[EarlyCSE] Improve EarlyCSE of some absolute value cases.
Craig Topper [Mon, 21 May 2018 18:42:42 +0000 (18:42 +0000)]
[EarlyCSE] Improve EarlyCSE of some absolute value cases.

Change matchSelectPattern to return X and -X for ABS/NABS in a well defined order. Adjust EarlyCSE to account for this. Ensure the SPF result is some kind of min/max and not abs/nabs in one place in InstCombine that made me nervous.

Prevously we returned the two operands of the compare part of the abs pattern. The RHS is always going to be a 0i, 1 or -1 constant. This isn't a very meaningful thing to return for any one. There's also some freedom in the abs pattern as to what happens when the value is equal to 0. This freedom led to early cse failing to match when different constants were used in otherwise equivalent operations. By returning the input and its negation in a defined order we can ensure an exact match. This also makes sure both patterns use the exact same subtract instruction for the negation. I believe CSE should evebntually make this happen and properly merge the nsw/nuw flags. But I'm not familiar with CSE and what order it does things in so it seemed like it might be good to really enforce that they were the same.

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

llvm-svn: 332865

6 years agoMC: Remove stream and output functions from MCObjectWriter. NFCI.
Peter Collingbourne [Mon, 21 May 2018 18:28:57 +0000 (18:28 +0000)]
MC: Remove stream and output functions from MCObjectWriter. NFCI.

Part of PR37466.

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

llvm-svn: 332864

6 years agoMC: Have the object writers return the number of bytes written. NFCI.
Peter Collingbourne [Mon, 21 May 2018 18:23:50 +0000 (18:23 +0000)]
MC: Have the object writers return the number of bytes written. NFCI.

This removes the last external use of the stream.

Part of PR37466.

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

llvm-svn: 332863

6 years ago[AMDGPU] Add divergence analysis as a dependency for ISel
Stanislav Mekhanoshin [Mon, 21 May 2018 18:18:52 +0000 (18:18 +0000)]
[AMDGPU] Add divergence analysis as a dependency for ISel

AMDGPUDAGToDAGISel adds DivergenceAnalysis in getAnalysisUsage
but does not list it in pass dependencies which may lead to
crash.

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

llvm-svn: 332862

6 years agoMC: Change object writers to use endian::Writer. NFCI.
Peter Collingbourne [Mon, 21 May 2018 18:17:42 +0000 (18:17 +0000)]
MC: Change object writers to use endian::Writer. NFCI.

Part of PR37466.

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

llvm-svn: 332861

6 years ago[VPlan] Reland r332654 and silence unused func warning
Diego Caballero [Mon, 21 May 2018 18:14:23 +0000 (18:14 +0000)]
[VPlan] Reland r332654 and silence unused func warning

r332654 was reverted due to an unused function warning in
release build. This commit includes the same code with the
warning silenced.

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

llvm-svn: 332860

6 years agoFix typo.
Rui Ueyama [Mon, 21 May 2018 18:12:46 +0000 (18:12 +0000)]
Fix typo.

llvm-svn: 332859

6 years agoMC: Change MCAssembler::writeSectionData and writeFragmentPadding to take a raw_ostre...
Peter Collingbourne [Mon, 21 May 2018 18:11:35 +0000 (18:11 +0000)]
MC: Change MCAssembler::writeSectionData and writeFragmentPadding to take a raw_ostream. NFCI.

Also clean up a couple of hacks where we were writing the section
contents to another stream by setting the object writer's stream,
writing and setting it back.

Part of PR37466.

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

llvm-svn: 332858

6 years agoMC: Change MCAsmBackend::writeNopData() to take a raw_ostream instead of an MCObjectW...
Peter Collingbourne [Mon, 21 May 2018 17:57:19 +0000 (17:57 +0000)]
MC: Change MCAsmBackend::writeNopData() to take a raw_ostream instead of an MCObjectWriter. NFCI.

To make this work I needed to add an endianness field to MCAsmBackend
so that writeNopData() implementations know which endianness to use.

Part of PR37466.

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

llvm-svn: 332857

6 years agoAMDGPU/GlobalISel: Address post-commit review comments for r332379
Tom Stellard [Mon, 21 May 2018 17:49:31 +0000 (17:49 +0000)]
AMDGPU/GlobalISel: Address post-commit review comments for r332379

MCRegisterInfo::getPhysRegSize() will be deprecated.

llvm-svn: 332856

6 years ago[InstCombine] Fix PR37526: MinMax patterns produce an infinite loop.
Alexey Bataev [Mon, 21 May 2018 17:46:34 +0000 (17:46 +0000)]
[InstCombine] Fix PR37526: MinMax patterns produce an infinite loop.

Summary:
This patch fixes PR37526 by simplifying the newly generated LoadInst
instructions. If the pointer address is a bitcast from the pointer to
the NewType, we can just remove this extra bitcast instead of creating
the new one. This fixes the PR37526 + may speed up the whole compilation
process.

Reviewers: spatel, RKSimon, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 332855

6 years ago[Clang Tablegen] Add llvm_unreachable() to getModifierName()
Mark Searles [Mon, 21 May 2018 17:29:08 +0000 (17:29 +0000)]
[Clang Tablegen] Add llvm_unreachable() to getModifierName()

Fix internal build failure:

../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o
../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef
{anonymous}::getModifierName({anonymous}::ModifierType)':
../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type]
}
^

Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8

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

llvm-svn: 332854

6 years ago[llvm-mca] Removed an empty line generated by the timeline view. NFC.
Andrea Di Biagio [Mon, 21 May 2018 17:11:56 +0000 (17:11 +0000)]
[llvm-mca] Removed an empty line generated by the timeline view. NFC.

Also, regenerate all tests.

llvm-svn: 332853

6 years ago[OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.
Alexey Bataev [Mon, 21 May 2018 16:40:32 +0000 (16:40 +0000)]
[OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.

if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be
  defined. If `-fopenmp-simd` is specified along with the `-fopenmp`,
  `_OPENMP` macro should be defined with the value `201511`.

llvm-svn: 332852

6 years ago[X86][BtVer2] Add a 'J' prefix to the PRF/RCU defs. NFC
Andrea Di Biagio [Mon, 21 May 2018 16:30:26 +0000 (16:30 +0000)]
[X86][BtVer2] Add a 'J' prefix to the PRF/RCU defs. NFC

This is to keep the Jaguar model's naming convention. Processor resources all
have a 'J' prefix in the BtVer2 scheduling model.

llvm-svn: 332851

6 years ago[LLVM-C] Add DIBuilder Bindings For ObjC Classes
Robert Widmann [Mon, 21 May 2018 16:27:35 +0000 (16:27 +0000)]
[LLVM-C] Add DIBuilder Bindings For ObjC Classes

Summary: Add LLVMDIBuilderCreateObjCIVar, LLVMDIBuilderCreateObjCProperty, and LLVMDIBuilderCreateInheritance to allow declaring metadata for Objective-C class hierarchies and their associated properties and instance variables.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: harlanhaskins, llvm-commits

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

llvm-svn: 332850

6 years ago[X86] - Avoid SFB pass - fix bug in updating the offsets for newly created copies
Lama Saba [Mon, 21 May 2018 16:23:16 +0000 (16:23 +0000)]
[X86] - Avoid SFB pass - fix bug in updating the offsets for newly created copies

Change-Id: I169ab6fe7e187727c0298c2a1e2868a683f3e688
llvm-svn: 332849

6 years ago[AMDGPU] fixes for lds f32 builtins
Daniil Fukalov [Mon, 21 May 2018 16:18:07 +0000 (16:18 +0000)]
[AMDGPU] fixes for lds f32 builtins

1. added restrictions to memory scope, order and volatile parameters
2. added custom processing for these builtins - currently is not used code,
   needed to switch off GCCBuiltin link to the builtins (ongoing change to llvm
   tree)
3. builtins renamed as requested

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

llvm-svn: 332848

6 years ago[CodeGen] Recognize more cases of zero initialization
Serge Pavlov [Mon, 21 May 2018 16:09:54 +0000 (16:09 +0000)]
[CodeGen] Recognize more cases of zero initialization

If a variable has an initializer, codegen tries to build its value. If
the variable is large in size, building its value requires substantial
resources. It causes strange behavior from user viewpoint: compilation
of huge zero initialized arrays like:

    char data_1[2147483648u] = { 0 };

consumes enormous amount of time and memory.

With this change codegen tries to determine if variable initializer is
equivalent to zero initializer. In this case variable value is not
constructed.

This change fixes PR18978.

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

llvm-svn: 332847

6 years ago[ELF] Update due to API change in .debug_line parsing
James Henderson [Mon, 21 May 2018 15:31:23 +0000 (15:31 +0000)]
[ELF] Update due to API change in .debug_line parsing

See r332845.

Reviewed by: grimar

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

llvm-svn: 332846

6 years ago[DWARF] Refactor callback usage for .debug_line error handling
James Henderson [Mon, 21 May 2018 15:30:54 +0000 (15:30 +0000)]
[DWARF] Refactor callback usage for .debug_line error handling

Change the "recoverable" error callback to take an Error instaed of a
string.

Reviewed by: JDevlieghere

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

llvm-svn: 332845

6 years ago[X86][SSE] Add an assert to ensure that rotation amount is converted to a scale
Simon Pilgrim [Mon, 21 May 2018 15:17:23 +0000 (15:17 +0000)]
[X86][SSE] Add an assert to ensure that rotation amount is converted to a scale

Missed in rL332832 where we added SSE v4i32 rotations for PR37426.

llvm-svn: 332844

6 years ago[Sema] Fix incorrect packed aligned structure layout
Momchil Velikov [Mon, 21 May 2018 14:28:43 +0000 (14:28 +0000)]
[Sema] Fix incorrect packed aligned structure layout

Handle attributes before checking the record layout (e.g. underalignment check
during `alignas` processing), as layout may be cached without taking into
account attributes that may affect it.

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

llvm-svn: 332843

6 years agoFix PathMappingList for relative and empty paths after recent FileSpec normalization...
Greg Clayton [Mon, 21 May 2018 14:14:36 +0000 (14:14 +0000)]
Fix PathMappingList for relative and empty paths after recent FileSpec normalization changes

PathMappingList was broken for relative and empty paths after normalization changes in FileSpec. There were also no tests for PathMappingList so I added those.

Changes include:

Change PathMappingList::ReverseRemapPath() to take FileSpec objects instead of ConstString. The only client of this was doing work to convert to and from ConstString objects for no reason.
Normalize all paths prefix and replacements that are added to the PathMappingList vector so they match the paths that have been already normalized in the debug info
Unify code in the two forms of PathMappingList::RemapPath() so only one contains the actual functionality. Prior to this, there were two versions of this code.
Use FileSpec::AppendPathComponent() and remove a long standing TODO so paths are correctly appended to each other.
Added tests for absolute, relative and empty paths.

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

llvm-svn: 332842

6 years agoReland "[DWARF] Extract indexing code into a separate class hierarchy"
Pavel Labath [Mon, 21 May 2018 14:12:52 +0000 (14:12 +0000)]
Reland "[DWARF] Extract indexing code into a separate class hierarchy"

After this commit, the xcode project will need to be updated to include
the new files added here.

llvm-svn: 332841

6 years agoARM: be conservative when asked load/store alignment of weird type.
Tim Northover [Mon, 21 May 2018 12:43:54 +0000 (12:43 +0000)]
ARM: be conservative when asked load/store alignment of weird type.

Chances are we'll be asked again after type legalization, but before that point
it's better to claim misaligned accesses aren't allowed than to assert.

llvm-svn: 332840

6 years ago[CodeGen] Disable aggressive structor optimizations at -O0, take 2
Pavel Labath [Mon, 21 May 2018 11:47:45 +0000 (11:47 +0000)]
[CodeGen] Disable aggressive structor optimizations at -O0, take 2

The first version of the patch (r332228) was flawed because it was
putting structors into C5/D5 comdats very eagerly. This is correct only
if we can ensure the comdat contains all required versions of the
structor (which wasn't the case). This version uses a more nuanced
approach:
- for local structor symbols we use an alias because we don't have to
  worry about comdats or other compilation units.
- linkonce symbols are emitted separately, as we cannot guarantee we
  will have all symbols we need to form a comdat (they are emitted
  lazily, only when referenced).
- available_externally symbols are also emitted separately, as the code
  seemed to be worried about emitting an alias in this case.
- other linkage types are not affected by the optimization level. They
  either get put into a comdat (weak) or get aliased (external).

Reviewers: rjmccall, aprantl

Subscribers: cfe-commits

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

llvm-svn: 332839

6 years agorevert r332610, it breaks cfi, see D46326
Nico Weber [Mon, 21 May 2018 11:44:39 +0000 (11:44 +0000)]
revert r332610, it breaks cfi, see D46326

llvm-svn: 332838

6 years ago[mips] Revert Merge MipsLongBranch and MipsHazardSchedule passes
Aleksandar Beserminji [Mon, 21 May 2018 11:38:52 +0000 (11:38 +0000)]
[mips] Revert Merge MipsLongBranch and MipsHazardSchedule passes

Revert this patch due buildbot failure.

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

llvm-svn: 332837

6 years ago[CVP] Require DomTree for new Pass Manager
David Green [Mon, 21 May 2018 11:06:28 +0000 (11:06 +0000)]
[CVP] Require DomTree for new Pass Manager

We were previously using a DT in CVP through SimplifyQuery, but not requiring it in
the new pass manager. Hence it would crash if DT was not already available. This now
gets DT directly and plumbs it through to where it is used (instead of using it
through SQ).

llvm-svn: 332836

6 years agoFix up a few grammar issues.
Eric Christopher [Mon, 21 May 2018 10:27:36 +0000 (10:27 +0000)]
Fix up a few grammar issues.

llvm-svn: 332835

6 years ago[mips] Merge MipsLongBranch and MipsHazardSchedule passes
Aleksandar Beserminji [Mon, 21 May 2018 10:20:02 +0000 (10:20 +0000)]
[mips] Merge MipsLongBranch and MipsHazardSchedule passes

MipsLongBranchPass and MipsHazardSchedule passes are joined to one pass
because of mutual conflict. When MipsHazardSchedule inserts 'nop's, it
potentially breaks some jumps, so they have to be expanded to long
branches. When some branch is expanded to long branch, it potentially
creates a hazard situation, which should be fixed by adding nops.
New pass is called MipsBranchExpansion, it combines these two passes,
and runs them alternately until one of them reports no changes were made.

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

llvm-svn: 332834

6 years agoImprove coverage of the apple-tables test
Pavel Labath [Mon, 21 May 2018 10:09:22 +0000 (10:09 +0000)]
Improve coverage of the apple-tables test

After closer examination, it turns out we mis-classify one of the
methods only if two of the structs have the same name. Since this was
meant to be a basic test, I rename one of the structs in the test so
that we have at least some coverage for the apple tables lookup.
Instead, I create an XFAILed test which specifically targets the
same-name case (and file a bug to track it).

llvm-svn: 332833

6 years ago[X86][SSE] Support v4i32 rotations (PR37426)
Simon Pilgrim [Mon, 21 May 2018 09:45:59 +0000 (09:45 +0000)]
[X86][SSE] Support v4i32 rotations (PR37426)

As suggested by Fabian on PR37426, we can use PMULUDQ to perform v4i32 vector rotations as the upper 32bits of the multiply will contain the 'wrapped' bits of the rotation.

v8i16/v16i8 rotations would be straightforward to add to lowerRotate in the future - ideally we'd mostly share code with the vector shifts lowering.

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

llvm-svn: 332832

6 years agoAdd some apple-tables lookup tests
Pavel Labath [Mon, 21 May 2018 09:27:16 +0000 (09:27 +0000)]
Add some apple-tables lookup tests

Summary:
Now that we are able to parse MachO files everywhere, we can write some
cross-platform tests for handling of apple accelerator tables. This
reruns the same lookup tests we have for manual indexes on MachO files
which will use the accelerator tables instead. This makes sure we return
the same results regardless of the method we used to access the debug
info.

The tests confirm we return the same results for looking up types,
namespaces and variables, but have found an inconsistency in the
treatment of function lookup. In the function case we mis-classify the
method "foo" declared in the local struct sbar (inside function ffbar).
We classify it as a function whereas it really is a method. Preliminary
analysis suggests this is because
DWARFASTParserClang::GetClangDeclContextForDIE returns null when given
the local "struct sbar" DIE. This causes us to get the wrong
CompilerDeclContext when we ask for the context of the inner foo, which
means CompilerDeclContext::ISStructUnionOrClass returns false.

Until this is fixed, I do not include the darwin versions of the "base"
and "method" function lookup tests.

Reviewers: JDevlieghere, clayborg

Subscribers: aprantl, ilya-biryukov, ioeric, lldb-commits

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

llvm-svn: 332831

6 years ago[X86] Remove some preprocessor feature checks from intrinsic headers
Craig Topper [Mon, 21 May 2018 06:07:49 +0000 (06:07 +0000)]
[X86] Remove some preprocessor feature checks from intrinsic headers

Summary:
These look to be a couple things that weren't removed when we switched to target attribute.

The popcnt makes including just smmintrin.h also include popcntintrin.h. The popcnt file itself already contains target attrributes.

The prefetch ones are just wrappers around __builtin_prefetch which we have graceful fallbacks for in the backend if the exact instruction isn't available. So there's no reason to hide them. And it makes them available in functions that have the write target attribute but not a -march command line flag.

Reviewers: echristo, RKSimon, spatel, DavidKreitzer

Reviewed By: echristo

Subscribers: cfe-commits

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

llvm-svn: 332830

6 years ago[X86] Remove some unused builtins.
Craig Topper [Mon, 21 May 2018 03:36:57 +0000 (03:36 +0000)]
[X86] Remove some unused builtins.

These were upgraded to native shufflevectors months ago.

llvm-svn: 332829