platform/upstream/llvm.git
5 years agoRevert r350647: "[NewPM] Port tsan"
Florian Hahn [Wed, 9 Jan 2019 13:32:16 +0000 (13:32 +0000)]
Revert r350647: "[NewPM] Port tsan"

This patch breaks thread sanitizer on some macOS builders, e.g.
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/52725/

llvm-svn: 350719

5 years agoRevert r350648: "Fix clang for r350647: Missed a function rename"
Florian Hahn [Wed, 9 Jan 2019 13:30:47 +0000 (13:30 +0000)]
Revert r350648: "Fix clang for r350647: Missed a function rename"

The related commit r350647 breaks thread sanitizer on some macOS builders, e.g.
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/52725/

llvm-svn: 350718

5 years ago[test] Detect glibc-2.27+ and XFAIL appropriate tests
Michal Gorny [Wed, 9 Jan 2019 13:27:29 +0000 (13:27 +0000)]
[test] Detect glibc-2.27+ and XFAIL appropriate tests

XFAIL the tests known to fail with glibc-2.27+.  This takes away
the burden of handling known failures from users, and ensures that
we will be verbosely informed when they actually start working again.

Bug report: https://bugs.llvm.org/show_bug.cgi?id=37804

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

llvm-svn: 350717

5 years ago[X86] Enable combining shuffles to PACKSS/PACKUS for 256/512-bit vectors
Simon Pilgrim [Wed, 9 Jan 2019 13:23:28 +0000 (13:23 +0000)]
[X86] Enable combining shuffles to PACKSS/PACKUS for 256/512-bit vectors

llvm-svn: 350716

5 years agoFix clang-tidy test after r350714. NFC
Ilya Biryukov [Wed, 9 Jan 2019 13:08:31 +0000 (13:08 +0000)]
Fix clang-tidy test after r350714. NFC

llvm-svn: 350715

5 years ago[Driver] Fix libcxx detection on Darwin with clang run as ./clang
Ilya Biryukov [Wed, 9 Jan 2019 13:08:11 +0000 (13:08 +0000)]
[Driver] Fix libcxx detection on Darwin with clang run as ./clang

Summary:
By using '..' instead of fs::parent_path.

The intention of the code was to go from 'path/to/clang/bin' to
'path/to/clang/include'. In most cases parent_path works, however it
would fail when clang is run as './clang'.

This was noticed in Chromium's bug tracker, see
https://bugs.chromium.org/p/chromium/issues/detail?id=919761

Reviewers: arphaman, thakis, EricWF

Reviewed By: arphaman, thakis

Subscribers: christof, cfe-commits

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

llvm-svn: 350714

5 years agoDoc: fixed description of a parameter of the __kmpc_taskloop
Andrey Churbanov [Wed, 9 Jan 2019 13:06:23 +0000 (13:06 +0000)]
Doc: fixed description of a parameter of the __kmpc_taskloop

Patch by sergi.mateo.bellido@gmail.com

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

llvm-svn: 350713

5 years ago[MSP430] Optimize 'shl x, 8[+ N] -> swpb(zext(x)) [<< N]' for i16
Anton Korobeynikov [Wed, 9 Jan 2019 13:03:01 +0000 (13:03 +0000)]
[MSP430] Optimize 'shl x, 8[+ N] -> swpb(zext(x)) [<< N]' for i16

Perform additional simplification to reduce shift amount.

Patch by Kristina Bessonova!

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

llvm-svn: 350712

5 years ago[gn build] Run `git ls-files '*.gn' '*.gni' | xargs -n 1 gn format`
Nico Weber [Wed, 9 Jan 2019 12:57:52 +0000 (12:57 +0000)]
[gn build] Run `git ls-files '*.gn' '*.gni' | xargs -n 1 gn format`

Looks like I forgot to do that for the PowerPC target.

llvm-svn: 350711

5 years ago[MSP430] Fix crash while lowering llvm.stacksave/stackrestore
Anton Korobeynikov [Wed, 9 Jan 2019 12:52:15 +0000 (12:52 +0000)]
[MSP430] Fix crash while lowering llvm.stacksave/stackrestore

Perform the usual expansion of stacksave / restore intrinsics.
Patch by Kristina Bessonova!

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

llvm-svn: 350710

5 years ago[gn build] Merge r350669
Nico Weber [Wed, 9 Jan 2019 12:48:06 +0000 (12:48 +0000)]
[gn build] Merge r350669

llvm-svn: 350709

5 years ago[gn build] Add a TODO.txt file
Nico Weber [Wed, 9 Jan 2019 12:46:04 +0000 (12:46 +0000)]
[gn build] Add a TODO.txt file

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

llvm-svn: 350708

5 years ago[X86] Add extra test coverage for combining shuffles to PACKSS/PACKUS
Simon Pilgrim [Wed, 9 Jan 2019 12:34:10 +0000 (12:34 +0000)]
[X86] Add extra test coverage for combining shuffles to PACKSS/PACKUS

llvm-svn: 350707

5 years ago[Sparc] Add Sparc V8 support
Daniel Cederman [Wed, 9 Jan 2019 12:06:05 +0000 (12:06 +0000)]
[Sparc] Add Sparc V8 support

Summary:
Adds the register class implementation for Sparc.
Adds support for DW_CFA_GNU_window_save.
Adds save and restore context functionality.

On Sparc the return address is the address of the call instruction,
so an offset needs to be added when returning to skip the call instruction
and its delay slot. If the function returns a struct it is also necessary
to skip one extra instruction.

Reviewers: jyknight, mclow.lists, mstorsjo, compnerd

Reviewed By: compnerd

Subscribers: fedor.sergeev, JDevlieghere, ldionne, libcxx-commits

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

llvm-svn: 350705

