platform/upstream/llvm.git
6 years agoImplement DR2229, which prohibits unnamed bit-fields from having qualifiers in C++.
Aaron Ballman [Sat, 17 Mar 2018 21:08:40 +0000 (21:08 +0000)]
Implement DR2229, which prohibits unnamed bit-fields from having qualifiers in C++.

llvm-svn: 327781

6 years agoFix codegen for structured binding binding in conditions
Zhihao Yuan [Sat, 17 Mar 2018 21:01:27 +0000 (21:01 +0000)]
Fix codegen for structured binding binding in conditions

Summary:
The codegen for conditions assumes that a normal variable declaration is used in a condition, but this is not the case when a structured binding is used.

This fixes [PR36747](http://llvm.org/pr36747).

Thanks Nicolas Lesser for contributing the patch.

Reviewers: lichray, rsmith

Reviewed By: lichray

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 327780

6 years ago[AArch64] Skip an unnecessary getCopyToReg in DYNAMIC_STACKALLOC
Martin Storsjo [Sat, 17 Mar 2018 20:08:48 +0000 (20:08 +0000)]
[AArch64] Skip an unnecessary getCopyToReg in DYNAMIC_STACKALLOC

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

llvm-svn: 327779

6 years agoRevert "[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172""
Nirav Dave [Sat, 17 Mar 2018 19:24:54 +0000 (19:24 +0000)]
Revert "[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172""

as it times out building test-suite on PPC.

llvm-svn: 327778

6 years ago[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172"
Nirav Dave [Sat, 17 Mar 2018 17:42:10 +0000 (17:42 +0000)]
[DAG, X86] Revert r327197 "Revert r327170, r327171, r327172"

Reland ISel cycle checking improvements after simplifying and reducing
node id invariant traversal.

llvm-svn: 327777

6 years agoFix some user facing typos
Sylvestre Ledru [Sat, 17 Mar 2018 17:30:08 +0000 (17:30 +0000)]
Fix some user facing typos

llvm-svn: 327776

6 years ago[Driver] Fix the descriptions for -Tdata and -Ttext options
Aaron Smith [Sat, 17 Mar 2018 15:24:35 +0000 (15:24 +0000)]
[Driver] Fix the descriptions for -Tdata and -Ttext options

Reviewers: llvm-commits

Subscribers: cfe-commits

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

llvm-svn: 327775

6 years agoAMDGPU/GlobalISel: Cleanup constant legality
Matt Arsenault [Sat, 17 Mar 2018 15:17:48 +0000 (15:17 +0000)]
AMDGPU/GlobalISel: Cleanup constant legality

llvm-svn: 327774

6 years agoAMDGPU/GlobalISel: Basic G_GEP legality
Matt Arsenault [Sat, 17 Mar 2018 15:17:45 +0000 (15:17 +0000)]
AMDGPU/GlobalISel: Basic G_GEP legality

llvm-svn: 327773

6 years agoAMDGPU/GlobalISel: Basic legality for load/store
Matt Arsenault [Sat, 17 Mar 2018 15:17:41 +0000 (15:17 +0000)]
AMDGPU/GlobalISel: Basic legality for load/store

llvm-svn: 327772

6 years ago[bindings/go] Add a missing `,` in the test code to fix a go compile
Chandler Carruth [Sat, 17 Mar 2018 15:12:52 +0000 (15:12 +0000)]
[bindings/go] Add a missing `,` in the test code to fix a go compile
failure.

llvm-svn: 327771

6 years ago[cxx_status] Add entry for the Reflection TS.
Richard Smith [Sat, 17 Mar 2018 14:34:21 +0000 (14:34 +0000)]
[cxx_status] Add entry for the Reflection TS.

llvm-svn: 327770

6 years ago[cxx_status] Update to match Jacksonville 2018 motions.
Richard Smith [Sat, 17 Mar 2018 14:28:47 +0000 (14:28 +0000)]
[cxx_status] Update to match Jacksonville 2018 motions.

Also rearrange how we list DR motions: rather than listing them as part of some
later standard, list them against the feature they are a DR against. Explicitly
add a description of how we handle DRs.

llvm-svn: 327769

6 years agoAdding nocf_check attribute for cf-protection fine tuning
Oren Ben Simhon [Sat, 17 Mar 2018 13:31:35 +0000 (13:31 +0000)]
Adding nocf_check attribute for cf-protection fine tuning

The patch adds nocf_check target independent attribute for disabling checks that were enabled by cf-protection flag.
The attribute can be appertained to functions and function pointers.
Attribute name follows GCC's similar attribute name.

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

llvm-svn: 327768

6 years ago[X86] Added support for nocf_check attribute for indirect Branch Tracking
Oren Ben Simhon [Sat, 17 Mar 2018 13:29:46 +0000 (13:29 +0000)]
[X86] Added support for nocf_check attribute for indirect Branch Tracking

X86 Supports Indirect Branch Tracking (IBT) as part of Control-Flow Enforcement Technology (CET).
IBT instruments ENDBR instructions used to specify valid targets of indirect call / jmp.
TheĀ `nocf_check` attribute has two roles in the context of X86 IBT technology:
1. Appertains to a function - do not add ENDBR instruction at the beginning of the function.
2. Appertains to a function pointer - do not track the target function of this pointer by adding nocf_check prefix to the indirect-call instruction.

This patch implementsĀ `nocf_check` context for Indirect Branch Tracking.
It also auto generatesĀ `nocf_check` prefixes before indirect branchs to jump tables that are guarded by range checks.

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

llvm-svn: 327767

6 years ago[SystemZ] Add 'REQUIRES: asserts' to test case using debug output.
Jonas Paulsson [Sat, 17 Mar 2018 09:15:13 +0000 (09:15 +0000)]
[SystemZ]  Add 'REQUIRES: asserts' to test case using debug output.

llvm-svn: 327766

6 years ago[SystemZ] computeKnownBitsForTargetNode() / ComputeNumSignBitsForTargetNode()
Jonas Paulsson [Sat, 17 Mar 2018 08:32:12 +0000 (08:32 +0000)]
[SystemZ]  computeKnownBitsForTargetNode() / ComputeNumSignBitsForTargetNode()

Improve/implement these methods to improve DAG combining. This mainly
concerns intrinsics.

Some constant operands to SystemZISD nodes have been marked Opaque to avoid
transforming back and forth between generic and target nodes infinitely.

Review: Ulrich Weigand
llvm-svn: 327765

6 years ago[SelectionDAG] Handle big endian target BITCAST in computeKnownBits()
Jonas Paulsson [Sat, 17 Mar 2018 08:04:00 +0000 (08:04 +0000)]
[SelectionDAG]  Handle big endian target BITCAST in computeKnownBits()

The BITCAST handling in computeKnownBits() previously only worked for little
endian.

This patch reverses the iteration over elements for a big endian target which
allows this to work in this case also.

SystemZ test case.

Review: Eli Friedman
https://reviews.llvm.org/D44249

llvm-svn: 327764

6 years agoBugfix, extern declarations for libomp functions are `extern "C"` declarations
George Rokos [Sat, 17 Mar 2018 02:07:42 +0000 (02:07 +0000)]
Bugfix, extern declarations for libomp functions are `extern "C"` declarations

llvm-svn: 327763

6 years agoRevert "Mmap interceptor new option, Write Exec runtime detector"
Vitaly Buka [Sat, 17 Mar 2018 00:31:41 +0000 (00:31 +0000)]
Revert "Mmap interceptor new option, Write Exec runtime detector"

Breaks Android bot.

This reverts commit r327747.

llvm-svn: 327762

6 years ago[GlobalsAA] Fix a pretty terrible bug that has been in GlobalsAA for
Chandler Carruth [Fri, 16 Mar 2018 23:51:33 +0000 (23:51 +0000)]
[GlobalsAA] Fix a pretty terrible bug that has been in GlobalsAA for
a long time.

The key thing is that we need to create value handles for every function
that we create a `FunctionInfo` object around. Without this, when that
function is deleted we can end up creating a new function that collides
with its address and look up a stale AA result. With that AA result we
can in turn miscompile code in ways that break.

This is seriously one of the most absurd miscompiles I've seen. It only
reproduced for us recently and only when building a very large server
with both ThinLTO and PGO.

A *HUGE* shout out to Wei Mi who tracked all of this down and came up
with this patch. I'm just landing it because I happened to still by at
a computer.

He or I can work on crafting a test case to hit this (now that we know
what to target) but it'll take a while, and we've been chasing this for
a long time and need it fix Right Now.

llvm-svn: 327761

6 years ago[MachineOutliner] Make KILLs invisible
Jessica Paquette [Fri, 16 Mar 2018 22:53:34 +0000 (22:53 +0000)]
[MachineOutliner] Make KILLs invisible

At the point the outliner runs, KILLs don't impact anything, but they're still
considered unique instructions. This commit makes them invisible like
DebugValues so that they can still be outlined without impacting outlining
decisions.

llvm-svn: 327760

6 years ago[Fuzzer] Build the shared memory hooks for Fuchsia
Petr Hosek [Fri, 16 Mar 2018 22:40:55 +0000 (22:40 +0000)]
[Fuzzer] Build the shared memory hooks for Fuchsia

This is needed otherwise we'll get undefined references when trying
to use the libFuzzer built for Fuchsia.

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

llvm-svn: 327759

6 years agoOpenBSD UBsan support final missing bits
Vitaly Buka [Fri, 16 Mar 2018 22:29:29 +0000 (22:29 +0000)]
OpenBSD UBsan support final missing bits

Summary:
One forgotten file change + reordering one header due to clang-format

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers

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

llvm-svn: 327758

6 years ago[llvm-mca] Remove method getSchedModel() from the Backend.
Andrea Di Biagio [Fri, 16 Mar 2018 22:21:52 +0000 (22:21 +0000)]
[llvm-mca] Remove method getSchedModel() from the Backend.

llvm-svn: 327756

6 years ago[MS] Fix bug in r327732 with devirtualized complete destructor calls
Reid Kleckner [Fri, 16 Mar 2018 22:20:57 +0000 (22:20 +0000)]
[MS] Fix bug in r327732 with devirtualized complete destructor calls

llvm-svn: 327754

6 years agoFix the Windows build after r327750
Frederic Riss [Fri, 16 Mar 2018 22:19:58 +0000 (22:19 +0000)]
Fix the Windows build after r327750

llvm-svn: 327753

6 years ago[asan] Replace vfork with fork.
Evgeniy Stepanov [Fri, 16 Mar 2018 22:15:05 +0000 (22:15 +0000)]
[asan] Replace vfork with fork.

Summary:
vfork is not ASan-friendly because it modifies stack shadow in the
parent process address space. While it is possible to compensate for that with, for example,
__asan_handle_no_return before each call to _exit or execve and friends, simply replacing
vfork with fork looks like by far the easiest solution.

Posix compliant programs can not detect the difference between vfork and fork.

Fixes https://github.com/google/sanitizers/issues/925

Reviewers: kcc, vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 327752

6 years ago[DWARFASTParserClang] Complete external record types before using them as a decl...
Frederic Riss [Fri, 16 Mar 2018 22:12:22 +0000 (22:12 +0000)]
[DWARFASTParserClang] Complete external record types before using them as a decl context.

Summary:
When in a gmodules-like debugging scenario, you can have a parent decl context
that gets imported from an external AST. When this happens, we must be careful
to complete this type before adding children to it, otherwise it sometimes
results in a crash.

Reviewers: clayborg, jingham

Subscribers: aprantl, JDevlieghere, lldb-commits

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

llvm-svn: 327750

6 years ago[llvm-mca] Remove unused methods from Backend. NFC
Andrea Di Biagio [Fri, 16 Mar 2018 22:02:47 +0000 (22:02 +0000)]
[llvm-mca] Remove unused methods from Backend. NFC

llvm-svn: 327749

6 years ago[asan] Remove empty fork interceptor.
Evgeniy Stepanov [Fri, 16 Mar 2018 21:31:49 +0000 (21:31 +0000)]
[asan] Remove empty fork interceptor.

After a partial revert, ASan somehow ended up with an empty interceptor for fork().

llvm-svn: 327748

6 years agoMmap interceptor new option, Write Exec runtime detector
Vitaly Buka [Fri, 16 Mar 2018 21:25:09 +0000 (21:25 +0000)]
Mmap interceptor new option, Write Exec runtime detector

Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

Subscribers: krytarowski, #sanitizers

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

llvm-svn: 327747

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Mar 2018 21:22:42 +0000 (21:22 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 327746

6 years agoQuiet unused variable warnings. NFC.
David L Kreitzer [Fri, 16 Mar 2018 21:21:23 +0000 (21:21 +0000)]
Quiet unused variable warnings. NFC.

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

llvm-svn: 327745

6 years ago[X86] Pass SelectionDAG into X86ISelAddressMode::dump and on to SDNode::dump.
Craig Topper [Fri, 16 Mar 2018 21:10:07 +0000 (21:10 +0000)]
[X86] Pass SelectionDAG into X86ISelAddressMode::dump and on to SDNode::dump.

This prevents a crash in SelectionDAGDumper with -debug when trying to print mem operands if one of the registers in the addressing mode comes from a load.

llvm-svn: 327744

6 years ago[InstSimplify] add NaN constant diversity; NFC
Sanjay Patel [Fri, 16 Mar 2018 20:55:55 +0000 (20:55 +0000)]
[InstSimplify] add NaN constant diversity; NFC

llvm-svn: 327743

6 years ago[Hexagon] Avoid bank conflicts in post-RA scheduler
Krzysztof Parzyszek [Fri, 16 Mar 2018 20:55:49 +0000 (20:55 +0000)]
[Hexagon] Avoid bank conflicts in post-RA scheduler

Avoid scheduling two loads in such a way that they would end up in the
same packet. If there is a load in a packet, try to schedule a non-load
next.

Patch by Brendon Cahoon.

llvm-svn: 327742

6 years ago[MS] Fix tests after r327738 that only fail with a default Windows target
Reid Kleckner [Fri, 16 Mar 2018 20:53:13 +0000 (20:53 +0000)]
[MS] Fix tests after r327738 that only fail with a default Windows target

llvm-svn: 327741

6 years agoMoved extern declarations to private header file, they are only used from within...
George Rokos [Fri, 16 Mar 2018 20:40:09 +0000 (20:40 +0000)]
Moved extern declarations to private header file, they are only used from within libomptarget, they don't need to be in omptarget.h.

llvm-svn: 327740

6 years ago[MS] Commit some changes that were intended to be part of r327738
Reid Kleckner [Fri, 16 Mar 2018 20:37:59 +0000 (20:37 +0000)]
[MS] Commit some changes that were intended to be part of r327738

llvm-svn: 327739

6 years ago[MS] Don't escape MS C++ names with \01
Reid Kleckner [Fri, 16 Mar 2018 20:36:49 +0000 (20:36 +0000)]
[MS] Don't escape MS C++ names with \01

It is not needed after LLVM r327734. Now it will be easier to copy-paste
IR symbol names from Clang.

llvm-svn: 327738

6 years ago[Hexagon] Add lit testcases for atomic intrinsics
Krzysztof Parzyszek [Fri, 16 Mar 2018 20:21:43 +0000 (20:21 +0000)]
[Hexagon] Add lit testcases for atomic intrinsics

Patch by Ben Craig.

llvm-svn: 327737

6 years ago[COFF] Clarify comment. NFC
Shoaib Meenai [Fri, 16 Mar 2018 20:20:01 +0000 (20:20 +0000)]
[COFF] Clarify comment. NFC

Reid pointed out the string table for supporting long section names is a
BFD extension and the comments should reflect that. Explicitly spell out
link.exe's and binutil's behavior around section names and the rationale
for LLD's behavior.

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

llvm-svn: 327736

6 years ago[Parser] Remove hard-coded bracket depth limit
Jan Korous [Fri, 16 Mar 2018 20:17:28 +0000 (20:17 +0000)]
[Parser] Remove hard-coded bracket depth limit

The diagnostics produced if assert fails are using proper limit from language definition already.

llvm-svn: 327735

6 years ago[IR] Avoid the need to prefix MS C++ symbols with '\01'
Reid Kleckner [Fri, 16 Mar 2018 20:13:32 +0000 (20:13 +0000)]
[IR] Avoid the need to prefix MS C++ symbols with '\01'

Now the Windows mangling modes ('w' and 'x') do not do any mangling for
symbols starting with '?'. This means that clang can stop adding the
hideous '\01' leading escape. This means LLVM debug logs are less likely
to contain ASCII escape characters and it will be easier to copy and
paste MS symbol names from IR.

Finally.

For non-Windows platforms, names starting with '?' still get IR
mangling, so once clang stops escaping MS C++ names, we will get extra
'_' prefixing on MachO. That's fine, since it is currently impossible to
construct a triple that uses the MS C++ ABI in clang and emits macho
object files.

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

llvm-svn: 327734

6 years agoRevert r327721 "This patch fixes the invalid usage of OptSize in Machine Combiner."
Reid Kleckner [Fri, 16 Mar 2018 20:11:55 +0000 (20:11 +0000)]
Revert r327721 "This patch fixes the invalid usage of OptSize in Machine Combiner."

It causes asserts when compiling Chromium on Win32 with optimizations.
We compile many things with -Os.

llvm-svn: 327733

6 years ago[MS] Always use base dtors in place of complete/vbase dtors when possible
Reid Kleckner [Fri, 16 Mar 2018 19:40:50 +0000 (19:40 +0000)]
[MS] Always use base dtors in place of complete/vbase dtors when possible

Summary:
Previously we tried too hard to uphold the fiction that destructor
variants work like they do on Itanium throughout the ABI-neutral parts
of clang. This lead to MS C++ ABI incompatiblities and other bugs. Now,
-mconstructor-aliases will no longer control this ABI detail, and clang
-cc1's LLVM IR output will be this much closer to the clang driver's.

Based on a patch by Zahira Ammarguellat:
  https://reviews.llvm.org/D39063

I've tried to move the logic that Zahira added into MicrosoftCXXABI.cpp.
There is only one ABI-specific detail sticking out, and that is in
CodeGenModule::getAddrOfCXXStructor, where we collapse complete dtors to
base dtors in the MS ABI.

This fixes PR32990.

Reviewers: erichkeane, zahiraam, majnemer, rjmccall

Subscribers: cfe-commits

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

llvm-svn: 327732

6 years agoSkip TestThreadSpecificBpPlusCondition on Darwin due to timeouts
Vedant Kumar [Fri, 16 Mar 2018 19:33:39 +0000 (19:33 +0000)]
Skip TestThreadSpecificBpPlusCondition on Darwin due to timeouts

Bot failure: https://ci.swift.org/job/oss-lldb-incremental-osx/1104/

llvm-svn: 327731

6 years ago[X86] Merge ADDSUB/SUBADD detection into single methods that can detect either and...
Craig Topper [Fri, 16 Mar 2018 18:25:59 +0000 (18:25 +0000)]
[X86] Merge ADDSUB/SUBADD detection into single methods that can detect either and indicate what they found.

Previously, we called the same functions twice with a bool flag determining whether we should look for ADDSUB or SUBADD. It would be more efficient to run the code once and detect either pattern with a flag to tell which type it found.

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

llvm-svn: 327730

6 years agoRemove -gmodules restriction from test
Adrian Prantl [Fri, 16 Mar 2018 18:21:48 +0000 (18:21 +0000)]
Remove -gmodules restriction from test

llvm-svn: 327729

6 years ago[CorrelatedValuePropagation] Use SelectInst::getCondition/getTrueValue/getFalseValue...
Craig Topper [Fri, 16 Mar 2018 18:18:47 +0000 (18:18 +0000)]
[CorrelatedValuePropagation] Use SelectInst::getCondition/getTrueValue/getFalseValue instead of getOperand for readability. NFC

llvm-svn: 327728

6 years ago[analyzer] Fix crashes in RetainCountChecker when underlying region is not a var
George Karpenkov [Fri, 16 Mar 2018 18:16:47 +0000 (18:16 +0000)]
[analyzer] Fix crashes in RetainCountChecker when underlying region is not a var

For other regions, the error message contains a good indication of the
problem, and there, in general, nothing helpful we can print.
Error pointer to the problematic expression seems enough.

rdar://37323555

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

llvm-svn: 327727

6 years ago[AMDGPU] Supported ds_write_b128 generation.
Farhana Aleen [Fri, 16 Mar 2018 18:12:00 +0000 (18:12 +0000)]
[AMDGPU] Supported ds_write_b128 generation.

Summary: This is a follow-on patch of https://reviews.llvm.org/D44210

Author: FarhanaAleen

Reviewed By: msearles

Subscribers: llvm-commits, AMDGPU

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

llvm-svn: 327726

6 years ago[docs] ReleaseNotes: document -Wextra-semi changes.
Roman Lebedev [Fri, 16 Mar 2018 18:01:07 +0000 (18:01 +0000)]
[docs] ReleaseNotes: document -Wextra-semi changes.

I should have done it in rL327558 / D43162, but forgot..

I'm not 100% sure about the text, but i don't think
it warrants a whole new differential revision.

llvm-svn: 327725

6 years ago[X86] Post process the DAG after isel to remove vector moves that were added to zero...
Craig Topper [Fri, 16 Mar 2018 17:13:42 +0000 (17:13 +0000)]
[X86] Post process the DAG after isel to remove vector moves that were added to zero upper bits.

We previously avoided inserting these moves during isel in a few cases which is implemented using a whitelist of opcodes. But it's too difficult to generate a perfect list of opcodes to whitelist. Especially with AVX512F without AVX512VL using 512 bit vectors to implement some 128/256 bit operations. Since isel is done bottoms up, we'd have to check the VT and opcode and subtarget in order to determine whether an EXTRACT_SUBREG would be generated for some operations.

So instead of doing that, this patch adds a post processing step that detects when the moves are unnecesssary after isel. At that point any EXTRACT_SUBREGs would have already been created and appear in the DAG. So then we just need to ensure the input to the move isn't one.

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

llvm-svn: 327724

6 years ago[AMDGPU][MC][GFX8][GFX9][DISASSEMBLER] Added "_e32" suffix to 32-bit VINTRP opcodes
Dmitry Preobrazhensky [Fri, 16 Mar 2018 16:38:04 +0000 (16:38 +0000)]
[AMDGPU][MC][GFX8][GFX9][DISASSEMBLER] Added "_e32" suffix to 32-bit VINTRP opcodes

See bug 36751: https://bugs.llvm.org/show_bug.cgi?id=36751

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

Reviewers: artem.tamazov, arsenm
llvm-svn: 327723

6 years ago[LICM/mustexec] Extend first iteration must execute logic to fcmps
Philip Reames [Fri, 16 Mar 2018 16:33:49 +0000 (16:33 +0000)]
[LICM/mustexec] Extend first iteration must execute logic to fcmps

This builds on the work from https://reviews.llvm.org/D44287. It turned out supporting fcmp was much easier than I realized, so let's do that now.

As an aside, our -O3 handling of a floating point IVs leaves a lot to be desired. We do convert the float IV to an integer IV, but do so late enough that many other optimizations are missed (e.g. we don't vectorize).

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

llvm-svn: 327722

6 years agoThis patch fixes the invalid usage of OptSize in Machine Combiner.
Andrew V. Tischenko [Fri, 16 Mar 2018 16:06:24 +0000 (16:06 +0000)]
This patch fixes the invalid usage of OptSize in Machine Combiner.
Differential Revision: https://reviews.llvm.org/D43813

llvm-svn: 327721

6 years ago[AMDGPU][MC] Corrected default values for unused SDWA operands
Dmitry Preobrazhensky [Fri, 16 Mar 2018 15:40:27 +0000 (15:40 +0000)]
[AMDGPU][MC] Corrected default values for unused SDWA operands

See bug 36355:  https://bugs.llvm.org/show_bug.cgi?id=36355

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

Reviewers: artem.tamazov, arsenm
llvm-svn: 327720

6 years agoRevert "Mmap interceptor new option, Write Exec runtime detector"
Jonas Devlieghere [Fri, 16 Mar 2018 15:34:09 +0000 (15:34 +0000)]
Revert "Mmap interceptor new option, Write Exec runtime detector"

This reverts r327696 because it is failing on GreenDragon.

  http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/43605/
  http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10957/

llvm-svn: 327719

6 years ago[InstCombine] add nnan requirement to potential fabs folds tests; NFC
Sanjay Patel [Fri, 16 Mar 2018 15:27:39 +0000 (15:27 +0000)]
[InstCombine] add nnan requirement to potential fabs folds tests; NFC

As noted in D44550, we can't guarantee preserving the sign-bit of NaN
if we convert these to fabs().

llvm-svn: 327718

6 years ago[clangd] Handle multiple callbacks from Sema's completion
Ilya Biryukov [Fri, 16 Mar 2018 15:23:44 +0000 (15:23 +0000)]
[clangd] Handle multiple callbacks from Sema's completion

Summary:
When parser backtracks, we might receive multiple code completion
callbacks.
Previously we had a failing assertion there, now we take first results
and hope they are good enough.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 327717

6 years ago[clang-format] Disallow breaks before ']' in text proto extensions
Krasimir Georgiev [Fri, 16 Mar 2018 15:23:22 +0000 (15:23 +0000)]
[clang-format] Disallow breaks before ']' in text proto extensions

Summary: This disallows patterns like `[ext.name\n]` in text protos.

Subscribers: klimek, cfe-commits

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

llvm-svn: 327716

6 years ago[SystemZ] Make AnyRegBitRegClass unallocatable.
Jonas Paulsson [Fri, 16 Mar 2018 15:21:26 +0000 (15:21 +0000)]
[SystemZ]  Make AnyRegBitRegClass unallocatable.

AnyReg is just for the assembler and it is better to have it as not
allocatable in order to simplify (make more intuitive) the RegPressureSets.

Review: Ulrich Weigand
llvm-svn: 327715

6 years ago[GISel]: Remove unused header include in MachineIRBuilder.h
Aditya Nandakumar [Fri, 16 Mar 2018 15:14:18 +0000 (15:14 +0000)]
[GISel]: Remove unused header include in MachineIRBuilder.h

llvm-svn: 327714

6 years ago[JumpThreading] Track unreachable BBs to avoid processing
Brian M. Rzycki [Fri, 16 Mar 2018 15:13:47 +0000 (15:13 +0000)]
[JumpThreading] Track unreachable BBs to avoid processing

JumpThreading iterates over F until the IR quiesces. Transforming
unreachable BBs increases compile time and it is also possible to
never stabilize causing JumpThreading to hang. An older attempt at
fixing this problem was D3991 where removeUnreachableBlocks(F)
was called before JumpThreading began. This has a few drawbacks:
 * expensive - the routine attempts to fix up the IR to identify
   additional BBs that can be removed along with unreachable BBs.
 * aggressive - does not identify and preserve the shape of the IR.
   At a minimum it does not preserve loop hierarchies.
 * invasive - altering reachable blocks it may disrupt IR shapes
   that could have otherwise been JumpThreaded.

This patch avoids removeUnreachableBlocks(F) and instead tracks
unreachable BBs in a SmallPtrSet using DominatorTree to validate the
initial state of all BBs. We then rely on subsequent passes to identify
and remove these unreachable blocks from F.

Reviewers: dberlin, sebpop, kuhar, dinesh.d

Reviewed by: sebpop, kuhar

Subscribers: hiraditya, uabelho, llvm-commits

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

llvm-svn: 327713

6 years ago[Hexagon] Fix zero-extending non-HVX bool vectors
Krzysztof Parzyszek [Fri, 16 Mar 2018 15:03:37 +0000 (15:03 +0000)]
[Hexagon] Fix zero-extending non-HVX bool vectors

llvm-svn: 327712

6 years agoMove DraftMgr from ClangdServer to ClangdLSPServer
Simon Marchi [Fri, 16 Mar 2018 14:30:42 +0000 (14:30 +0000)]
Move DraftMgr from ClangdServer to ClangdLSPServer

Summary:
This patch moves the draft manager closer to the edge of Clangd, from
ClangdServer to ClangdLSPServer.  This will make it easier to implement
incremental document sync, by making ClangdServer only deal with
complete documents.

As a result, DraftStore doesn't have to deal with versioning, and thus
its API can be simplified.  It is replaced by a StringMap in
ClangdServer holding a current version number for each file.

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
Subscribers: klimek, mgorny, ilya-biryukov, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 327711

6 years ago[ARM] Convert more invalid NEON immediate loads
Mikhail Maltsev [Fri, 16 Mar 2018 14:10:56 +0000 (14:10 +0000)]
[ARM] Convert more invalid NEON immediate loads

Summary:
Currently the LLVM MC assembler is able to convert e.g.

  vmov.i32 d0, #0xabababab

(which is technically invalid) into a valid instruction

  vmov.i8 d0, #0xab

this patch adds support for vmov.i64 and for cases with the resulting
load types other than i8, e.g.:

  vmov.i32 d0, #0xab00ab00 ->
  vmov.i16 d0, #0xab00

Reviewers: olista01, rengolin

Reviewed By: rengolin

Subscribers: rengolin, javed.absar, kristof.beyls, rogfer01, llvm-commits

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

llvm-svn: 327709

6 years ago[clang-format] Fix raw string prefix penalty
Krasimir Georgiev [Fri, 16 Mar 2018 14:01:25 +0000 (14:01 +0000)]
[clang-format] Fix raw string prefix penalty

Summary: We weren't penalizing cases where the raw string prefix goes over the column limit.

Subscribers: klimek, cfe-commits

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

llvm-svn: 327708

6 years ago[X86][Btver2] Add correct mul/imul schedule costs
Simon Pilgrim [Fri, 16 Mar 2018 14:01:01 +0000 (14:01 +0000)]
[X86][Btver2] Add correct mul/imul schedule costs

Integer multiply is performed on the JMul function unit and i64 requires double pumping

llvm-svn: 327707

6 years ago[X86][Btver2] Add correct lzcnt/tzcnt/popcnt schedule costs
Simon Pilgrim [Fri, 16 Mar 2018 13:43:55 +0000 (13:43 +0000)]
[X86][Btver2] Add correct lzcnt/tzcnt/popcnt schedule costs

Don't use WriteIMul defaults

llvm-svn: 327706

6 years agoImplement C++ DR727, which permits explicit specializations at class scope.
Richard Smith [Fri, 16 Mar 2018 13:36:56 +0000 (13:36 +0000)]
Implement C++ DR727, which permits explicit specializations at class scope.

More generally, this permits a template to be specialized in any scope in which
it could be defined, so this also supersedes DR44 and DR374 (the latter of
which we previously only implemented in C++11 mode onwards due to unclarity as
to whether it was a DR).

llvm-svn: 327705

6 years ago[ARM] Fix a check in vmov/vmvn immediate parsing
Mikhail Maltsev [Fri, 16 Mar 2018 12:46:49 +0000 (12:46 +0000)]
[ARM] Fix a check in vmov/vmvn immediate parsing

Summary:
Currently the check is incorrect and the following invalid
instruction is accepted and incorrectly assembled:

  vmov.i32        d2, #0x00a500a6

This patch fixes the issue.

Reviewers: olista01, rengolin

Reviewed By: rengolin

Subscribers: SjoerdMeijer, javed.absar, rogfer01, llvm-commits, kristof.beyls

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

llvm-svn: 327704

6 years ago[dotest] Clean up test folder clean-up
Pavel Labath [Fri, 16 Mar 2018 12:04:46 +0000 (12:04 +0000)]
[dotest] Clean up test folder clean-up

Summary:
This patch implements a unified way of cleaning the build folder of each
test. This is done by completely removing the build folder before each
test, in the respective setUp() method. Previously, we were using a
combination of several methods, each with it's own drawbacks:
- nuking the entire build tree before running dotest: the issue here is
  that this did not take place if you ran dotest manually
- running "make clean" before the main "make" target: this relied on the
  clean command being correctly implemented. This was usually true, but
  not always.
- for files which were not produced by make, each python file was
  responsible for ensuring their deleting, using a variety of methods.

With this approach, the previous methods become redundant. I remove the
first two, since they are centralized. For the other various bits of
clean-up code in python files, I indend to delete it when I come
across it.

Reviewers: aprantl

Subscribers: emaste, ki.stfu, mgorny, eraman, lldb-commits

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

llvm-svn: 327703

6 years ago[AArch64] Implement getArithmeticReductionCost
Matthew Simpson [Fri, 16 Mar 2018 11:34:15 +0000 (11:34 +0000)]
[AArch64] Implement getArithmeticReductionCost

This patch provides an implementation of getArithmeticReductionCost for
AArch64. We can specialize the cost of add reductions since they are computed
using the 'addv' instruction.

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

llvm-svn: 327702

6 years agoHashTableTest: squelch some "comparison of integers of different signs" warnings
Pavel Labath [Fri, 16 Mar 2018 10:30:26 +0000 (10:30 +0000)]
HashTableTest: squelch some "comparison of integers of different signs" warnings

llvm-svn: 327701

6 years agotsan: revert: Update buildgo.sh to pass -isysroot on Darwin.
Dmitry Vyukov [Fri, 16 Mar 2018 10:20:58 +0000 (10:20 +0000)]
tsan: revert: Update buildgo.sh to pass -isysroot on Darwin.

This commit breaks actual Go runtime build on gomote builders (10.12) with:

xcode-select: error: tool 'xcodebuild' requires Xcode,
but active developer directory '/Library/Developer/CommandLineTools'
is a command line tools instance

Without this part build works fine.
The original commit does not include any explanation as to why
it is needed.

llvm-svn: 327700

6 years agoDWARFVerifier: Enhance validation of .debug_names hash tables
Pavel Labath [Fri, 16 Mar 2018 10:02:16 +0000 (10:02 +0000)]
DWARFVerifier: Enhance validation of .debug_names hash tables

Summary:
This patch adds more checks to the .debug_names validator. Specifically,
they check for:
- buckets claiming to be non-empty but pointing to mismatched hashes
  (most consumers would interpret this as an empty bucket, but it
  questionable whether the generator meant that)
- hashes that are not reachable from any bucket
- names with incorrect hashes

Together, these checks ensure that any name in the index can be reached
through the hash table using the regular lookup algorithm. We also warn
if we encounter a name index without a hash table.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 327699

6 years ago[TTI, AArch64] Allow the cost model analysis to test vector reduce intrinsics
Matthew Simpson [Fri, 16 Mar 2018 10:00:30 +0000 (10:00 +0000)]
[TTI, AArch64] Allow the cost model analysis to test vector reduce intrinsics

This patch considers the experimental vector reduce intrinsics in the default
implementation of getIntrinsicInstrCost. The cost of these intrinsics is
computed with getArithmeticReductionCost and getMinMaxReductionCost. This patch
also adds a test case for AArch64 that indicates the costs we currently compute
for vector reduce intrinsics. These costs are inaccurate and will be updated in
a follow-on patch.

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

llvm-svn: 327698

6 years agoFreeBSD TSan support update
Vitaly Buka [Fri, 16 Mar 2018 08:23:33 +0000 (08:23 +0000)]
FreeBSD TSan support update

Summary:
- Disable thread_finalize callback on FreeBSD, fixing couple of unit tests.

Patch by David CARLIER

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, kubamracek, krytarowski, llvm-commits, #sanitizers

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

llvm-svn: 327697

6 years agoMmap interceptor new option, Write Exec runtime detector
Vitaly Buka [Fri, 16 Mar 2018 08:22:18 +0000 (08:22 +0000)]
Mmap interceptor new option, Write Exec runtime detector

Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request.

Patch by David CARLIER

Reviewers: vitalybuka, vsk

Reviewed By: vitalybuka

Subscribers: krytarowski, #sanitizers

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

llvm-svn: 327696

6 years ago[ARM] FP16 codegen support for VSEL
Sjoerd Meijer [Fri, 16 Mar 2018 08:06:25 +0000 (08:06 +0000)]
[ARM] FP16 codegen support for VSEL

This implements lowering of SELECT_CC for f16s, which enables
codegen of VSEL with f16 types.

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

llvm-svn: 327695

6 years agoFix compilation warning introduced in r327654
Mikael Holmen [Fri, 16 Mar 2018 07:27:57 +0000 (07:27 +0000)]
Fix compilation warning introduced in r327654

The compiler complained about

../tools/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:184:15: error: unused variable 'CSI' [-Werror,-Wunused-variable]
    if (auto *CSI = CGF.CapturedStmtInfo) {
              ^
1 error generated.

I don't know this code but it seems like an easy fix so I push it anyway
to get rid of the warning.

llvm-svn: 327694

6 years ago[NFC] Void variables used for asserts only
Max Kazantsev [Fri, 16 Mar 2018 05:02:24 +0000 (05:02 +0000)]
[NFC] Void variables used for asserts only

llvm-svn: 327693

6 years agoSkip more lldb-mi tests which time out on Darwin
Vedant Kumar [Fri, 16 Mar 2018 04:11:03 +0000 (04:11 +0000)]
Skip more lldb-mi tests which time out on Darwin

Bot failure: https://ci.swift.org/job/oss-lldb-incremental-osx/1097/testReport/junit/TestMiTarget/MiTargetTestCase/test_lldbmi_target_attach_wait_for/

llvm-svn: 327692

6 years ago[cmake] Copy system debugserver from the right place when only CommandLineTools
Vedant Kumar [Fri, 16 Mar 2018 03:31:16 +0000 (03:31 +0000)]
[cmake] Copy system debugserver from the right place when only CommandLineTools
are installed

Instead of building debugserver when building lldb, I'd rather pass
LLDB_CODESIGN_IDENTITY="" to cmake and use the one already on my system.
However, on one of my machines I only have the CommandLineTools installed, and
so the hardcoded path to the system debugserver does not work for me.
Additionally, we should verify the LLDB framework exists on the machine before
trying to set the path to debugserver. This allows us to warn the user at
configure time that a system debugserver can't be found if they choose not to
build it themselves.

Patch by Alex Langford!

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

llvm-svn: 327691

6 years ago[demangler] Support for <template-param>s in generic lambdas.
Erik Pilkington [Fri, 16 Mar 2018 03:06:30 +0000 (03:06 +0000)]
[demangler] Support for <template-param>s in generic lambdas.

These <template-param>s refer to "artifical" <template-arg>s that don't appear
in the mangled name, so we just print them as "auto".

llvm-svn: 327690

6 years ago[InstCombine] add more tests for fcmp+select -> fabs; NFC
Sanjay Patel [Fri, 16 Mar 2018 01:06:33 +0000 (01:06 +0000)]
[InstCombine] add more tests for fcmp+select -> fabs; NFC

This should correspond to the patterns in D44091 and might
make handling these in the DAG unnecessary.

llvm-svn: 327689

6 years agoRevert r327248, "For most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to...
Peter Collingbourne [Fri, 16 Mar 2018 01:01:44 +0000 (01:01 +0000)]
Revert r327248, "For most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to be at"

This change broke ARM code that expects to be able to add
_GLOBAL_OFFSET_TABLE_ to the result of an R_ARM_REL32.

I will provide a reproducer on llvm-commits.

llvm-svn: 327688

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Mar 2018 00:37:51 +0000 (00:37 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 327687

6 years ago[X86][Btver2] Add support for multiple pipelines stages for x86 scalar schedules...
Simon Pilgrim [Thu, 15 Mar 2018 23:46:12 +0000 (23:46 +0000)]
[X86][Btver2] Add support for multiple pipelines stages for x86 scalar schedules. NFCI.

This allows us to use JWriteResIntPair for complex schedule classes (like WriteIDiv) as well as single pipe instructions.

llvm-svn: 327686

6 years ago[X86][Btver2] Tweak pipes test to remove register dependencies
Simon Pilgrim [Thu, 15 Mar 2018 23:15:11 +0000 (23:15 +0000)]
[X86][Btver2] Tweak pipes test to remove register dependencies

It gives us a better view of pipe usage in the timeline which is what the test is trying to show.

llvm-svn: 327685

6 years agoFix linker script operator precedence.
Rui Ueyama [Thu, 15 Mar 2018 23:12:33 +0000 (23:12 +0000)]
Fix linker script operator precedence.

"&" should have higher priority than "|" [1]. Previously, they had
the same priority.

[1] https://sourceware.org/binutils/docs/ld/Operators.html

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

llvm-svn: 327684

6 years ago[SelectionDAG][ARM][X86] Teach PromoteIntRes_SETCC to do a better job picking the...
Craig Topper [Thu, 15 Mar 2018 23:04:11 +0000 (23:04 +0000)]
[SelectionDAG][ARM][X86] Teach PromoteIntRes_SETCC to do a better job picking the result type for the setcc.

Previously if getSetccResultType returned an illegal type we just fell back to using the default promoted type. This appears to have been to handle the case where for vectors getSetccResultType returns the input type, but the input type itself isn't legal and will need to be promoted. Without the legality check we would never reach a legal type.

But just picking the promoted type to be the setcc type can create strange setccs where the result type is 128 bits and the operand type is 256 bits. If for example the result type was promoted to v8i16 from v8i1, but the input type was promoted from v8i23 to v8i32. We currently handle this with custom lowering code in X86.

This legality check also caused us reject the getSetccResultType when the input type needed to be widened or split. Even though that result wouldn't have caused legalization to get stuck.

This patch tries to fix this by detecting the getSetccResultType needs to be promoted. If its input type also needs to be promoted we'll try a ask for a new setcc result type based on its eventual promoted value. Otherwise we fall back to default type to promote to.

For any other illegal values we might get back from the initial call to getSetccResultType we just keep and allow it to be re-legalized later via splitting or widening or scalarizing.

llvm-svn: 327683

6 years ago[X86][Btver2] Fix ymm div/sqrt to use fmul unit
Simon Pilgrim [Thu, 15 Mar 2018 23:00:47 +0000 (23:00 +0000)]
[X86][Btver2] Fix ymm div/sqrt to use fmul unit

YMM FDiv/FSqrt are dispatched on pipe JFPU1 but should be performed on the JFPM unit - that is where most of the cycles are spent.

This matches the pipes for WriteFSqrt/WriteFDiv definitions.

llvm-svn: 327682

6 years agoUse standard `print(dbgs())` pattern to implement DebugLoc::dump
Sean Silva [Thu, 15 Mar 2018 22:51:55 +0000 (22:51 +0000)]
Use standard `print(dbgs())` pattern to implement DebugLoc::dump

The open-coded implementation had a bug. It didn't print filenames.

llvm-svn: 327681

6 years ago[InstCombine] add tests for fcmp+select -> fabs; NFC
Sanjay Patel [Thu, 15 Mar 2018 22:48:23 +0000 (22:48 +0000)]
[InstCombine] add tests for fcmp+select -> fabs; NFC

llvm-svn: 327680

6 years agoFix PDB injected sources test.
Zachary Turner [Thu, 15 Mar 2018 22:47:04 +0000 (22:47 +0000)]
Fix PDB injected sources test.

This test was originally disabled because it was failing on a bot.
It turns out I had run dos2unix on the file, and that removed a
necessary byte from the file.  I'm just recomitting the proper
file and updating the test to test a little bit more now.

llvm-svn: 327679

6 years agoMSan, FreeBSD few tests fixes
Vitaly Buka [Thu, 15 Mar 2018 22:41:28 +0000 (22:41 +0000)]
MSan, FreeBSD few tests fixes

Summary:
pthread_getattr_np_deadlock support
pthread_getname_np unsupported

Reviewers: krytarowski, vitalybuka

Reviewed By: vitalybuka

Subscribers: eugenis, srhines, krytarowski, llvm-commits, #sanitizers

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

llvm-svn: 327678