platform/upstream/llvm.git
6 years agoDR727: remove wrong assertion for use of class-scope explicit
Richard Smith [Mon, 23 Apr 2018 18:38:30 +0000 (18:38 +0000)]
DR727: remove wrong assertion for use of class-scope explicit
specialization without -fms-extensions.

llvm-svn: 330626

6 years ago[AArch64] Add cost model test case for transpose
Matthew Simpson [Mon, 23 Apr 2018 18:21:29 +0000 (18:21 +0000)]
[AArch64] Add cost model test case for transpose

This patch adds a cost model test case for vector shuffles having transpose
masks. The given costs are inaccurate and will be updated in a follow-on patch.

llvm-svn: 330625

6 years ago[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt).
Alex Shlyapnikov [Mon, 23 Apr 2018 18:19:23 +0000 (18:19 +0000)]
[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt).

Retire the fixed shadow memory mapping to avoid conflicts with default
process memory mapping (currently manifests on Android).

Tests on AArch64 show <1% performance loss and code size increase,
making it possible to use dynamic shadow memory by default.

Keep the fixed shadow memory mapping around to be able to run
performance comparison tests later.

Re-commiting D45847 with fixed shadow for x86-64.

llvm-svn: 330624

6 years ago[HWASan] Switch back to fixed shadow mapping for x86-64
Alex Shlyapnikov [Mon, 23 Apr 2018 18:14:39 +0000 (18:14 +0000)]
[HWASan] Switch back to fixed shadow mapping for x86-64

For now switch back to fixed shadow mapping for x86-64 due to the issues
with IFUNC linking on older binutils. More details will be added to
https://bugs.chromium.org/p/chromium/issues/detail?id=835864

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

llvm-svn: 330623

6 years agoImprove checks in test/Frontend/ftime-report-template-decl.cpp
Bjorn Pettersson [Mon, 23 Apr 2018 18:05:35 +0000 (18:05 +0000)]
Improve checks in test/Frontend/ftime-report-template-decl.cpp

Some buildbots seems to have problems with the CHECKs in
test/Frontend/ftime-report-template-decl.cpp.

I this the problem is that the order in which timers are printed
is based on consumed wall time. So there is no guarantee in which
order the timers are printed.

This patch uses CHECK-DAG instead of CHECK to make the test
case less sensitive to the actual time used by the different
passes.

The (sometimes) failing test cases where introduced in trunk@330571.

llvm-svn: 330622

6 years ago[X86] Add disassembler test cases for bswap.
Craig Topper [Mon, 23 Apr 2018 17:47:33 +0000 (17:47 +0000)]
[X86] Add disassembler test cases for bswap.

This demonstrates a bug where the encoding for a 16-bit bswap prints a 16-bit register and a 32-bit mnemonic. Intel docs say 16-bit bswap is undefined. We should either claim it as an invalid encoding or we should print a 16-bit mnemonic.

objdump does print the encoding as bswap with a 16-bit register. But it doesn't seem to ever print a suffix.

llvm-svn: 330621

6 years ago[OPENMP] Do not cast captured by value variables with pointer types in
Alexey Bataev [Mon, 23 Apr 2018 17:33:41 +0000 (17:33 +0000)]
[OPENMP] Do not cast captured by value variables with pointer types in
NVPTX target.

When generating the wrapper function for the offloading region, we need
to call the outlined function and cast the arguments correctly to follow
the ABI. Usually, variables captured by value are casted to `uintptr_t`
type. But this should not performed for the variables with pointer type.

llvm-svn: 330620

6 years agoRevert r330474 - "[HWASan] Introduce non-zero based and dynamic shadow memory (compil...
Reid Kleckner [Mon, 23 Apr 2018 17:26:33 +0000 (17:26 +0000)]
Revert r330474 - "[HWASan] Introduce non-zero based and dynamic shadow memory (compiler-rt)."

This commit causes internal errors with ld.bfd 2.24. My guess is that
the ifunc usage in this commit is causing problems. This is the default
system linker on Trusty Tahr, which is from 2014. I claim it's still in
our support window. Maybe we will decide to drop support for it, but
let's get the bots green while we do the investigation and have that
discussion.

Discovered here: https://crbug.com/835864

llvm-svn: 330619

6 years ago[SelectionDAG] Dump debug locs in SDNodes
Vedant Kumar [Mon, 23 Apr 2018 17:18:24 +0000 (17:18 +0000)]
[SelectionDAG] Dump debug locs in SDNodes

This helps debug issues where selection-dag assigns the wrong location
to an instruction.

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

llvm-svn: 330618

6 years ago[CMake] Add the missing `dsymutil` dependency when running tests.
Davide Italiano [Mon, 23 Apr 2018 17:06:55 +0000 (17:06 +0000)]
[CMake] Add the missing `dsymutil` dependency when running tests.

llvm-svn: 330617

6 years agoFix clang-cl warnings in compiler-rt
Reid Kleckner [Mon, 23 Apr 2018 17:05:47 +0000 (17:05 +0000)]
Fix clang-cl warnings in compiler-rt

The profile library was missing some includes and was erroneously using
ftruncate. WinASan was using `= {0}` to initialize structs, which
creates -Wmissing-field-initializers and -Wmissing-braces warnings with
clang. Use `= {}` instead, since this is C++.

llvm-svn: 330616

6 years ago[MC] Remove MachineInstr reference in MC layer (PR37160)
Simon Pilgrim [Mon, 23 Apr 2018 16:59:06 +0000 (16:59 +0000)]
[MC] Remove MachineInstr reference in MC layer (PR37160)