5 years agoUse DeclSpec for quals in DeclaratorChunk::FunctionTypeInfo.
Anastasia Stulova [Wed, 9 Jan 2019 11:25:09 +0000 (11:25 +0000)]
Use DeclSpec for quals in DeclaratorChunk::FunctionTypeInfo.

Rather than duplicating data fields, use DeclSpec directly to store
the qualifiers for the functions/methods. This change doesn't handle
attributes yet and has to be extended further.

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

llvm-svn: 350703

5 years ago[AArch64] Move feature predctrl to predres
Diogo N. Sampaio [Wed, 9 Jan 2019 11:24:15 +0000 (11:24 +0000)]
[AArch64] Move feature predctrl to predres

Follow up patch of rL350385, for adding predres
command line option. This patch renames the
feature as to keep it aligned with the option
passed by/to clang

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

llvm-svn: 350702

5 years ago[X86] Fix gcc7 -Wunused-but-set-variable warning. NFCI.
Simon Pilgrim [Wed, 9 Jan 2019 11:18:49 +0000 (11:18 +0000)]
[X86] Fix gcc7 -Wunused-but-set-variable warning. NFCI.

llvm-svn: 350701

5 years agoMake the write_cmake_config.py script python3-compatible
Alexander Kornienko [Wed, 9 Jan 2019 10:49:44 +0000 (10:49 +0000)]
Make the write_cmake_config.py script python3-compatible

llvm-svn: 350700

5 years ago[DebugInfo] Omit location list entries with empty ranges
David Stenberg [Wed, 9 Jan 2019 09:58:59 +0000 (09:58 +0000)]
[DebugInfo] Omit location list entries with empty ranges

Summary:
This fixes PR39710. In that case we emitted a location list looking like
this:

.Ldebug_loc0:
        .quad   .Lfunc_begin0-.Lfunc_begin0
        .quad   .Lfunc_begin0-.Lfunc_begin0
        .short  1                       # Loc expr size
        .byte   85                      # DW_OP_reg5
        .quad   .Lfunc_begin0-.Lfunc_begin0
        .quad   .Lfunc_end0-.Lfunc_begin0
        .short  1                       # Loc expr size
        .byte   85                      # super-register DW_OP_reg5
        .quad   0
        .quad   0

As seen, the first entry's beginning and ending addresses evalute to 0,
which meant that the entry inadvertently became an "end of list" entry,
resulting in the location list ending sooner than expected.

To fix this, omit all entries with empty ranges. Location list entries
with empty ranges do not have any effect, as specified by DWARF, so we
might as well drop them:

"A location list entry (but not a base address selection or end of list
 entry) whose beginning and ending addresses are equal has no effect
 because the size of the range covered by such an entry is zero."

Reviewers: davide, aprantl, dblaikie

Reviewed By: aprantl

Subscribers: javed.absar, JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 350698

5 years agoGlobalISel: Implement fewerElements for implicit_def
Matt Arsenault [Wed, 9 Jan 2019 07:51:52 +0000 (07:51 +0000)]
GlobalISel: Implement fewerElements for implicit_def

llvm-svn: 350697

5 years ago[X86] Make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match...
Craig Topper [Wed, 9 Jan 2019 07:36:01 +0000 (07:36 +0000)]
[X86] Make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match gcc and Intel's documentation.

The avx2 gather intrinsics are documented to use 'int', 'long long', 'float', or 'double' *. So I'm leaving those. This matches gcc.

llvm-svn: 350696

5 years agoGlobalISel: Implement widenScalar for implicit_def
Matt Arsenault [Wed, 9 Jan 2019 07:34:14 +0000 (07:34 +0000)]
GlobalISel: Implement widenScalar for implicit_def

llvm-svn: 350695

5 years ago[IPT] Drop cache less eagerly in GVN and LoopSafetyInfo
Max Kazantsev [Wed, 9 Jan 2019 07:28:13 +0000 (07:28 +0000)]
[IPT] Drop cache less eagerly in GVN and LoopSafetyInfo

Current strategy of dropping `InstructionPrecedenceTracking` cache is to
invalidate the entire basic block whenever we change its contents. In fact,
`InstructionPrecedenceTracking` has 2 internal strictures: `OrderedInstructions`
that is needed to be invalidated whenever the contents changes, and the map
with first special instructions in block. This second map does not need an
update if we add/remove a non-special instuction because it cannot
affect the contents of this map.

This patch changes API of `InstructionPrecedenceTracking` so that it now
accounts for reasons under which we invalidate blocks. This should lead
to much less recalculations of the map and should save us some compile time
because in practice we don't typically add/remove special instructions.

Differential Revision: https://reviews.llvm.org/D54462
Reviewed By: efriedma

llvm-svn: 350694

5 years agoRevert "[PowerPC] Fix assert from machine verify pass that unmatched register class...
Zi Xuan Wu [Wed, 9 Jan 2019 06:12:24 +0000 (06:12 +0000)]
Revert "[PowerPC] Fix assert from machine verify pass that unmatched register class about fcmp selection in fast-isel"

This reverts commit r350685.

See compile assert in compiler-rt.

llvm-svn: 350693

5 years agoMark two more tests as FLAKY
Eric Fiselier [Wed, 9 Jan 2019 05:48:54 +0000 (05:48 +0000)]
Mark two more tests as FLAKY

llvm-svn: 350692

5 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Wed, 9 Jan 2019 05:11:10 +0000 (05:11 +0000)]
[NFC] fix trivial typos in comments

llvm-svn: 350690

5 years agogn build: Copy file permissions from input file in configure_file() emulation.
Peter Collingbourne [Wed, 9 Jan 2019 04:39:29 +0000 (04:39 +0000)]
gn build: Copy file permissions from input file in configure_file() emulation.

Most significantly, this makes bin/llvm-lit executable so that it
can be run in the usual way.

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

llvm-svn: 350688