Only add support for getSchedInfoStr(const MachineInstr &MI) at the TargetSubtargetInfo level.

Really, the getSchedInfoStr calls need to be removed entirely, we should just return a latency/rthroughput through the subtarget and keep a string creation helper function somewhere else.

llvm-svn: 330615

6 years agoFix -Wtautological-compare warning with npos on Windows
Reid Kleckner [Mon, 23 Apr 2018 16:47:27 +0000 (16:47 +0000)]
Fix -Wtautological-compare warning with npos on Windows

llvm-svn: 330614

6 years agoQuick fix for rC330605: specify a target arch for test
Aleksei Sidorin [Mon, 23 Apr 2018 16:38:29 +0000 (16:38 +0000)]
Quick fix for rC330605: specify a target arch for test

llvm-svn: 330613

6 years agoAMDGPU: Move a flawed assert when spilling SGPRs
Matt Arsenault [Mon, 23 Apr 2018 16:13:30 +0000 (16:13 +0000)]
AMDGPU: Move a flawed assert when spilling SGPRs

It's possible to validly spill the frame offset register
in a call sequence to a VGPR. There are definitely issues
with SGPR spilling to memory, so move the assert later.

llvm-svn: 330612

6 years ago[X86] Replace x87 instregex with instrs if they only match one instruction
Simon Pilgrim [Mon, 23 Apr 2018 16:10:50 +0000 (16:10 +0000)]
[X86] Replace x87 instregex with instrs if they only match one instruction

llvm-svn: 330611

6 years agoFix computeSymbolSizes SEGFAULT on invalid file
Adrian Prantl [Mon, 23 Apr 2018 16:08:01 +0000 (16:08 +0000)]
Fix computeSymbolSizes SEGFAULT on invalid file

We use llvm-symbolizer in some production systems, and we run it
against all possibly related files, including some that are not
ELF. We noticed that for some of those invalid files, llvm-symbolizer
would crash with SEGFAULT. Here is an example of such a file.