5 years ago[X86] Correct the MaskVT for avx512 gather/scatter intrinsics to use the min of the...
Craig Topper [Wed, 9 Jan 2019 04:21:12 +0000 (04:21 +0000)]
[X86] Correct the MaskVT for avx512 gather/scatter intrinsics to use the min of the number of index and data elements.

When the result type is v2i64/v2f64 and the index element size is i32, the index vector has two unused elements making the type v4i32. The mask VT should match the number of memory accesses that will be made.

This is consistent with the isel patterns used for the target independent gather/scatter intrinsic.

llvm-svn: 350687

5 years agogn build: Fix a Python2ism in write_vcsrevision.py.
Peter Collingbourne [Wed, 9 Jan 2019 04:05:07 +0000 (04:05 +0000)]
gn build: Fix a Python2ism in write_vcsrevision.py.

Convert the output of "git rev-parse --short HEAD" to a string before
substituting it into the output file. Without this the output file
will look like this on Python 3:

 #define LLVM_REVISION "git-b'6a4895a025f'"

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

llvm-svn: 350686

5 years ago[PowerPC] Fix assert from machine verify pass that unmatched register class about...
Zi Xuan Wu [Wed, 9 Jan 2019 02:31:10 +0000 (02:31 +0000)]
[PowerPC] Fix assert from machine verify pass that unmatched register class about fcmp selection in fast-isel

Bad machine code: Illegal virtual register for instruction

function: TestULE
basic block: %bb.0 entry (0x1000a39b158)
instruction: %2:crrc = FCMPUD %1:vsfrc, %3:f8rc
operand 1: %1:vsfrc

Fix assert about missing match between fcmp instruction and register class.
We should use vsx related cmp instruction xvcmpudp instead of fcmpu when vsx is opened.

add -verifymachineinstrs option into related test cases to enable the verify pass.

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

llvm-svn: 350685

5 years agoRemove check for single use in ShrinkDemandedConstant
Stanislav Mekhanoshin [Wed, 9 Jan 2019 02:24:22 +0000 (02:24 +0000)]
Remove check for single use in ShrinkDemandedConstant

This removes check for single use from general ShrinkDemandedConstant
to the BE because of the AArch64 regression after D56289/rL350475.

After several hours of experiments I did not come up with a testcase
failing on any other targets if check is not performed.

Moreover, direct call to ShrinkDemandedConstant is not really needed
and superceed by SimplifyDemandedBits.

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

llvm-svn: 350684

5 years agohwasan: Ignore loads and stores of size 0.
Peter Collingbourne [Wed, 9 Jan 2019 00:44:13 +0000 (00:44 +0000)]
hwasan: Ignore loads and stores of size 0.

Now that memory intrinsics are instrumented, it's more likely that
CheckAddressSized will be called with size 0. (It was possible before
with IR like:

  %val = load [0 x i8], [0 x i8]* %ptr

but I don't think clang will generate IR like that and the optimizer
would normally remove it by the time it got anywhere near our pass
anyway). The right thing to do in both cases is to disable the
addressing checks (since the underlying memory intrinsic is a no-op),
so that's what we do.

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

llvm-svn: 350683

5 years ago[CMakeLists] Sort tools/CMakeLists.txt
Jonas Devlieghere [Wed, 9 Jan 2019 00:31:30 +0000 (00:31 +0000)]
[CMakeLists] Sort tools/CMakeLists.txt

llvm-svn: 350682

5 years ago[ARM][AArch64] Increase TLS alignment to reserve space for Android's TCB
Ryan Prichard [Wed, 9 Jan 2019 00:09:59 +0000 (00:09 +0000)]
[ARM][AArch64] Increase TLS alignment to reserve space for Android's TCB

ARM and AArch64 use TLS variant 1, where the first two words after the
thread pointer are reserved for the TCB, followed by the executable's TLS
segment. Both the thread pointer and the TLS segment are aligned to at
least the TLS segment's alignment.

Android/Bionic historically has not supported ELF TLS, and it has
allocated memory after the thread pointer for several Bionic TLS slots
(currently 9 but soon only 8). At least one of these allocations
(TLS_SLOT_STACK_GUARD == 5) is widespread throughout Android/AArch64
binaries and can't be changed.

To reconcile this disagreement about TLS memory layout, set the minimum
alignment for executable TLS segments to 8 words on ARM/AArch64, which
reserves at least 8 words of memory after the TP (2 for the ABI-specified
TCB and 6 for alignment padding). For simplicity, and because lld doesn't
know when it's targeting Android, increase the alignment regardless of
operating system.

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

llvm-svn: 350681

5 years ago[libclang] Fix the mismatched delete operator for ExprEvalResult
Alex Lorenz [Tue, 8 Jan 2019 23:28:37 +0000 (23:28 +0000)]
[libclang] Fix the mismatched delete operator for ExprEvalResult

The '.stringVal' field in ExprEvalResult is allocated using new[],
but was freed using a regular delete. That caused memory leaks in
the test from r350666.

llvm-svn: 350680

5 years agoChange std::sort to llvm::sort to detect non-determinism.
Jonas Devlieghere [Tue, 8 Jan 2019 23:25:06 +0000 (23:25 +0000)]
Change std::sort to llvm::sort to detect non-determinism.

LLVM added wrappers to std::sort (r327219) that randomly shuffle the
container before sorting. The goal is to uncover non-determinism due to
undefined sorting order of objects having the same key.

This can be enabled with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON.

llvm-svn: 350679

5 years agoRegisterCoalescer: Assume CR_Replace for SubRangeJoin
Matt Arsenault [Tue, 8 Jan 2019 23:22:18 +0000 (23:22 +0000)]
RegisterCoalescer: Assume CR_Replace for SubRangeJoin

Currently it's possible for following
check on V.WriteLanes (which is not really meaningful
during SubRangeJoin) to pass for one half of the pair,
and then fall through to to one of the impossible
or unresolved states. This then fails as inconsistent
on the other half.