It is due to that in computeSymbolSizes, a loop uses condition

  for (unsigned I = 0, N = Addresses.size() - 1; I < N; ++I) {

where if Addresses.size() is 0, N would overflow and causing the loop
to access invalid memory.

Instead of patching the loop conditions, the commit makes so that the
function returns early if Addresses is empty.

Validated by checking that llvm-symbolizer no longer crashes.

Patch by Teng Qin!

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

llvm-svn: 330610

6 years ago[clangd][tests] Fix delimiter handling
Jan Korous [Mon, 23 Apr 2018 15:58:42 +0000 (15:58 +0000)]
[clangd][tests] Fix delimiter handling

Empty line shouldn't be considered a delimiter

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

llvm-svn: 330609

6 years ago[clangd][tests] Fix handling of EOF in delimited input
Jan Korous [Mon, 23 Apr 2018 15:55:07 +0000 (15:55 +0000)]
[clangd][tests] Fix handling of EOF in delimited input

Request in delimited input ended by EOF shouldn't be an error state.
Comments at the end of test file shouldn't be logged as an error state.
Input mirroring should work for the last request in delimited test file.

llvm-svn: 330608

6 years agoAMDGPU: Assign enum name to stack ID
Matt Arsenault [Mon, 23 Apr 2018 15:51:26 +0000 (15:51 +0000)]
AMDGPU: Assign enum name to stack ID

Also assert that it is correct for SGPRs. There is currently a bug
where stack slot coloring replaces SGPR spill FIs with one with
the default ID, which results in a more confusing assert later
about a dead object.

llvm-svn: 330607

6 years agoStackSlotColoring: Fix missing skipFunction check
Matt Arsenault [Mon, 23 Apr 2018 15:51:21 +0000 (15:51 +0000)]
StackSlotColoring: Fix missing skipFunction check

llvm-svn: 330606

6 years ago[analyzer] Don't crash on printing ConcreteInt of size >64 bits
Aleksei Sidorin [Mon, 23 Apr 2018 15:41:44 +0000 (15:41 +0000)]
[analyzer] Don't crash on printing ConcreteInt of size >64 bits

Printing of ConcreteInts with size >64 bits resulted in assertion failure
in get[Z|S]ExtValue() because these methods are only allowed to be used
with integers of 64 max bit width. This patch fixes the issue.

llvm-svn: 330605

6 years agoFix case of LLVM library names.
Nico Weber [Mon, 23 Apr 2018 15:41:08 +0000 (15:41 +0000)]
Fix case of LLVM library names.

llvm-svn: 330604

6 years ago[SelectionDAG] Refactor lowering of atomic memory intrinsics.
Daniel Neilson [Mon, 23 Apr 2018 15:40:37 +0000 (15:40 +0000)]
[SelectionDAG] Refactor lowering of atomic memory intrinsics.

Summary:
This just refactors the lowering of the atomic memory intrinsics to more
closely match the code patterns used in the lowering of the non-atomic
memory intrinsics. Specifically, we encapsulate the lowering in
SelectionDAG::getAtomicMem*() functions rather than embedding
the code directly in the SelectionDAGBuilder code.

llvm-svn: 330603

6 years ago[clangd] Fix Context::derive to actually call the right method.
Benjamin Kramer [Mon, 23 Apr 2018 15:27:42 +0000 (15:27 +0000)]
[clangd] Fix Context::derive to actually call the right method.

C++ is weird.

llvm-svn: 330602

6 years agoRemove unused code (made unused by r161073, and later more so by r248043).
Nico Weber [Mon, 23 Apr 2018 15:26:15 +0000 (15:26 +0000)]
Remove unused code (made unused by r161073, and later more so by r248043).

llvm-svn: 330601

6 years ago[PPC64] Fix toc restore nops offset for V2 ABI
Zaara Syeda [Mon, 23 Apr 2018 15:01:24 +0000 (15:01 +0000)]
[PPC64] Fix toc restore nops offset for V2 ABI

The PPC64 V2 ABI restores the toc base by loading from an offset of 24 from r1.
This patch fixes the offset and updates the testcases from V1 to V2. It also
issues an error when a nop is missing after a call to an external function.

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

llvm-svn: 330600

6 years ago[clangd] Prune some dead declarations. No functionality change.
Benjamin Kramer [Mon, 23 Apr 2018 14:58:18 +0000 (14:58 +0000)]
[clangd] Prune some dead declarations. No functionality change.

llvm-svn: 330599

6 years ago[scudo] Read ARM feature bits using Fuchsia APIs.
Kostya Kortchinsky [Mon, 23 Apr 2018 14:53:13 +0000 (14:53 +0000)]
[scudo] Read ARM feature bits using Fuchsia APIs.

Summary:
    Fuchsia uses zx_system_get_features in lieu of getauxval.

    Use this call when checking for CRC32 support.

Reviewers: cryptoad

Reviewed By: cryptoad

Subscribers: delcypher, llvm-commits, #sanitizers, kristof.beyls, chrib

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

llvm-svn: 330598

6 years ago[ELF] - Simplify. NFC.
George Rimar [Mon, 23 Apr 2018 14:41:49 +0000 (14:41 +0000)]
[ELF] - Simplify. NFC.

llvm-svn: 330597

6 years ago[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisit...
Henry Wong [Mon, 23 Apr 2018 14:41:17 +0000 (14:41 +0000)]
[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisitors.h`.

Summary: `TaintBugVisitor` is a universal visitor, and many checkers rely on it, such as `ArrayBoundCheckerV2.cpp`, `DivZeroChecker.cpp` and `VLASizeChecker.cpp`. Moving `TaintBugVisitor` to `BugReporterVisitors.h` enables other checker can also track where `tainted` value came from.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC

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

llvm-svn: 330596

6 years ago[index] Fix methods that take a shared_ptr to just take a reference.
Benjamin Kramer [Mon, 23 Apr 2018 14:30:21 +0000 (14:30 +0000)]
[index] Fix methods that take a shared_ptr to just take a reference.

There is no ownership here, passing a shared_ptr just adds confusion. No
functionality change intended.

llvm-svn: 330595

6 years ago[LLVM-C] DIBuilderBindings for Subrange and Arrays
Robert Widmann [Mon, 23 Apr 2018 14:29:33 +0000 (14:29 +0000)]
[LLVM-C] DIBuilderBindings for Subrange and Arrays

Summary: Move Go bindings for subranges and DINode arrays.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 330594

6 years agoSort a target list a bit better.
Nico Weber [Mon, 23 Apr 2018 14:28:49 +0000 (14:28 +0000)]
Sort a target list a bit better.

llvm-svn: 330593

6 years ago[DEBUGINFO, NVPTX] Add the test for the debug info of the local
Alexey Bataev [Mon, 23 Apr 2018 14:00:53 +0000 (14:00 +0000)]
[DEBUGINFO, NVPTX] Add the test for the debug info of the local
variables, NFC.

llvm-svn: 330592

6 years ago[LLVM-C] Finish Up Scope Bindings
Robert Widmann [Mon, 23 Apr 2018 13:51:43 +0000 (13:51 +0000)]
[LLVM-C] Finish Up Scope Bindings

Summary: Adds bindings for Module and NameSpace scopes and LLVMDIBuilderCreateForwardDecl, a counterpart to LLVMDIBuilderCreateReplaceableCompositeType.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 330591

6 years ago[doc] Removed obsolete -count-aa from AliasAnalysis documentation
Marianne Mailhot-Sarrasin [Mon, 23 Apr 2018 13:45:28 +0000 (13:45 +0000)]
[doc] Removed obsolete -count-aa from AliasAnalysis documentation

Summary:
This patch removes references to AliasAnalysisCounter pass from the AliasAnalysis documentation. That pass have been eliminated in 2015, at revision trunk@247167.

Reviewed By: hfinkel

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

llvm-svn: 330590

6 years ago[analyzer] CStringChecker.cpp - Code refactoring on bug report.
Henry Wong [Mon, 23 Apr 2018 13:36:51 +0000 (13:36 +0000)]
[analyzer] CStringChecker.cpp - Code refactoring on bug report.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

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

llvm-svn: 330589

6 years ago[X86] Remove instregex matching from CLAC/STAC.
Simon Pilgrim [Mon, 23 Apr 2018 13:24:17 +0000 (13:24 +0000)]
[X86] Remove instregex matching from CLAC/STAC.

Note - noticed this as the STAC case as it was unintentionally matching against *STACK* pseudo instructions.

llvm-svn: 330588

6 years agoList cpp file only once (was added in 147117 and 147117 as build fix each).
Nico Weber [Mon, 23 Apr 2018 13:11:51 +0000 (13:11 +0000)]
List cpp file only once (was added in 147117 and 147117 as build fix each).

llvm-svn: 330587

6 years agoAMDGPU: Fix SDWA peephole for V_AND_B32
Nicolai Haehnle [Mon, 23 Apr 2018 13:06:03 +0000 (13:06 +0000)]
AMDGPU: Fix SDWA peephole for V_AND_B32

Summary:
Found by inspection. We care about the operand that *doesn't*
contain the immediate.

I believe this is currently not hit because we fold 0xff / 0xffff
immediates only later.

Change-Id: Ic3cf8538bc7da5eff3200d96eccf9d339e6345a7

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 330586

6 years agoAMDGPU: Fix a corner case crash in SIOptimizeExecMasking
Nicolai Haehnle [Mon, 23 Apr 2018 13:05:50 +0000 (13:05 +0000)]
AMDGPU: Fix a corner case crash in SIOptimizeExecMasking

Summary:
See the new test case; this is really unlikely to happen with real code,
but I ran into this while attempting to bugpoint-reduce a different issue.

Change-Id: I9ade1dc1aa8fd9c4d9fc83661d7b80e310b5c4a6

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 330585

6 years agoConsistently sort add_subdirectory calls in lib/Target/*/CMakeLists.txt
Nico Weber [Mon, 23 Apr 2018 12:49:34 +0000 (12:49 +0000)]
Consistently sort add_subdirectory calls in lib/Target/*/CMakeLists.txt

llvm-svn: 330584

6 years ago[AArch64][SVE] Asm: Support for contiguous, non-faulting LDNF1 (scalar+imm) load...
Sander de Smalen [Mon, 23 Apr 2018 12:43:19 +0000 (12:43 +0000)]
[AArch64][SVE] Asm: Support for contiguous, non-faulting LDNF1 (scalar+imm) load instructions

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: rengolin

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330583

6 years ago[LoopRotate] Fix incorrect SCEV invalidation in loop rotation
Max Kazantsev [Mon, 23 Apr 2018 12:33:31 +0000 (12:33 +0000)]
[LoopRotate] Fix incorrect SCEV invalidation in loop rotation

LoopRotate only invalidates innermost loops while the changes that it makes may
also affert any of this parents. With patch rL329047, SCEV becomes much smarter
about calculation of exit counts for outer loops, so we cannot assume that they are
not affected.

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

llvm-svn: 330582

6 years ago[X86] Remove unnecessary MMX reg-mem InstRW scheduler overrides.
Simon Pilgrim [Mon, 23 Apr 2018 11:57:15 +0000 (11:57 +0000)]
[X86] Remove unnecessary MMX reg-mem InstRW scheduler overrides.

llvm-svn: 330581

6 years agoFix tests after changes to clang-format in r330573.
Manuel Klimek [Mon, 23 Apr 2018 11:47:59 +0000 (11:47 +0000)]
Fix tests after changes to clang-format in r330573.

We do now both:
- stop reformatting a sequence after a closing brace in more cases, in
  order to not misindent after an incorrect closing brace
- format the closing brace when formatting the line containing the
  opening brace

llvm-svn: 330580

6 years ago[OpenCL] Reject virtual functions for OpenCL C++
Sven van Haastregt [Mon, 23 Apr 2018 11:23:47 +0000 (11:23 +0000)]
[OpenCL] Reject virtual functions for OpenCL C++

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

llvm-svn: 330579

6 years agollgs-tests: Increase packet time out
Pavel Labath [Mon, 23 Apr 2018 11:22:44 +0000 (11:22 +0000)]
llgs-tests: Increase packet time out

The default packet timeout of 1 second is a bit too small for these
tests, particularly as they are working in ack-mode, which means they
need to fit twice as many packets into the timeslot.

This does not seem to be a problem on the bots, but for some people
these tests are timing out regularly. I can't be sure increasing this
will solve their problem, but this does seem like a likely culprit.

llvm-svn: 330578

6 years ago[LoopUnroll] Fix potentially incorrect SCEV invalidation in UnrollRuntime
Max Kazantsev [Mon, 23 Apr 2018 10:39:38 +0000 (10:39 +0000)]
[LoopUnroll] Fix potentially incorrect SCEV invalidation in UnrollRuntime

Current runtime unrolling invalidates parent loop saying that it might have changed
after the inner loop has changed, but it doesn't bother to do the same to its parents.
With patch rL329047, SCEV becomes much smarter about calculation of exit counts for
outer loops. We might need to invalidate not only the immediate parent, but also
any of its parents as well.

There is no clear evidence that there is some miscompile happening because of this
(at least I don't have such test), but the common sense says that the current code
is wrong.

Differential Revision: https://reviews.llvm.org/D45940
Reviewed By: chandlerc

llvm-svn: 330577

6 years ago[LoopSimplify] Fix incorrect SCEV invalidation
Max Kazantsev [Mon, 23 Apr 2018 10:32:37 +0000 (10:32 +0000)]
[LoopSimplify] Fix incorrect SCEV invalidation

In the function `simplifyOneLoop` we optimistically assume that changes in the
inner loop only affect this very loop and have no impact on its parents. In fact,
after rL329047 has been merged, we can now calculate exit counts for outer
loops which may depend on inner loops. Thus, we need to invalidate all parents
when we do something to a loop.

There is an evidence of incorrect behavior of `simplifyOneLoop`: when we insert
`SE->verify()` check in the end of this funciton, it fails on a bunch of existing
test, in particular:

    LLVM :: Transforms/LoopUnroll/peel-loop-not-forced.ll
    LLVM :: Transforms/LoopUnroll/peel-loop-pgo.ll
    LLVM :: Transforms/LoopUnroll/peel-loop.ll
    LLVM :: Transforms/LoopUnroll/peel-loop2.ll

Note that previously we have fixed issues of this variety, see rL328483.
This patch makes this function invalidate the outermost loop properly.

Differential Revision: https://reviews.llvm.org/D45937
Reviewed By: chandlerc

llvm-svn: 330576

6 years ago[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident
Mikhail Maltsev [Mon, 23 Apr 2018 10:08:46 +0000 (10:08 +0000)]
[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident

The test case in the original patch was overly contrained and
failed on PPC targets.

llvm-svn: 330575

6 years ago[clang-format] Fix clang-tidy readability problems, NFCI
Krasimir Georgiev [Mon, 23 Apr 2018 10:02:59 +0000 (10:02 +0000)]
[clang-format] Fix clang-tidy readability problems, NFCI

llvm-svn: 330574

6 years agoFormat closing braces when reformatting the line containing the opening brace.
Manuel Klimek [Mon, 23 Apr 2018 09:34:26 +0000 (09:34 +0000)]
Format closing braces when reformatting the line containing the opening brace.

This required a couple of yaks to be shaved:
1. MatchingOpeningBlockLineIndex was misused to also store the
   closing index; instead, use a second variable, as this doesn't
   work correctly for "} else {".
2. We needed to change the API of AffectedRangeManager to not
   use iterators; we always passed in begin / end for the whole
   container before, so there was no mismatch in generality.
3. We need an extra check to discontinue formatting at the top
   level, as we now sometimes change the indent of the closing
   brace, but want to bail out immediately afterwards, for
   example:
     void f() {
       if (a) {
     }
     void g();
   Previously:
     void f() {
       if (a) {
     }
     void g();
   Now:
     void f() {
       if (a) {
       }
     void g();

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

llvm-svn: 330573

6 years ago[Solaris] __float128 is supported on Solaris/x86
Rainer Orth [Mon, 23 Apr 2018 09:28:08 +0000 (09:28 +0000)]
[Solaris] __float128 is supported on Solaris/x86

When rebasing https://reviews.llvm.org/D40898 with GCC 5.4 on Solaris 11.4, I ran
into a few instances of

In file included from /vol/llvm/src/compiler-rt/local/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc:19:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/string:40:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/char_traits.h:39:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:64:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_pair.h:59:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/move.h:57:
/usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/type_traits:311:39: error: __float128 is not supported on this target

  struct __is_floating_point_helper<__float128>
                                    ^

during make check-all.  The line above is inside

#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)

  template<>
    struct __is_floating_point_helper<__float128>
    : public true_type { };

#endif

While the libstdc++ header indicates support for __float128, clang does not, but
should.  The following patch implements this and fixed those errors.

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

llvm-svn: 330572

6 years agoUse special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEna...
Andrew V. Tischenko [Mon, 23 Apr 2018 09:22:30 +0000 (09:22 +0000)]
Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature.
Differential Revision: https://reviews.llvm.org/D45619

llvm-svn: 330571

6 years agoFix BNF nits in TableGen language reference.
Simon Tatham [Mon, 23 Apr 2018 09:15:47 +0000 (09:15 +0000)]
Fix BNF nits in TableGen language reference.

Summary:
In the course of writing an experimental ANTLR grammar based on this
document, I found three errors in the documented BNF:

SimpleValues of dag type are allowed to have no operands at all after
the initial DagArg specifying the operator. For example, the value
(outs) is extremely common in backends; an example in the test suite
is test/TableGen/AsmVariant.td line 30. But the BNF doesn't allow
DagArgList to expand to the empty string (it must contain at least one
DagArg), and therefore the DagArgList specifying the operands in the
dag-shaped production for SimpleValue should be optional.

In the production for BodyItem with a 'let' and an optional RangeList,
the RangeList should have braces around it if it's present, matching
code such as "let E{7-0} = ..." on test/TableGen/BitsInit.td line 42.
Those braces aren't included in the RangeList nonterminal itself, so
instead they need to be part of the optional segment of the BodyItem
production.

Finally, the identifier after 'defm' should be optional. Again, this
is very common in the real back end .td files; an example in the test
suite is in test/TableGen/defmclass.td line 49.

Reviewers: rengolin, nhaehnle, stoklund

Reviewed By: nhaehnle

Subscribers: llvm-commits

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

llvm-svn: 330570

6 years agoRevert "[clang-format] Improve Incomplete detection for (text) protos"
Krasimir Georgiev [Mon, 23 Apr 2018 08:50:36 +0000 (08:50 +0000)]
Revert "[clang-format] Improve Incomplete detection for (text) protos"

This reverts commit r330016.
The incomplete detection has too many false positives, picking up typos
for hard failures and refusing to format anything in that case.

llvm-svn: 330569

6 years ago[CMake] Gate 'dsymutil' dependency
Jonas Devlieghere [Mon, 23 Apr 2018 08:44:06 +0000 (08:44 +0000)]
[CMake] Gate 'dsymutil' dependency

Only add `dsymutil` as a test dependency when this is not a stand-alone
build (LLDB_BUILT_STANDALONE).

llvm-svn: 330568

6 years agoTest commit access.
Simon Tatham [Mon, 23 Apr 2018 08:41:53 +0000 (08:41 +0000)]
Test commit access.

Should be a harmless trimming of trailing whitespace from a
documentation file.

(There are other instances of trailing whitespace in this file alone.
I've only fixed one of them, on the basis that that way the rest are
still available for other people's commit-access tests :-)

llvm-svn: 330567

6 years ago[Atomics] warn about atomic accesses using libcalls
Tim Northover [Mon, 23 Apr 2018 08:16:24 +0000 (08:16 +0000)]
[Atomics] warn about atomic accesses using libcalls

If an atomic variable is misaligned (and that suspicion is why Clang emits
libcalls at all) the runtime support library will have to use a lock to safely
access it, with potentially very bad performance consequences. There's a very
good chance this is unintentional so it makes sense to issue a warning.

Also give it a named group so people can promote it to an error, or disable it
if they really don't care.

llvm-svn: 330566

6 years ago[AArch64][SVE] Asm: Support for structured ST2, ST3 and ST4 (scalar+imm) store instru...
Sander de Smalen [Mon, 23 Apr 2018 07:50:35 +0000 (07:50 +0000)]
[AArch64][SVE] Asm: Support for structured ST2, ST3 and ST4 (scalar+imm) store instructions.

Reviewers: fhahn, rengolin, javed.absar, SjoerdMeijer, t.p.northover, echristo, evandro, huntergr

Reviewed By: rengolin

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330565

6 years ago[PM/LoopUnswitch] Remove a buggy assert in the new loop unswitch.
Chandler Carruth [Mon, 23 Apr 2018 06:58:36 +0000 (06:58 +0000)]
[PM/LoopUnswitch] Remove a buggy assert in the new loop unswitch.

The condition this was asserting doesn't actually hold. I've added
comments to explain why, removed the assert, and added a fun test case
reduced out of 403.gcc.

llvm-svn: 330564

6 years ago[X86] Add VEX_WIG to VEX encoded version of VCMPPSY/VCMPPDY.
Craig Topper [Mon, 23 Apr 2018 04:50:01 +0000 (04:50 +0000)]
[X86] Add VEX_WIG to VEX encoded version of VCMPPSY/VCMPPDY.

llvm-svn: 330563

6 years agoupdate readability-identifier-naming-objc test to use interface ivar. Implementation...
Yan Zhang [Mon, 23 Apr 2018 01:05:02 +0000 (01:05 +0000)]
update readability-identifier-naming-objc test to use interface ivar. Implementation ivars are not supported in 32-bits OS.

Reviewers: alexfh, chandlerc

Subscribers: klimek, cfe-commits

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

llvm-svn: 330562

6 years ago[XRay] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Mon, 23 Apr 2018 00:49:25 +0000 (00:49 +0000)]
[XRay] Change std::sort to llvm::sort in response to r327219

r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

llvm-svn: 330561

6 years ago[PM/LoopUnswitch] Fix comment typo. NFC.
Chandler Carruth [Mon, 23 Apr 2018 00:48:42 +0000 (00:48 +0000)]
[PM/LoopUnswitch] Fix comment typo. NFC.

llvm-svn: 330560

6 years agoupdate test to use ivar in implementation instead of class extension
Yan Zhang [Mon, 23 Apr 2018 00:15:15 +0000 (00:15 +0000)]
update test to use ivar in implementation instead of class extension

Summary: using ivar in class extension is not supported in 32-bit architecture of MacOS.

Reviewers: alexfh, hokein

Reviewed By: alexfh

Subscribers: klimek, cfe-commits

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

llvm-svn: 330559

6 years ago[X86][Znver1] Remove unnecessary BMI1 ANDN InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 21:37:08 +0000 (21:37 +0000)]
[X86][Znver1] Remove unnecessary BMI1 ANDN InstRW overrides.

llvm-svn: 330558

6 years ago[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677
Jonathan Coe [Sun, 22 Apr 2018 20:51:05 +0000 (20:51 +0000)]
[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677

Summary:
In cindex.py, Cursor.result_type called into the wrong libclang
function, causing cursors for ObjC method declarations to return invalid
result types. Fixes Bug 36677.

Reviewers: jbcoe, rsmith

Reviewed By: jbcoe

Subscribers: cfe-commits, llvm-commits

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

Patch by kjteske (Kyle Teske).

llvm-svn: 330557

6 years ago[llvm-mca][X86] Add BMI/LZCNT/POPCNT resource tests to all relevant models
Simon Pilgrim [Sun, 22 Apr 2018 20:42:24 +0000 (20:42 +0000)]
[llvm-mca][X86] Add BMI/LZCNT/POPCNT resource tests to all relevant models

The SandyBridge BMI tests are actually run on IvyBridge as that's the first lowest CPU that actually support the ISAs (but still use the SandyBridge model).

llvm-svn: 330556

6 years ago[LLVM-C] Add DIBuilder Bindings For Variable Creation
Robert Widmann [Sun, 22 Apr 2018 19:24:44 +0000 (19:24 +0000)]
[LLVM-C] Add DIBuilder Bindings For Variable Creation

Summary: Wrap LLVMDIBuilderCreateAutoVariable, LLVMDIBuilderCreateParameterVariable, LLVMDIBuilderCreateExpression, and move and correct LLVMDIBuilderInsertDeclareBefore and LLVMDIBuilderInsertDeclareAtEnd from the Go bindings to the C bindings.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: harlanhaskins, whitequark

Subscribers: llvm-commits

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

llvm-svn: 330555

6 years ago[X86] Remove unnecessary WriteFBlend/WriteBlend InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 18:35:53 +0000 (18:35 +0000)]
[X86] Remove unnecessary WriteFBlend/WriteBlend InstRW overrides.

Fixed a lot of the default classes which were being completely overridden.

llvm-svn: 330554

6 years ago[X86] Remove unnecessary WriteFMul/WriteFRcp/WriteFRsqrt InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 18:09:50 +0000 (18:09 +0000)]
[X86] Remove unnecessary WriteFMul/WriteFRcp/WriteFRsqrt InstRW overrides.

llvm-svn: 330553

6 years ago[X86] Remove unnecessary CVT instrw overrides.
Simon Pilgrim [Sun, 22 Apr 2018 17:54:58 +0000 (17:54 +0000)]
[X86] Remove unnecessary CVT instrw overrides.

llvm-svn: 330552

6 years agoTest commit access.
Andres Freund [Sun, 22 Apr 2018 17:53:34 +0000 (17:53 +0000)]
Test commit access.

Remove trailing whitespace.

llvm-svn: 330551

6 years ago[PatternMatch] allow undef elements when matching a vector zero
Sanjay Patel [Sun, 22 Apr 2018 17:07:44 +0000 (17:07 +0000)]
[PatternMatch] allow undef elements when matching a vector zero

This is the last step in getting constant pattern matchers to allow
undef elements in constant vectors.

I'm adding a dedicated m_ZeroInt() function and building m_Zero() from
that. In most cases, calling code can be updated to use m_ZeroInt()
directly when there's no need to match pointers, but I'm leaving that
efficiency optimization as a follow-up step because it's not always
clear when that's ok.

There are just enough icmp folds in InstSimplify that can be used for
integer or pointer types, that we probably still want a generic m_Zero()
for those cases. Otherwise, we could eliminate it (and possibly add a
m_NullPtr() as an alias for isa<ConstantPointerNull>()).

We're conservatively returning a full zero vector (zeroinitializer) in
InstSimplify/InstCombine on some of these folds (see diffs in InstSimplify),
but I'm not sure if that's actually necessary in all cases. We may be
able to propagate an undef lane instead. One test where this happens is
marked with 'TODO'.

llvm-svn: 330550

6 years ago[X86][SkylakeServer] Remove unnecessary PMULLD instrw overrides.
Simon Pilgrim [Sun, 22 Apr 2018 16:51:12 +0000 (16:51 +0000)]
[X86][SkylakeServer] Remove unnecessary PMULLD instrw overrides.

llvm-svn: 330549

6 years ago[X86][Atom] Remove unnecessary scalar/vector load/move instrw overrides.
Simon Pilgrim [Sun, 22 Apr 2018 16:49:35 +0000 (16:49 +0000)]
[X86][Atom] Remove unnecessary scalar/vector load/move instrw overrides.

llvm-svn: 330548

6 years ago[InstCombine] add vector test with undef elts; NFC
Sanjay Patel [Sun, 22 Apr 2018 15:59:14 +0000 (15:59 +0000)]
[InstCombine] add vector test with undef elts; NFC

llvm-svn: 330547

6 years ago[X86] Fix (completely overridden) WriteFHAdd/WritePHAdd classes to allow us to remove...
Simon Pilgrim [Sun, 22 Apr 2018 15:25:59 +0000 (15:25 +0000)]
[X86] Fix (completely overridden) WriteFHAdd/WritePHAdd classes to allow us to remove unnecessary instrw overrides.

llvm-svn: 330546

6 years ago[X86][MMX][SSE] Tag missed PHADD/PHSUB instructions with WritePHAdd
Simon Pilgrim [Sun, 22 Apr 2018 15:02:23 +0000 (15:02 +0000)]
[X86][MMX][SSE] Tag missed PHADD/PHSUB instructions with WritePHAdd

llvm-svn: 330545

6 years ago[X86] Remove unnecessary WriteFVarBlend/WriteVarBlend InstRW overrides.
Simon Pilgrim [Sun, 22 Apr 2018 14:43:12 +0000 (14:43 +0000)]
[X86] Remove unnecessary WriteFVarBlend/WriteVarBlend InstRW overrides.

This also fixes some of the ReadAfterLd issues due to InstRW.

llvm-svn: 330544

6 years ago[InstSimplify, InstCombine] add vector tests with undef elts; NFC
Sanjay Patel [Sun, 22 Apr 2018 14:19:37 +0000 (14:19 +0000)]
[InstSimplify, InstCombine] add vector tests with undef elts; NFC

llvm-svn: 330543

6 years ago[X86] Fix WriteMPSAD/WritePSADBW values to allow us to remove unnecessary instrw...
Simon Pilgrim [Sun, 22 Apr 2018 10:39:16 +0000 (10:39 +0000)]
[X86] Fix WriteMPSAD/WritePSADBW values to allow us to remove unnecessary instrw overrides.

llvm-svn: 330542

6 years ago[X86][SandyBridge] Remove unnecessary WritePOPCNTLd overrides by fixing load latency.
Simon Pilgrim [Sun, 22 Apr 2018 10:03:52 +0000 (10:03 +0000)]
[X86][SandyBridge] Remove unnecessary WritePOPCNTLd overrides by fixing load latency.

llvm-svn: 330541

6 years ago[llvm-mca][X86] Add POPCNT resource test
Simon Pilgrim [Sun, 22 Apr 2018 09:58:00 +0000 (09:58 +0000)]
[llvm-mca][X86] Add POPCNT resource test

llvm-svn: 330540

6 years ago[test] Fix MC/ELF/nocompression.s
Jonas Devlieghere [Sun, 22 Apr 2018 08:46:27 +0000 (08:46 +0000)]
[test] Fix MC/ELF/nocompression.s

Unbreak the linux build bots:
  http://lab.llvm.org:8011/builders/clang-lld-x86_64-2stage/builds/5165/
  http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/28775
  http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/8227

llvm-svn: 330539

6 years ago[lli] Fix syntax error: missing ';'
Jonas Devlieghere [Sun, 22 Apr 2018 08:35:00 +0000 (08:35 +0000)]
[lli] Fix syntax error: missing ';'

Fixes build issue on the windows bots:
  error C2143: syntax error: missing ';'

llvm-svn: 330538

6 years ago[lli] Make error handling more consistent.
Jonas Devlieghere [Sun, 22 Apr 2018 08:02:11 +0000 (08:02 +0000)]
[lli] Make error handling more consistent.

Makes error handling more consistent by using the helpers in support.

llvm-svn: 330537

6 years ago[llvm-mc] Make error handling more consistent.
Jonas Devlieghere [Sun, 22 Apr 2018 08:01:35 +0000 (08:01 +0000)]
[llvm-mc] Make error handling more consistent.

Makes error handling more consistent by using the helpers in support.

llvm-svn: 330536

6 years ago[Support] Fix prefix logic in WithColor.
Jonas Devlieghere [Sun, 22 Apr 2018 08:01:01 +0000 (08:01 +0000)]
[Support] Fix prefix logic in WithColor.

When a prefix is passed, we need to print a colon a space after it, not
just the prefix.

llvm-svn: 330535

6 years ago[X86] Remove an unnecessary HANDLE_OPTIONAL line from the disassembler operand proces...
Craig Topper [Sun, 22 Apr 2018 06:40:37 +0000 (06:40 +0000)]
[X86] Remove an unnecessary HANDLE_OPTIONAL line from the disassembler operand processing.

llvm-svn: 330534

6 years ago[X86] Change TB to PS on LFENCE instruction.
Craig Topper [Sun, 22 Apr 2018 03:15:02 +0000 (03:15 +0000)]
[X86] Change TB to PS on LFENCE instruction.

This matches the other FENCE instructions.

llvm-svn: 330533

6 years ago[X86] Remove OpSizeIgnore, it's not implemented any differently than OpSizeFixed.
Craig Topper [Sun, 22 Apr 2018 01:24:58 +0000 (01:24 +0000)]
[X86] Remove OpSizeIgnore, it's not implemented any differently than OpSizeFixed.

llvm-svn: 330532

6 years ago[X86] Remove DATA32_PREFIX. Hack the printing for DATA16_PREFIX to print 'data32...
Craig Topper [Sun, 22 Apr 2018 00:52:02 +0000 (00:52 +0000)]
[X86] Remove DATA32_PREFIX. Hack the printing for DATA16_PREFIX to print 'data32' in 16-bit mode. Hack the asm parser to convert 'data32' to 'data16' in 16-bit mode.

Improve the error messages to match GNU assembler.

This also allows us to remove the hack from the disassembler table building.

llvm-svn: 330531

6 years agoAdd tests for llvm-bcanalyzer stream types
Brian Gesiak [Sun, 22 Apr 2018 00:04:35 +0000 (00:04 +0000)]
Add tests for llvm-bcanalyzer stream types

Summary:
Add tests for the improved stream type detection added to
`llvm-bcanalyzer` in https://reviews.llvm.org/D41979.

Test Plan: `check-clang`

Reviewers: pcc, aprantl, mehdi_amini, george.karpenkov

Reviewed By: aprantl

Subscribers: cfe-commits, a.sidorin

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

llvm-svn: 330530

6 years ago[bcanalyzer] Recognize more stream types
Brian Gesiak [Sat, 21 Apr 2018 23:52:04 +0000 (23:52 +0000)]
[bcanalyzer] Recognize more stream types

Summary:
`llvm-bcanalyzer` prints out the stream type of the file it is
analyzing. If the file begins with the LLVM IR magic number, it reports
a stream type of "LLVM IR". However, any other bitstream format is
reported as "unknown".

Add some checks for two other common bitstream formats: Clang AST
files, which begin with 'CPCH', and Clang serialized diagnostics, which
begin with 'DIAG'.

Test Plan: `check-llvm`

Reviewers: pcc, aprantl, mehdi_amini, davide, george.karpenkov, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, bruno, davide, llvm-commits

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

llvm-svn: 330529

6 years agoRevert r330492: [clang-tidy] add new check to find out objc ivars which do not have...
Chandler Carruth [Sat, 21 Apr 2018 23:27:34 +0000 (23:27 +0000)]
Revert r330492: [clang-tidy] add new check to find out objc ivars which do not have prefix '_'

This commit has been breaking most bots for a day now. There is a fix
proposed in https://reviews.llvm.org/D45912 but when I applied that
I just got different errors. Reverting to get our bots back to green.

llvm-svn: 330528

6 years ago[X86] Strip unnecessary prefetch + vector move/load instrw overrides from scheduler...
Simon Pilgrim [Sat, 21 Apr 2018 21:59:36 +0000 (21:59 +0000)]
[X86] Strip unnecessary prefetch + vector move/load instrw overrides from scheduler models.

llvm-svn: 330527