During the main range join, the check between V.WriteLanes
and OtherV.ValidLanes must have passed, meaning this
should be a CR_Replace.

Fixes most of the testcases in bugs 39542 and 39602

llvm-svn: 350678

5 years ago[ASTDump] NFC: Move dumpDeclRef to NodeDumper
Stephen Kelly [Tue, 8 Jan 2019 23:11:24 +0000 (23:11 +0000)]
[ASTDump] NFC: Move dumpDeclRef to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 350677

5 years agoRegisterCoalescer: Defer clearing implicit_def lanes
Matt Arsenault [Tue, 8 Jan 2019 23:10:47 +0000 (23:10 +0000)]
RegisterCoalescer: Defer clearing implicit_def lanes

We can't go back and recover the lanes if it turns
out the implicit_def really can't be erased.

Assume all lanes are valid if an unresolved conflict
is encountered. There aren't any tests where this
seems to matter either way, but this seems like a
safer option.

Fixes bug 39602

llvm-svn: 350676

5 years agoFix unused private field warning.
Raphael Isemann [Tue, 8 Jan 2019 22:55:02 +0000 (22:55 +0000)]
Fix unused private field warning.

Summary: The member is private and unused if HAVE_LIBCOMPRESSION is undefined, which triggers Clang's -Wunused-private-field warning.

Subscribers: lldb-commits

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

llvm-svn: 350675

5 years ago[InstCombine] remove stale comments; NFC
Sanjay Patel [Tue, 8 Jan 2019 22:52:08 +0000 (22:52 +0000)]
[InstCombine] remove stale comments; NFC

These changed with rL350672.

llvm-svn: 350674

5 years ago[llvm-profdata] add value-cutoff functionality in show command
Rong Xu [Tue, 8 Jan 2019 22:41:48 +0000 (22:41 +0000)]
[llvm-profdata] add value-cutoff functionality in show command

This patch improves llvm-profdata show command:
(1) add -value-cutoff=<N> option: Show only those functions whose max count
    values are greater or equal to N.
(2) add -list-below-cutoff option: Only output names of functions whose max
    count value are below the cutoff.
(3) formats value-profile counts and prints out percentage.

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

llvm-svn: 350673

5 years ago[InstCombine] canonicalize another raw IR rotate pattern to funnel shift
Sanjay Patel [Tue, 8 Jan 2019 22:39:55 +0000 (22:39 +0000)]
[InstCombine] canonicalize another raw IR rotate pattern to funnel shift

This is matching the equivalent of the DAG expansion,
so it should never end up with worse perf than the
original code even if the target doesn't have a rotate
instruction.

llvm-svn: 350672

5 years ago[PGO] Use SourceFileName rather module name in PGOFuncName
Rong Xu [Tue, 8 Jan 2019 22:39:47 +0000 (22:39 +0000)]
[PGO] Use SourceFileName rather module name in PGOFuncName

In LTO or Thin-lto mode (though linker plugin), the module
names are of temp file names which are different for
different compilations. Using SourceFileName avoids the issue.
This should not change any functionality for current PGO as
all the current callers of getPGOFuncName() is before LTO.

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

llvm-svn: 350671

5 years ago[PGO] Revert r350579 to fix commit message.
Rong Xu [Tue, 8 Jan 2019 22:37:12 +0000 (22:37 +0000)]
[PGO] Revert r350579 to fix commit message.

Will re-commit it using the correct commit message.

llvm-svn: 350670

5 years ago[WebAssembly] Rename StoreResults to MemIntrinsicResults
Heejin Ahn [Tue, 8 Jan 2019 22:35:18 +0000 (22:35 +0000)]
[WebAssembly] Rename StoreResults to MemIntrinsicResults

Summary:
StoreResults pass does not optimize store instructions anymore because
store instructions don't return results values anymore. Now this pass is
used solely for memory intrinsics, so update the pass name accordingly
and fix outdated pass descriptions as well.

This patch does not change any meaningful behavior, but not marked as
NFC because it changes a comment check line in a test case.

Reviewers: dschuff

Subscribers: mgorny, sbc100, jgravelle-google, sunfiish, llvm-commits

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

llvm-svn: 350669

5 years ago[Driver] Default to -fno-addrsig on Android.
Dan Albert [Tue, 8 Jan 2019 22:33:59 +0000 (22:33 +0000)]
[Driver] Default to -fno-addrsig on Android.

Summary: The Android NDK still uses GNU binutils by default.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 350668

5 years ago[PGO] Revert r350442 to fix commit message.
Rong Xu [Tue, 8 Jan 2019 22:33:29 +0000 (22:33 +0000)]
[PGO] Revert r350442 to fix commit message.

Will re-commit it using the correct commit message.

llvm-svn: 350667

5 years ago[libclang] Recommit r336590 with a fix for the memory leak in the test
Alex Lorenz [Tue, 8 Jan 2019 22:32:51 +0000 (22:32 +0000)]
[libclang] Recommit r336590 with a fix for the memory leak in the test

The original commit had a memory leak in the test has a leak as it doesn't
dispose of the evaluated cursor result.

This also contains the follow-up NFC refactoring commit r336591.

rdar://45893054

Original commit message:

[libclang] evalute compound statement cursors before trying to evaluate
the cursor like a declaration

This change fixes a bug in libclang in which it tries to evaluate a statement
cursor as a declaration cursor, because that statement still has a pointer to
the declaration parent.

rdar://38888477

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

llvm-svn: 350666

5 years agoImplement the TreeStructure interface through the TextNodeDumper
Stephen Kelly [Tue, 8 Jan 2019 22:32:48 +0000 (22:32 +0000)]
Implement the TreeStructure interface through the TextNodeDumper

Summary:
This way, when the generic ASTTraverser is extracted from ASTDumper,
there can't be any problem related to ordering of class members, a
concern that was raised in https://reviews.llvm.org/D55337.

This will also preserve the property that the generic traverser does not
enforce any coupling between the NodeDumper and the TreeStructure.

 https://godbolt.org/z/PEtT1_

Reviewers: aaron.ballman, erichkeane

Subscribers: cfe-commits

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

llvm-svn: 350665

5 years agoAndroid is not GNU, so don't claim that it is.
Dan Albert [Tue, 8 Jan 2019 22:31:19 +0000 (22:31 +0000)]
Android is not GNU, so don't claim that it is.

Reviewers: pirama, srhines

Reviewed By: srhines

Subscribers: kristina, cfe-commits

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

llvm-svn: 350664

5 years ago[AArch64] Adjust the cost model for Exynos
Evandro Menezes [Tue, 8 Jan 2019 22:29:58 +0000 (22:29 +0000)]
[AArch64] Adjust the cost model for Exynos

Improve the modeling of ALU instructions.

llvm-svn: 350663

5 years ago[llvm-mca] Update the Exynos test cases (NFC)
Evandro Menezes [Tue, 8 Jan 2019 22:29:56 +0000 (22:29 +0000)]
[llvm-mca] Update the Exynos test cases (NFC)

Add more entropy to the test cases.

llvm-svn: 350662

5 years ago[llvm-mca] Improve debugging (NFC)
Evandro Menezes [Tue, 8 Jan 2019 22:29:38 +0000 (22:29 +0000)]
[llvm-mca] Improve debugging (NFC)

llvm-svn: 350661

5 years ago[Query] NFC: Port QueryParser to StringRef
Stephen Kelly [Tue, 8 Jan 2019 22:27:08 +0000 (22:27 +0000)]
[Query] NFC: Port QueryParser to StringRef

Summary:
There is no reason for it to not be a StringRef.  Making it one
simplifies existing code, and makes follow-up features easier.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 350660

5 years ago[BreakpointList] Simplify/modernize BreakpointList (NFC)
Jonas Devlieghere [Tue, 8 Jan 2019 22:07:42 +0000 (22:07 +0000)]
[BreakpointList] Simplify/modernize BreakpointList (NFC)

I was looking at the code in BreakpointList.cpp and found it deserved a
quick cleanup.

  -  Use std::vector instead of a std::list.
  -  Extract duplicate code for notifying.
  -  Remove code duplication when returning a const value.
  -  Use range-based for loop.
  -  Use early return in loops.

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

llvm-svn: 350659

5 years ago[Sanitizer] Intercept fdevname on FreeBSD
David Carlier [Tue, 8 Jan 2019 21:49:37 +0000 (21:49 +0000)]
[Sanitizer] Intercept fdevname on FreeBSD

- Is a file descriptor flavor FreeBSD's specific.
- reentrant version included.

Reviewers: vitalybuka, krytarowski, emaste

Reviewed By: emaste

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

llvm-svn: 350658

5 years agoFix go bindings for r350647: missed a function rename
Jorge Gorbe Moya [Tue, 8 Jan 2019 21:45:42 +0000 (21:45 +0000)]
Fix go bindings for r350647: missed a function rename

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

llvm-svn: 350657

5 years ago[llvm-undname] Add support for demangling msvc's noexcept types.
Zachary Turner [Tue, 8 Jan 2019 21:05:51 +0000 (21:05 +0000)]
[llvm-undname] Add support for demangling msvc's noexcept types.

Starting in C++17, MSVC introduced a new mangling for function
parameters that are themselves noexcept functions.  This patch
makes llvm-undname properly demangle them.

Patch by Zachary Henkel
Differential Revision: https://reviews.llvm.org/D55769

llvm-svn: 350656

5 years agoDon't write #include "Windows/WindowsSupport.h" from the Windows dir.
Zachary Turner [Tue, 8 Jan 2019 21:05:34 +0000 (21:05 +0000)]
Don't write #include "Windows/WindowsSupport.h" from the Windows dir.

This generates -Wnonportable-include-dir warnings, and doesn't need
to be there.  It seems this was just checked in on accident.

llvm-svn: 350655

5 years agoRevert "Revert "Revert "Resubmit rL345008 "Split MachinePipeliner code into header...
Adrian Prantl [Tue, 8 Jan 2019 21:05:10 +0000 (21:05 +0000)]
Revert "Revert "Revert "Resubmit rL345008 "Split MachinePipeliner code into header and cpp files""""

This reverts commit D56084.

llvm-svn: 350654

5 years agoRevert "Work around a linker error caused by https://reviews.llvm.org/D56084."
Adrian Prantl [Tue, 8 Jan 2019 21:05:08 +0000 (21:05 +0000)]
Revert "Work around a linker error caused by https://reviews.llvm.org/D56084."

This reverts commit r350650

llvm-svn: 350653

5 years ago[PdbAstBuilder] Remove unused functions
Jonas Devlieghere [Tue, 8 Jan 2019 20:58:54 +0000 (20:58 +0000)]
[PdbAstBuilder] Remove unused functions

PdbAstBuilder.cpp:273:20: warning: unused function 'GetParentUniqueName' [-Wunused-function]
PdbAstBuilder.cpp:267:13: warning: unused function 'IsUniqueNameEnumTag' [-Wunused-function]

llvm-svn: 350652

5 years agoConvert to LLDB coding style (NFC)
Adrian Prantl [Tue, 8 Jan 2019 20:48:40 +0000 (20:48 +0000)]
Convert to LLDB coding style (NFC)

llvm-svn: 350651

5 years agoWork around a linker error caused by https://reviews.llvm.org/D56084.
Adrian Prantl [Tue, 8 Jan 2019 20:38:22 +0000 (20:38 +0000)]
Work around a linker error caused by https://reviews.llvm.org/D56084.

This unbreaks all bots that build with -DLLVM_ENABLE_MODULES=1

llvm-svn: 350650

5 years ago[Sema] Teach Clang that aligned allocation is not supported with macosx10.13
Louis Dionne [Tue, 8 Jan 2019 20:26:56 +0000 (20:26 +0000)]
[Sema] Teach Clang that aligned allocation is not supported with macosx10.13

Summary:
r306722 added diagnostics when aligned allocation is used with deployment
targets that do not support it, but the first macosx supporting aligned
allocation was incorrectly set to 10.13. In reality, the dylib shipped
with macosx10.13 does not support aligned allocation, but the dylib
shipped with macosx10.14 does.

Reviewers: ahatanak

Subscribers: christof, jkorous, dexonsmith, cfe-commits

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

llvm-svn: 350649

5 years agoFix clang for r350647: Missed a function rename
Philip Pfaffe [Tue, 8 Jan 2019 20:00:55 +0000 (20:00 +0000)]
Fix clang for r350647: Missed a function rename

llvm-svn: 350648

5 years ago[NewPM] Port tsan
Philip Pfaffe [Tue, 8 Jan 2019 19:21:57 +0000 (19:21 +0000)]
[NewPM] Port tsan

A straightforward port of tsan to the new PM, following the same path
as D55647.

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

llvm-svn: 350647

5 years ago[x86] add tests for PR40243; NFC
Sanjay Patel [Tue, 8 Jan 2019 19:15:21 +0000 (19:15 +0000)]
[x86] add tests for PR40243; NFC

llvm-svn: 350646

5 years agoFix opencl test broken on windows by r350643.
Erich Keane [Tue, 8 Jan 2019 19:10:43 +0000 (19:10 +0000)]
Fix opencl test broken on windows by r350643.

Windows doesn't allow common with alignment >32 bits, so these tests
were broken in windows mode.  This patch makes 'common' optional in
these cases.

Change-Id: I4d5fdd07ecdafc3570ef9b09cd816c2e5e4ed15e
llvm-svn: 350645

5 years ago[NFC] Don't over-eagerly check block alignment
JF Bastien [Tue, 8 Jan 2019 18:51:38 +0000 (18:51 +0000)]
[NFC] Don't over-eagerly check block alignment

Alignment of __block isn't relevant to this test, remove its checking.

llvm-svn: 350644

5 years agoLimit COFF 'common' emission to <=32 alignment types.
Erich Keane [Tue, 8 Jan 2019 18:44:22 +0000 (18:44 +0000)]
Limit COFF 'common' emission to <=32 alignment types.

As reported in PR33035, LLVM crashes if given a common object with an
alignment of greater than 32 bits. This is because the COFF file format
does not support these alignments, so emitting them is broken anyway.

This patch changes any global definitions greater than 32 bit alignment
to no longer be in 'common'.

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

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

Change-Id: I48609289753b7f3b58c5e2bc1712756750fbd45a
llvm-svn: 350643

5 years ago__has_feature(pragma_clang_attribute_namespaces) should be __has_extension
Erik Pilkington [Tue, 8 Jan 2019 18:24:39 +0000 (18:24 +0000)]
__has_feature(pragma_clang_attribute_namespaces) should be __has_extension

Thanks to Richard Smith for pointing this out.

llvm-svn: 350642

5 years agoRename DIFlagFixedEnum to DIFlagEnumClass. NFC
Paul Robinson [Tue, 8 Jan 2019 17:52:29 +0000 (17:52 +0000)]
Rename DIFlagFixedEnum to DIFlagEnumClass. NFC

llvm-svn: 350641

5 years ago[UnrollRuntime] Fix domTree failures in multiexit unrolling
Anna Thomas [Tue, 8 Jan 2019 17:16:25 +0000 (17:16 +0000)]
[UnrollRuntime] Fix domTree failures in multiexit unrolling

Summary:
This fixes the IDom for exit blocks and all blocks reachable from the exit blocks, when runtime unrolling under multiexit/exiting case.
We initially had a restrictive check that the IDom is only updated when
it is the header of the loop.
However, we also need to update the IDom to the correct one when the
IDom is any block within the original loop. See added test cases (which
fail dom tree verification without the patch).

Reviewers: reames, mzolotukhin, mkazantsev, hfinkel

Reviewed by: brzycki, kuhar

Subscribers: zzheng, dmgreen, llvm-commits

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

llvm-svn: 350640

5 years agoRevert "Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor"
Erik Pilkington [Tue, 8 Jan 2019 17:04:38 +0000 (17:04 +0000)]
Revert "Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor"

This reverts commit r350585. There was some late post-commit review
on phab.

llvm-svn: 350639

5 years agoFix use-after-free bug in Tooling.
Alexander Kornienko [Tue, 8 Jan 2019 16:55:13 +0000 (16:55 +0000)]
Fix use-after-free bug in Tooling.

Summary:
`buildASTFromCodeWithArgs()` was creating a memory buffer referencing a
stack-allocated string.  This diff changes the implementation to copy the code
string into the memory buffer so that said buffer owns the memory.

Patch by Yitzhak Mandelbaum.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, EricWF

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

llvm-svn: 350638

5 years ago[BPF] Fix .BTF.ext reloc type assigment issue
Yonghong Song [Tue, 8 Jan 2019 16:36:06 +0000 (16:36 +0000)]
[BPF] Fix .BTF.ext reloc type assigment issue

Commit f1db33c5c1a9 ("[BPF] Disable relocation for .BTF.ext section")
assigned relocation type R_BPF_NONE if the fixup type
is FK_Data_4 and the symbol is temporary.
The reason is we use FK_Data_4 as a fixup type
for insn offsets in .BTF.ext section.

Just checking whether the symbol is temporary is not enough.
For example, .debug_info may reference some strings whose
fixup is FK_Data_4 with a temporary symbol as well.

To truely reflect the case for .BTF.ext section,
this patch further checks that the section associateed with the symbol
must be SHF_ALLOC and SHF_EXECINSTR, i.e., in the text section.
This fixed the above-mentioned problem.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 350637

5 years agoDon't emit DW_AT_enum_class unless it's actually an 'enum class'.
Paul Robinson [Tue, 8 Jan 2019 16:28:11 +0000 (16:28 +0000)]
Don't emit DW_AT_enum_class unless it's actually an 'enum class'.

Finishes off the functional part of PR36168.

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

llvm-svn: 350636

5 years ago[AST][NFC] Pack CXXScalarValueInitExpr
Bruno Ricci [Tue, 8 Jan 2019 16:08:54 +0000 (16:08 +0000)]
[AST][NFC] Pack CXXScalarValueInitExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXScalarValueInitExpr. NFC.

llvm-svn: 350635

5 years ago[OPENMP]Fix PR40191: Do not allow orphaned cancellation constructs.
Alexey Bataev [Tue, 8 Jan 2019 15:53:42 +0000 (15:53 +0000)]
[OPENMP]Fix PR40191: Do not allow orphaned cancellation constructs.

Prohibited use of the orphaned cancellation directives.

llvm-svn: 350634

5 years ago[clangd] Fix a crash when reading an empty index file.
Haojian Wu [Tue, 8 Jan 2019 15:24:47 +0000 (15:24 +0000)]
[clangd] Fix a crash when reading an empty index file.

Summary:
Unfortunately, yaml::Input::setCurrentDocument() and yaml::Input::nextDocument() are
internal APIs, the way we use them may cause a nullptr accessing when
processing an empty YAML file.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 350633

5 years ago[gn build] Update readme
Nico Weber [Tue, 8 Jan 2019 15:19:00 +0000 (15:19 +0000)]
[gn build] Update readme

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

llvm-svn: 350632

5 years ago[gn build] Make sync_source_lists_from_cmake.py check that all LLVM unittests are...
Nico Weber [Tue, 8 Jan 2019 15:17:19 +0000 (15:17 +0000)]
[gn build] Make sync_source_lists_from_cmake.py check that all LLVM unittests are present

Now that the PowerPC and WebAssembly targets are added, this check passes.

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

llvm-svn: 350631

5 years ago[MachineVerifier] Include offending register in allocatable live-in error msg.
Florian Hahn [Tue, 8 Jan 2019 15:16:23 +0000 (15:16 +0000)]
[MachineVerifier] Include offending register in allocatable live-in error msg.

This patch adds a convenience report() method for physical registers and
uses it to print the offending register with the 'MBB has allocatable
live-in' error.

Reviewers: MatzeB, rtereshin, dsanders

Reviewed By: dsanders

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

llvm-svn: 350630

5 years ago[gn build] Add build files for llvm/lib/Target/PowerPC + tests
Nico Weber [Tue, 8 Jan 2019 15:16:14 +0000 (15:16 +0000)]
[gn build] Add build files for llvm/lib/Target/PowerPC + tests

The PowerPC target itself is similar to the X86 target in https://reviews.llvm.org/rL348903
The llvm-exegesis unittests bits are similar to the corresponding AArch64 in https://reviews.llvm.org/rL350499
The whole patch is very similar to the WebAssembly target being added in https://reviews.llvm.org/rL350628

Also add a dep from tools/llvm-exegesis/lib to the AArch64 subdir, which I
failed to do in r350499.

The motivation for this target is solely that it has a unit test and I want to
enable the GN<->CMake unittest syncing check for llvm.

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

llvm-svn: 350629

5 years ago[gn build] Add build files for llvm/lib/Target/WebAssembly + tests
Nico Weber [Tue, 8 Jan 2019 15:12:42 +0000 (15:12 +0000)]
[gn build] Add build files for llvm/lib/Target/WebAssembly + tests

The WebAssembly target itself is similar to the X86 target in https://reviews.llvm.org/rL348903
The unittests bits are similar to the corresponding AArch64 in https://reviews.llvm.org/rL350499

The motivation for this target is solely that it has a unit test and I want to
enable the GN<->CMake unittest syncing check for llvm. (After this, only the
PowerPC target is needed and I can turn it on.)

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

llvm-svn: 350628

5 years ago[AST][NFC] Pack CXXNoexceptExpr and SubstNonTypeTemplateParmExpr
Bruno Ricci [Tue, 8 Jan 2019 14:44:34 +0000 (14:44 +0000)]
[AST][NFC] Pack CXXNoexceptExpr and SubstNonTypeTemplateParmExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXNoexceptExpr/SubstNonTypeTemplateParmExpr.

Use this opportunity to run clang-format on these two classes and
fix some style issues. NFC overall.

llvm-svn: 350627

5 years ago[GlobalISel] Fix choice of instruction selector for AArch64 at -O0 with -global-isel=0
Petr Pavlu [Tue, 8 Jan 2019 14:19:06 +0000 (14:19 +0000)]
[GlobalISel] Fix choice of instruction selector for AArch64 at -O0 with -global-isel=0

Commit rL347861 introduced an unintentional change in the behaviour when
compiling for AArch64 at -O0 with -global-isel=0. Previously, explicitly
disabling GlobalISel resulted in using FastISel but an updated condition
in the commit changed it to using SelectionDAG. The patch fixes this
condition and slightly better organizes the code that chooses the
instruction selector.

Fixes PR40131.

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

llvm-svn: 350626

5 years ago[AST] Pack CXXDependentScopeMemberExpr
Bruno Ricci [Tue, 8 Jan 2019 14:17:00 +0000 (14:17 +0000)]
[AST] Pack CXXDependentScopeMemberExpr

Use the newly available space in the bit-fields of Stmt. Additionally store
FirstQualifierFoundInScope as a trailing object since it is most of the time
null (non-null for 2 of the 35446 CXXDependentScopeMemberExpr when parsing
all of Boost).

It would be possible to move the data for the nested-name-specifier to a
trailing object too to save another 2 pointers, however doing so did actually
regress the time taken to parse all of Boost slightly.

This saves 8 bytes + 1 pointer per CXXDependentScopeMemberExpr in the vast
majority of cases.

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

Reviewed By: rjmccall

llvm-svn: 350625

5 years ago[DA][NewPM] Add a printerpass and port the testsuite
Philip Pfaffe [Tue, 8 Jan 2019 14:06:58 +0000 (14:06 +0000)]
[DA][NewPM] Add a printerpass and port the testsuite

The new-pm version of DA is untested. Testing requires a printer, so
add that and use it in the existing DA tests.

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

llvm-svn: 350624

5 years ago[X86][Darwin] Emit compact-unwind for register-sized stack adjustments
Francis Visoiu Mistrih [Tue, 8 Jan 2019 13:53:15 +0000 (13:53 +0000)]
[X86][Darwin] Emit compact-unwind for register-sized stack adjustments

For stack frames on the size of a register in x86, a code size optimization
emits "push rax/eax" instead of "sub" for stack allocation. For example:

foo:
  .cfi_startproc
BB#0:
  pushq %rax
Ltmp0:
  .cfi_def_cfa_offset 16
  ...
  .cfi_endproc

However, we are falling back to DWARF in this case because we cannot
encode %rax as a saved register.

This requirement is wrong, since we don't care about the contents of
%rax, it is the equivalent of a sub.

In order to specify that we care about the contents of %rax, we would
need a .cfi_offset %rax, <offset>.

It's also overzealous in the case where there are pushes for callee saved
registers followed by a "push rax/eax" instead of "sub", in which case we should
also be able to encode the callee saved regs and everything else using compact
unwind.

Patch authored by Bruno Cardoso Lopes.

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

llvm-svn: 350623

5 years ago[Sema] Diagnose array access preceding the array bounds even when the base type is...
Bruno Ricci [Tue, 8 Jan 2019 13:52:54 +0000 (13:52 +0000)]
[Sema] Diagnose array access preceding the array bounds even when the base type is incomplete.

When the type of the base expression after IgnoreParenCasts is incomplete,
it is still possible to diagnose an array access which precedes the array
bounds.

This is a follow-up on D55862 which added an early return when the type of
the base expression after IgnoreParenCasts was incomplete.

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

Reviewed By: efriedma

llvm-svn: 350622

5 years agoRevert "Revert "Resubmit rL345008 "Split MachinePipeliner code into header and cpp...
Lama Saba [Tue, 8 Jan 2019 13:30:36 +0000 (13:30 +0000)]
Revert "Revert "Resubmit rL345008 "Split MachinePipeliner code into header and cpp files"""

This reverts commit rL350497
reported remaining issues seem to be unrelated to modules or this change.
more info: https://reviews.llvm.org/D56084

llvm-svn: 350621

5 years agoAArch64: avoid splitting vector truncating stores.
Tim Northover [Tue, 8 Jan 2019 13:30:27 +0000 (13:30 +0000)]
AArch64: avoid splitting vector truncating stores.

We have code to split vector splats (of zero and non-zero) for performance
reasons, but it ignores the fact that a store might be truncating.

Actually, truncating stores are formed for vNi8 and vNi16 types. Since the
truncation is from a legal type, the size of the store is always <= 64-bits and
so they don't actually benefit from being split up anyway, so this patch just
disables that transformation.

llvm-svn: 350620

5 years ago[X86] Add shift-by-immediate tests for non-immediate/out-of-range values
Simon Pilgrim [Tue, 8 Jan 2019 12:59:15 +0000 (12:59 +0000)]
[X86] Add shift-by-immediate tests for non-immediate/out-of-range values

As noted on PR40203, for gcc compatibility we need to support non-immediate values in the 'slli/srli/srai' shift by immediate vector intrinsics.

llvm-svn: 350619

5 years ago[GlobalISel] Fix unused variable warning in Release builds.
Benjamin Kramer [Tue, 8 Jan 2019 12:54:26 +0000 (12:54 +0000)]
[GlobalISel] Fix unused variable warning in Release builds.

llvm-svn: 350618

5 years agoProcessLaunchInfo: Remove Target reference
Pavel Labath [Tue, 8 Jan 2019 11:55:19 +0000 (11:55 +0000)]
ProcessLaunchInfo: Remove Target reference

Summary:
The target was being used in FinalizeFileActions to provide default
values for stdin/out/err. Also, most of the logic of this function was
very specific to how the lldb's Target class wants to launch processes,
so I, move it to Target::FinalizeFileActions, inverting the dependency.
The only piece of logic that was useful elsewhere (lldb-server) was the
part which sets up a pty and relevant file actions. I've kept this part
as ProcessLaunchInfo::SetUpPtyRedirection.

This makes ProcessLaunchInfo independent of any high-level lldb constructs.

Reviewers: zturner, jingham, teemperor

Subscribers: lldb-commits

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

llvm-svn: 350617

5 years ago[llvm-readobj] Don't print '@' at end of unversioned dynsym names
James Henderson [Tue, 8 Jan 2019 10:58:05 +0000 (10:58 +0000)]
[llvm-readobj] Don't print '@' at end of unversioned dynsym names

This fixes https://bugs.llvm.org/show_bug.cgi?id=40097. The problem was
caused by a regression in r188022.

See also r350614.

Reviewed by: rupprecht, mstorsjo, Higuoxing, jakehehrlich

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

llvm-svn: 350615

5 years ago[ELF] Remove checking for spurious '@' at the end of dynamic sym names
James Henderson [Tue, 8 Jan 2019 10:50:59 +0000 (10:50 +0000)]
[ELF] Remove checking for spurious '@' at the end of dynamic sym names

llvm-readobj currently has a bug (see PR40097) where it prints '@' at
the end of unversioned dynamic symbols. This bug will be fixed in a
separate later commit, but these tests need fixing first.

Reviewed by: ruiu, Higuoxing

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

llvm-svn: 350614