platform/upstream/llvm.git
6 years ago[WebAssembly] Update test expectations
Sam Clegg [Wed, 8 Nov 2017 20:14:06 +0000 (20:14 +0000)]
[WebAssembly] Update test expectations

I believe these were fixed in rL317707

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

llvm-svn: 317718

6 years agoRevert "[ThinLTO] Ensure sanitizer passes are run"
Teresa Johnson [Wed, 8 Nov 2017 20:08:15 +0000 (20:08 +0000)]
Revert "[ThinLTO] Ensure sanitizer passes are run"

This reverts commit r317715. It failed a Windows buildbot since
ThinLTO is presumably not supported, leading to a corrupt file error
on the object file:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/19395/steps/run%20check-asan/logs/stdio

Will re-commit the new ThinLTO part of the test to a linux only test
file.

llvm-svn: 317717

6 years agoAdd a missing "REQUIRES: system-windows" to a Windows-only test.
David L. Jones [Wed, 8 Nov 2017 20:03:11 +0000 (20:03 +0000)]
Add a missing "REQUIRES: system-windows" to a Windows-only test.

This un-breaks builds on other platforms. Otherwise, they fail due to warnings like:

warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found]
llvm-svn: 317716

6 years ago[ThinLTO] Ensure sanitizer passes are run
Teresa Johnson [Wed, 8 Nov 2017 19:46:25 +0000 (19:46 +0000)]
[ThinLTO] Ensure sanitizer passes are run

Summary:
Test fix to pass manager for ThinLTO.

Depends on D39565.

Reviewers: pcc

Subscribers: kubamracek, mehdi_amini, llvm-commits, inglorion

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

llvm-svn: 317715

6 years ago[ThinLTO] Ensure sanitizer passes are run
Teresa Johnson [Wed, 8 Nov 2017 19:45:52 +0000 (19:45 +0000)]
[ThinLTO] Ensure sanitizer passes are run

Summary:
In ThinLTO compilation, we exit populateModulePassManager early and
were not adding PM extension passes meant to run at the end of the
pipeline. This includes sanitizer passes. Add these passes before
the early exit.

A test will be added to projects/compiler-rt.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, llvm-commits

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

llvm-svn: 317714

6 years ago[X86] Don't call validateInstruction from MatchAndEmitInstruction when MatchingInline...
Craig Topper [Wed, 8 Nov 2017 19:38:48 +0000 (19:38 +0000)]
[X86] Don't call validateInstruction from MatchAndEmitInstruction when MatchingInlineAsm is set. The MCInst won't be populated.

Without this we can't parse gather instructions in ms inline asm blocks. The validateInstruction function was introduced in r316700 to check gather constraints.

llvm-svn: 317713

6 years ago[ValueTracking] Use APInt::isNullValue/isOneValue which are more efficient for large...
Craig Topper [Wed, 8 Nov 2017 19:38:45 +0000 (19:38 +0000)]
[ValueTracking] Use APInt::isNullValue/isOneValue which are more efficient for large APInts.

llvm-svn: 317712

6 years ago[WebAssembly] Add a test for inline-asm "m" constraints.
Dan Gohman [Wed, 8 Nov 2017 19:37:24 +0000 (19:37 +0000)]
[WebAssembly] Add a test for inline-asm "m" constraints.

llvm-svn: 317711

6 years ago[WebAssembly] Call signExtend to get sign extended register
Dan Gohman [Wed, 8 Nov 2017 19:24:21 +0000 (19:24 +0000)]
[WebAssembly] Call signExtend to get sign extended register

Patch by Jatin Bhateja!

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

llvm-svn: 317710

6 years agoAdd CoreOption flag to "-coverage" option to make it available for clang-cl
Marco Castelluccio [Wed, 8 Nov 2017 19:21:54 +0000 (19:21 +0000)]
Add CoreOption flag to "-coverage" option to make it available for clang-cl

Summary:
The -coverage option is not a CoreOption, so it is not available to clang-cl.
This patch adds the CoreOption flag to "-coverage" to allow it to be used with clang-cl.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 317709

6 years agoUn-XFAIL a test after the bugfix in r317702.
Adrian Prantl [Wed, 8 Nov 2017 19:18:20 +0000 (19:18 +0000)]
Un-XFAIL a test after the bugfix in r317702.

llvm-svn: 317708

6 years ago[WebAssembly] Revise the strategy for inline asm.
Dan Gohman [Wed, 8 Nov 2017 19:18:08 +0000 (19:18 +0000)]
[WebAssembly] Revise the strategy for inline asm.

Previously, an "r" constraint would mean the compiler provides a value
on WebAssembly's operand stack. This was tricky to use properly,
particularly since it isn't possible to declare a new local from within
an inline asm string.

With this patch, "r" provides the value in a WebAssembly local, and the
local index is provided to the inline asm string. This requires inline
asm to use get_local and set_local to read the register. This does
potentially result in larger code size, however inline asm should
hopefully be quite rare in WebAssembly.

This also means that the "m" constraint can no longer be supported, as
WebAssembly has nothing like a "memory operand" that includes an
implicit get_local.

This fixes PR34599 for the wasm32-unknown-unknown-wasm target (though
not for the ELF target).

llvm-svn: 317707

6 years ago[bindings] fix TLS test failure
Masud Rahman [Wed, 8 Nov 2017 19:17:27 +0000 (19:17 +0000)]
[bindings] fix TLS test failure

Since cfe commit r237337, '__declspec(thread)' and 'thread_local' have
been the same since MSVC 2015.  i.e. they are both considered to supply
a dynamic TLS kind, not a static TLS kind.

This test originally did not specify which version of MS compatibility
to assume.  As a result, the test was brittle, since changing the
default compatibility version could break the test.

This commit adds a specific version when building up the flags used to
parse the translation unit, and tests both versions.

llvm-svn: 317706

6 years agoImplement flock for Windows in compiler-rt
Marco Castelluccio [Wed, 8 Nov 2017 19:11:54 +0000 (19:11 +0000)]
Implement flock for Windows in compiler-rt

Summary:
This patch implements flock for Windows, needed to make gcda writing work in a multiprocessing scenario.

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

Reviewers: zturner

Reviewed By: zturner

Subscribers: rnk, zturner, llvm-commits

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

llvm-svn: 317705

6 years agoNFC: Rename MCSafeSEHFragment to MCSymbolIdFragment
Adrian McCarthy [Wed, 8 Nov 2017 18:57:02 +0000 (18:57 +0000)]
NFC:  Rename MCSafeSEHFragment to MCSymbolIdFragment

Summary:
This fragment emits a symbol ID and will be useful for more than just Safe SEH
tables (e.g., I plan to re-use it for Control Flow Guard tables).  This is
simply a rename refactor.

Reviewers: rnk

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 317703

6 years agoHandle inlined variables in SelectionDAGBuilder::EmitFuncArgumentDbgValue().
Adrian Prantl [Wed, 8 Nov 2017 18:27:13 +0000 (18:27 +0000)]
Handle inlined variables in SelectionDAGBuilder::EmitFuncArgumentDbgValue().

In 2010 a commit with no testcase and no further explanation
explicitly disabled the handling of inlined variables in
EmitFuncArgumentDbgValue(). I don't think there is a good reason for
this any more and re-enabling this adds debug locations for variables
associated with an LLVM function argument in functions that are
inlined into the first basic block. The only downside of doing this is
that we may insert a DBG_VALUE before the inlined scope, but (1) this
could be filtered out later, and (2) LiveDebugValues will not
propagate it into subsequent basic blocks if they don't dominate the
variable's lexical scope, so this seems like a small price to pay.

rdar://problem/26228128

llvm-svn: 317702

6 years ago[analyzer] Fix a crash on logical operators with vectors.
Artem Dergachev [Wed, 8 Nov 2017 17:27:58 +0000 (17:27 +0000)]
[analyzer] Fix a crash on logical operators with vectors.

Do not crash when trying to compute x && y or x || y where x and y are
of a vector type.

For now we do not seem to properly model operations with vectors. In particular,
operations && and || on a pair of vectors are not short-circuit, unlike regular
logical operators, so even our CFG is incorrect.

Avoid the crash, add respective FIXME tests for later.

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

rdar://problem/34317663

llvm-svn: 317700

6 years ago[sanitizer] Add Scudo to the sanitizer lint checks.
Kostya Kortchinsky [Wed, 8 Nov 2017 16:42:29 +0000 (16:42 +0000)]
[sanitizer] Add Scudo to the sanitizer lint checks.

Summary:
Scudo abides by the coding style enforced by the sanitizer_common
linter, but as of right now, it's not linter-enforced.

Add Scudo to the list of directories checked by check_lint.sh.

Also: fixes some linter errors found after getting this running.

Reviewers: cryptoad

Reviewed By: cryptoad

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 317699

6 years ago[X86] Add some initial scheduling tests for generic x86 instructions
Simon Pilgrim [Wed, 8 Nov 2017 16:35:42 +0000 (16:35 +0000)]
[X86] Add some initial scheduling tests for generic x86 instructions

These will be using inline asm to ensure we have coverage that we're unlikely to get from lowering of basic ir.

Currently waiting for D39728 to land to add support for scheduler comments for inline asm.

llvm-svn: 317698

6 years ago[clang-refactor] Get rid of OccurrencesFinder in RenamingAction, NFC
Haojian Wu [Wed, 8 Nov 2017 14:53:08 +0000 (14:53 +0000)]
[clang-refactor] Get rid of OccurrencesFinder in RenamingAction, NFC

Summary:
The OccurrencesFinder is only used in RenameOccurrences to find symbol
occurrences, there is no need to inherit RefactoringRule.

Replace it with a single utility function to avoid code misleading.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 317696

6 years ago[CMake] Remove target to build native tablegen
Jonas Hahnfeld [Wed, 8 Nov 2017 14:31:54 +0000 (14:31 +0000)]
[CMake] Remove target to build native tablegen

This was once needed so that multiple tablegen binaries don't compile
the library concurrently. However, this isn't needed anymore since
adding USES_TERMINAL to the custom_command.
This is supported by the fact that the target was only building
LLVMSupport since some cleanups a year ago. If this dependency had
really been needed, we would have seen complaints.

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

llvm-svn: 317695

6 years ago[CMake] Add custom target to create build directory
Jonas Hahnfeld [Wed, 8 Nov 2017 14:31:51 +0000 (14:31 +0000)]
[CMake] Add custom target to create build directory

CMake does a poor job in tracking dependencies on files and directories
directly. Create custom target similar to the configuration step.
On my system, this avoids the reconfiguration on each build.

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

llvm-svn: 317694

6 years ago[utils] Add RISC-V support to update_llc_test_checks.py
Alex Bradbury [Wed, 8 Nov 2017 14:24:42 +0000 (14:24 +0000)]
[utils] Add RISC-V support to update_llc_test_checks.py

This should be a trivial change, and I've started using it for generating all
tests at https://github.com/lowrisc/riscv-llvm (i.e. it's been tested in
action quite a lot). Note that the regex does not attempt to match
.cfi_startproc, as I want to ensure compatibility with functions that have the
nounwind attribute.

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

llvm-svn: 317693

6 years agoRelax definitions.test to accept windows file paths.
Sam McCall [Wed, 8 Nov 2017 13:52:21 +0000 (13:52 +0000)]
Relax definitions.test to accept windows file paths.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 317692

6 years ago[RISCV] Initial support for function calls
Alex Bradbury [Wed, 8 Nov 2017 13:41:21 +0000 (13:41 +0000)]
[RISCV] Initial support for function calls

Note that this is just enough for simple function call examples to generate
working code. Support for varargs etc follows in future patches.

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

llvm-svn: 317691

6 years ago[RISCV] Codegen for conditional branches
Alex Bradbury [Wed, 8 Nov 2017 13:31:40 +0000 (13:31 +0000)]
[RISCV] Codegen for conditional branches

A good portion of this patch is the extra functions that needed to be
implemented to support the test case. e.g. storeRegToStackSlot,
loadRegFromStackSlot, eliminateFrameIndex.

Setting ISD::BR_CC to Expand may appear non-obvious on an architecture with
branch+cmp instructions. However, I found it much easier to deal with matching
the expanded form.

I had to change simm13_lsb0 and simm21_lsb0 to inherit from the
Operand<OtherVT> class rather than Operand<i32> in order to keep tablegen
happy. This isn't a big deal, but it does seem a shame to lose the uniformity
across immediate types when there's not an obvious benefit (I'm hoping a
tablegen expert will educate me on what I'm missing here!).

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

llvm-svn: 317690

6 years ago[clang-tidy] Add a note about modernize-replace-random-shuffle
Krasimir Georgiev [Wed, 8 Nov 2017 13:28:53 +0000 (13:28 +0000)]
[clang-tidy] Add a note about modernize-replace-random-shuffle

Summary:
This adds a note warning the users that the way the suggested fix seeds the
random number generator is poor.

Reviewers: hokein

Reviewed By: hokein

Subscribers: cfe-commits, xazax.hun

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

llvm-svn: 317689

6 years ago[RISCV] Codegen support for memory operations on global addresses
Alex Bradbury [Wed, 8 Nov 2017 13:24:21 +0000 (13:24 +0000)]
[RISCV] Codegen support for memory operations on global addresses

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

llvm-svn: 317688

6 years agoWorkaround reverse-iteration buildbot breakages. Filed PR35244.
Ilya Biryukov [Wed, 8 Nov 2017 13:05:52 +0000 (13:05 +0000)]
Workaround reverse-iteration buildbot breakages. Filed PR35244.

Clang's completion output is non-deterministic, causing test failures
with turned on LLVM_REVERSE_ITERATION.
The workaround is to use CHECK-DAGs for now, will remove them when
PR35244 gets fixed.

llvm-svn: 317687

6 years ago[clangd] tolerate windows filepaths in tests
Sam McCall [Wed, 8 Nov 2017 12:25:00 +0000 (12:25 +0000)]
[clangd] tolerate windows filepaths in tests

llvm-svn: 317686

6 years ago[RISCV] Codegen support for memory operations
Alex Bradbury [Wed, 8 Nov 2017 12:20:01 +0000 (12:20 +0000)]
[RISCV] Codegen support for memory operations

This required the implementation of RISCVTargetInstrInfo::copyPhysReg. Support
for lowering global addresses follow in the next patch.

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

llvm-svn: 317685

6 years ago[RISCV] Codegen support for materializing constants
Alex Bradbury [Wed, 8 Nov 2017 12:02:22 +0000 (12:02 +0000)]
[RISCV] Codegen support for materializing constants

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

llvm-svn: 317684

6 years agoXfail TestConcurrentTwoWatchpointsOneSignal on arm
Pavel Labath [Wed, 8 Nov 2017 11:51:49 +0000 (11:51 +0000)]
Xfail TestConcurrentTwoWatchpointsOneSignal on arm

r317561 exposed an interesting bug (pr35228) in handling of simultaneous
watchpoint hits. Disabling the test until we can get that fixed.

llvm-svn: 317683

6 years ago[Analysis] Fix merging TBAA tags with different final access types
Ivan A. Kosarev [Wed, 8 Nov 2017 11:42:21 +0000 (11:42 +0000)]
[Analysis] Fix merging TBAA tags with different final access types

There are cases when we have to merge TBAA access tags with the
same base access type, but different final access types. For
example, accesses to different members of the same structure may
be vectorized into a single load or store instruction. Since we
currently assume that the tags to merge always share the same
final access type, we incorrectly return a tag that describes an
access to one of the original final access types as the generic
tag. This patch fixes that by producing generic tags for the
common type and not the final access types of the original tags.

Resolves:
PR35225: Wrong tbaa metadata after load store vectorizer due to
recent change
https://bugs.llvm.org/show_bug.cgi?id=35225

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

llvm-svn: 317682

6 years ago[mips] Guard indirect and tailcall pseudo instructions correctly.
Simon Dardis [Wed, 8 Nov 2017 11:13:44 +0000 (11:13 +0000)]
[mips] Guard indirect and tailcall pseudo instructions correctly.

Previously these pseudo instructions were not guarded by ISA, so their
select was dependant on the ordering of the entries in the DAG matcher.

Reviewers: atanasyan

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

llvm-svn: 317681

6 years agoBasicAA: fix bug where we would return partialalias instead of noalias
Nuno Lopes [Wed, 8 Nov 2017 10:59:00 +0000 (10:59 +0000)]
BasicAA: fix bug where we would return partialalias instead of noalias
My fix is conservative and will make us return may-alias instead.

The test case is:
check(gep(x, 0), n, gep(x, n), -1)  with  n == sizeof(x)

Here, the first value accesses the whole object, but the second access
doesn't access anything. The semantics of -1 is read until the end of the
object, which in this case means read nothing.

No test case, since isn't trivial to exploit this one, but I've proved it correct.

llvm-svn: 317680

6 years agoLog: delimit thread name in log message
Pavel Labath [Wed, 8 Nov 2017 10:48:54 +0000 (10:48 +0000)]
Log: delimit thread name in log message

The thread name was not followed by a space, which meant it was glued to
the log message. I also align the name as we do that with other log
fields. I align it to 16 chars instead of llvm::max_thread_name(), as
that can be 64 on darwin, which is rather long. If anybody feels
differently about that, we can change it.

llvm-svn: 317679

6 years agoMake TestTopLevelExprs more robust in face of linker GC
Pavel Labath [Wed, 8 Nov 2017 10:48:50 +0000 (10:48 +0000)]
Make TestTopLevelExprs more robust in face of linker GC

Summary:
This test was failing in various configurations on linux in a fairly
unpredictible way. The success depended on whether the c++ abi library
was linked in statically or not and how well was the linker able to
strip parts of it. This introduces additional code to the "dummmy" test
executable, which ensures that all parts of the library needed to
evaluate the expressions are always present.

Reviewers: clayborg

Subscribers: srhines, tatyana-krasnukha, davide, lldb-commits

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

llvm-svn: 317678

6 years agoAvoid printing some redundant name qualifiers in completion
Ilya Biryukov [Wed, 8 Nov 2017 10:39:09 +0000 (10:39 +0000)]
Avoid printing some redundant name qualifiers in completion

Summary:
Adjusted PrintingPolicy inside code completion to avoid printing some
redundant name qualifiers.

Before this change, typedefs that were written unqualified in source
code were printed with qualifiers in completion. For example, in the
following code

    struct foo {
        typedef int type;
        type method();
    };

completion item for `method` had return type of `foo::type`, even
though the original code used `type` without qualifiers.
After this change, the completion item has return type `type`, as
originally written in the source code.

Note that this change does not suppress qualifiers written by the
user. For example, in the following code

    typedef int type;
    struct foo {
        typedef int type;
        ::type method(foo::type);
    };

completion item for `method` has return type of `::type` and
parameter type of `foo::type`, as originally written in the source
code.

Reviewers: arphaman, bkramer, klimek

Reviewed By: arphaman

Subscribers: mgorny, eraman, cfe-commits

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

llvm-svn: 317677

6 years agoMoved QualTypeNames.h from Tooling to AST.
Ilya Biryukov [Wed, 8 Nov 2017 10:39:03 +0000 (10:39 +0000)]
Moved QualTypeNames.h from Tooling to AST.

Summary:
For code reuse in SemaCodeComplete.
Note that the tests for QualTypeNames are still in Tooling as they use
Tooling's common testing code.

Reviewers: rsmith, saugustine, rnk, klimek, bkramer

Reviewed By: rnk

Subscribers: cfe-commits, mgorny

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

llvm-svn: 317676

6 years agoFixed link to bugzilla in the sidebar
Raphael Isemann [Wed, 8 Nov 2017 10:10:31 +0000 (10:10 +0000)]
Fixed link to bugzilla in the sidebar

llvm-svn: 317675

6 years ago[NFCI] Ensure TargetOpcode::* are compatible with guessInstructionProperties=0
Alex Bradbury [Wed, 8 Nov 2017 09:26:06 +0000 (09:26 +0000)]
[NFCI] Ensure TargetOpcode::* are compatible with guessInstructionProperties=0

rL162640 introduced CodeGenTarget::guessInstructionProperties. If a target
sets guessInstructionProperties=0 in its FooInstrInfo, tablegen will error if
it has to guess properties from patterns. Unfortunately,
guessInstructionProperties=0 can't be used with current upstream LLVM as
instructions in the TargetOpcode namespace are always included and sometimes
have inferred properties for mayLoad, mayStore, and hasSideEffects. This patch
provides the simplest possible fix to this problem, setting default values for
these fields in the TargetOpcode scope. There is no intended functional
change, as the explicitly set properties should match what was previously
inferred. A number of the instructions had hasSideEffects=1 inferred
unintentionally. This patch makes it explicit, while future patches (such as
D37097) correct the property.

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

llvm-svn: 317674

6 years ago[clangd] loosen tests for flag-dependence revealed by r317670
Sam McCall [Wed, 8 Nov 2017 09:15:01 +0000 (09:15 +0000)]
[clangd] loosen tests for flag-dependence revealed by r317670

llvm-svn: 317673

6 years ago[clang-refactor] Introduce a new rename rule for qualified symbols
Haojian Wu [Wed, 8 Nov 2017 08:56:56 +0000 (08:56 +0000)]
[clang-refactor] Introduce a new rename rule for qualified symbols

Summary: Prototype of a new rename rule for renaming qualified symbol.

Reviewers: arphaman, ioeric, sammccall

Reviewed By: arphaman, sammccall

Subscribers: jklaehn, cfe-commits, klimek

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

llvm-svn: 317672

6 years agoDAG: Add computeKnownBitsForFrameIndex
Matt Arsenault [Wed, 8 Nov 2017 08:52:31 +0000 (08:52 +0000)]
DAG: Add computeKnownBitsForFrameIndex

Some of the AMDGPU stack addressing modes require knowing the sign
bit is zero. We used to accomplish this by custom lowering
frame indexes, and then putting an AssertZext around a
TargetFrameIndex. This required specifically looking for
the AssextZext + frame index pattern which was moderately
disgusting. The same could probably be accomplished
with a target specific node, but would still
require special handling of frame indexes.

llvm-svn: 317671

6 years ago[clangd] Sort completion results.
Sam McCall [Wed, 8 Nov 2017 07:44:12 +0000 (07:44 +0000)]
[clangd] Sort completion results.

Summary:
This is (probably) not required by LSP, but at least one buggy client wants it.
It also simplifies some tests - changed a few completion tests to use -pretty.

Reviewers: hokein, malaperle

Subscribers: ilya-biryukov, cfe-commits

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

llvm-svn: 317670

6 years ago[COFF] Add support for IMAGE_REL_ARM64_SECREL
Martin Storsjo [Wed, 8 Nov 2017 07:31:50 +0000 (07:31 +0000)]
[COFF] Add support for IMAGE_REL_ARM64_SECREL

I never ran into this until lld-link started enabling debug output
by default for the mingw mode. I haven't been able to verify that
this actually behaves correctly, but this relocation is handled
identically on all other architectures so far.

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

llvm-svn: 317669

6 years agoAlways use prctl(PR_SET_PTRACER)
Sylvestre Ledru [Wed, 8 Nov 2017 07:25:19 +0000 (07:25 +0000)]
Always use prctl(PR_SET_PTRACER)

Summary:
Sufficiently old Linux kernel headers don't provide the PR_SET_PTRACER, but we can still call prctl with it if the runtime kernel is newer. Even if it's not, prctl will only return EINVAL.

Patch by Mike Hommey <mh-llvm@glandium.org>

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: sylvestre.ledru, cfe-commits, kubamracek

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

llvm-svn: 317668

6 years agoRevert "[CGP] Enable extending scope of optimizeMemoryInst"
Serguei Katkov [Wed, 8 Nov 2017 05:38:54 +0000 (05:38 +0000)]
Revert "[CGP] Enable extending scope of optimizeMemoryInst"

Revert the patch r317665 causing buildbot failures.

llvm-svn: 317667

6 years ago[CGP] Enable extending scope of optimizeMemoryInst
Serguei Katkov [Wed, 8 Nov 2017 05:02:51 +0000 (05:02 +0000)]
[CGP] Enable extending scope of optimizeMemoryInst

This patch enables the folding of address computation in
memory instruction in case adress is represented by Phi node.

The inputs of Phi node might be different in base register.

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

llvm-svn: 317665

6 years ago[X86] Add masked vcvtps2ph builtins to CheckX86BuiltinFunctionCall.
Craig Topper [Wed, 8 Nov 2017 04:54:26 +0000 (04:54 +0000)]
[X86] Add masked vcvtps2ph builtins to CheckX86BuiltinFunctionCall.

This ensures that only immediates that fit in 8-bits are used. This matches what we do for the unmasked versions.

llvm-svn: 317664

6 years agoRemove a given file even if openFileForRead fails.
Rui Ueyama [Wed, 8 Nov 2017 04:22:40 +0000 (04:22 +0000)]
Remove a given file even if openFileForRead fails.

I think the constract of this function is to remove a file in some way,
whether in background or in foreground. This patch makes sure that it
removes a given file.

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

llvm-svn: 317663

6 years ago[X86] Add patterns to fold EVEX store with EVEX encoded vcvtps2ph instructions. Remov...
Craig Topper [Wed, 8 Nov 2017 04:00:31 +0000 (04:00 +0000)]
[X86] Add patterns to fold EVEX store with EVEX encoded vcvtps2ph instructions. Remove bad pattern that had vf432 vcvtps2ph storing 128-bits.

llvm-svn: 317662

6 years ago[X86] Allow legacy vcvtps2ph intrinsics to select EVEX encoded instructions. Rely...
Craig Topper [Wed, 8 Nov 2017 04:00:30 +0000 (04:00 +0000)]
[X86] Allow legacy vcvtps2ph intrinsics to select EVEX encoded instructions. Rely on EVEX->VEX to convert back.

Missed store folding opportunities will be fixed in a subsequent commit.

llvm-svn: 317661

6 years agoUpdate for llvm change.
Rafael Espindola [Wed, 8 Nov 2017 01:50:34 +0000 (01:50 +0000)]
Update for llvm change.

llvm-svn: 317657

6 years agoConvert FileOutputBuffer::commit to Error.
Rafael Espindola [Wed, 8 Nov 2017 01:50:29 +0000 (01:50 +0000)]
Convert FileOutputBuffer::commit to Error.

llvm-svn: 317656

6 years agoRevert "[scudo] Make getNumberOfCPUs Fuchsia compliant"
Reid Kleckner [Wed, 8 Nov 2017 01:33:15 +0000 (01:33 +0000)]
Revert "[scudo] Make getNumberOfCPUs Fuchsia compliant"

This reverts commit r317604.

Android doesn't have cpu_set_t.

llvm-svn: 317655

6 years agoRevert "Reapply: Allow yaml2obj to order implicit sections for ELF"
Dave Lee [Wed, 8 Nov 2017 01:31:20 +0000 (01:31 +0000)]
Revert "Reapply: Allow yaml2obj to order implicit sections for ELF"

This reverts commit r317646.

llvm-svn: 317654

6 years agoUpdate unittest too.
Rafael Espindola [Wed, 8 Nov 2017 01:10:05 +0000 (01:10 +0000)]
Update unittest too.

llvm-svn: 317651

6 years agoUpdate for llvm change.
Rafael Espindola [Wed, 8 Nov 2017 01:05:52 +0000 (01:05 +0000)]
Update for llvm change.

llvm-svn: 317650

6 years agoConvert FileOutputBuffer to Expected. NFC.
Rafael Espindola [Wed, 8 Nov 2017 01:05:44 +0000 (01:05 +0000)]
Convert FileOutputBuffer to Expected. NFC.

llvm-svn: 317649

6 years ago[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings;...
Eugene Zelenko [Wed, 8 Nov 2017 01:03:16 +0000 (01:03 +0000)]
[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 317648

6 years agoTarget/TargetInstrInfo.h -> CodeGen/TargetInstrInfo.h to match layering
David Blaikie [Wed, 8 Nov 2017 01:01:31 +0000 (01:01 +0000)]
Target/TargetInstrInfo.h -> CodeGen/TargetInstrInfo.h to match layering

This header includes CodeGen headers, and is not, itself, included by
any Target headers, so move it into CodeGen to match the layering of its
implementation.

llvm-svn: 317647

6 years agoReapply: Allow yaml2obj to order implicit sections for ELF
Dave Lee [Wed, 8 Nov 2017 00:58:50 +0000 (00:58 +0000)]
Reapply: Allow yaml2obj to order implicit sections for ELF

Summary:
This change allows yaml input to control the order of implicitly added sections
(`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a
placeholder section of the given name to the Sections field.

This change is to support changes in D39582, where it is desirable to control
the location of the `.dynsym` section.

This reapplied version fixes:
  1. use of a function call within an assert
  2. failing lld test which has an unnamed section

Additionally, one more test to cover the unnamed section failure.

Reviewers: compnerd, jakehehrlich

Reviewed By: jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 317646

6 years agoAMDGPU: Set correct sched model on v_mad_u64_u32
Matt Arsenault [Wed, 8 Nov 2017 00:48:25 +0000 (00:48 +0000)]
AMDGPU: Set correct sched model on v_mad_u64_u32

llvm-svn: 317645

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 8 Nov 2017 00:39:18 +0000 (00:39 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 317644

6 years agoFix compile issue on MSVC.
Douglas Yung [Wed, 8 Nov 2017 00:29:42 +0000 (00:29 +0000)]
Fix compile issue on MSVC.

llvm-svn: 317642

6 years agoRevert rL317618
Mitch Phillips [Wed, 8 Nov 2017 00:20:53 +0000 (00:20 +0000)]
Revert rL317618

The implemented pass fails and is breaking a large number of unit tests.
Example:
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/5777/steps/build-stage3-compiler/logs/stdio

This reverts commit rL317618

llvm-svn: 317641

6 years ago[sanitizer] Asm implementation of syscall() for arm32.
Evgeniy Stepanov [Wed, 8 Nov 2017 00:15:12 +0000 (00:15 +0000)]
[sanitizer] Asm implementation of syscall() for arm32.

Summary:
These will be used in an ifunc resolver, when the binary may not be
completely relocated, and syscall() function from libc could not be
used.

Reviewers: dvyukov, vitalybuka

Subscribers: aemerson, kubamracek, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 317640

6 years agoAttribute nonlazybind should not affect calls to functions with hidden visibility.
Sriraman Tallam [Wed, 8 Nov 2017 00:01:05 +0000 (00:01 +0000)]
Attribute nonlazybind should not affect calls to functions with hidden visibility.

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

llvm-svn: 317639

6 years ago(NFC) Rename GetMax{,User}VirtualAddress.
Evgeniy Stepanov [Tue, 7 Nov 2017 23:51:22 +0000 (23:51 +0000)]
(NFC) Rename GetMax{,User}VirtualAddress.

Future change will introduce GetMaxVirtualAddress that will not take
the kernel area into account.

llvm-svn: 317638

6 years agoFix unused variable error.
Rafael Espindola [Tue, 7 Nov 2017 23:43:01 +0000 (23:43 +0000)]
Fix unused variable error.

llvm-svn: 317637

6 years agoCleanup version symbol macros and attributes/declspecs
Jonathan Peyton [Tue, 7 Nov 2017 23:32:13 +0000 (23:32 +0000)]
Cleanup version symbol macros and attributes/declspecs

1) Get rid of xaliasify, xexpand and xversionify for KMP_EXPAND_NAME and
KMP_VERSION_SYMBOL. KMP_VERSION_SYMBOL is a combination of xaliasify and
xversionify.

2) Put all attribute and __declspec definitions in kmp_os.h

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

llvm-svn: 317636

6 years ago[coff] use relative instead of absolute __safe_se_handler_base when present
Bob Haarman [Tue, 7 Nov 2017 23:24:10 +0000 (23:24 +0000)]
[coff] use relative instead of absolute __safe_se_handler_base when present

Summary:
__safe_se_handler_base should be either absolute 0 (when no SafeSEH
table is present), or relative to the image base (when the table is
present). An earlier change inadvertedly made the symbol absolute in
both cases, leading to the SafeSEH table not being locatble at run
time. This change fixes that and updates the safeseh test to check for
the presence of the relocation.

Reviewers: rnk, ruiu

Reviewed By: ruiu

Subscribers: ruiu, llvm-commits

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

llvm-svn: 317635

6 years agoReapply r317609 with a simpler sed script, thanks to Justin Bogner!
Paul Robinson [Tue, 7 Nov 2017 23:17:43 +0000 (23:17 +0000)]
Reapply r317609 with a simpler sed script, thanks to Justin Bogner!

llvm-svn: 317634

6 years agoDelete dead code.
Rafael Espindola [Tue, 7 Nov 2017 23:12:41 +0000 (23:12 +0000)]
Delete dead code.

llvm-svn: 317633

6 years agoUse std::thread directly.
Rafael Espindola [Tue, 7 Nov 2017 23:09:54 +0000 (23:09 +0000)]
Use std::thread directly.

Now that this code is posix only we don't need to use runBackground.

llvm-svn: 317632

6 years agoSimplify unlinkAsync.
Rafael Espindola [Tue, 7 Nov 2017 23:01:37 +0000 (23:01 +0000)]
Simplify unlinkAsync.

It used to rename the file before removing it in a background thread.

A simpler way to delay the removal is simply to open the file.

Since this is a posix specific issue, simplify the windows
implementation.

llvm-svn: 317631

6 years agoRevert "Allow yaml2obj to order implicit sections for ELF"
Dave Lee [Tue, 7 Nov 2017 22:51:27 +0000 (22:51 +0000)]
Revert "Allow yaml2obj to order implicit sections for ELF"

Also, revert "Fix build bots after r317622"

This reverts commit r317622, r317626.

llvm-svn: 317630

6 years agoRevert r317609, test fails on one bot
Paul Robinson [Tue, 7 Nov 2017 22:39:12 +0000 (22:39 +0000)]
Revert r317609, test fails on one bot

llvm-svn: 317628

6 years agoChange noplt.c to work for non-x86 targets.
Sriraman Tallam [Tue, 7 Nov 2017 22:34:55 +0000 (22:34 +0000)]
Change noplt.c to work for non-x86 targets.

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

llvm-svn: 317627

6 years agoFix build bots after r317622
Dave Lee [Tue, 7 Nov 2017 22:33:07 +0000 (22:33 +0000)]
Fix build bots after r317622

Example build failure: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/14660

TIL that the warning flags for local builds are loose compared to what build
servers use.

llvm-svn: 317626

6 years agoDelete unused constructor.
Rafael Espindola [Tue, 7 Nov 2017 22:30:53 +0000 (22:30 +0000)]
Delete unused constructor.

llvm-svn: 317625

6 years agoUpdate tuple/list/deque data formatters to work with newest libc++
Pavel Labath [Tue, 7 Nov 2017 22:17:29 +0000 (22:17 +0000)]
Update tuple/list/deque data formatters to work with newest libc++

Summary:
A couple of members of these data structures have been renamed in recent
months. This makes sure they still work with the latest libc++ version.

Reviewers: jingham, EricWF

Subscribers: lldb-commits

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

llvm-svn: 317624

6 years ago[NVPTX] Implement __nvvm_atom_add_gen_d builtin.
Justin Lebar [Tue, 7 Nov 2017 22:10:54 +0000 (22:10 +0000)]
[NVPTX] Implement __nvvm_atom_add_gen_d builtin.

Summary:
This just seems to have been an oversight.  We already supported the f64
atomic add with an explicit scope (e.g. "cta"), but not the scopeless
version.

Reviewers: tra

Subscribers: jholewinski, sanjoy, cfe-commits, llvm-commits, hiraditya

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

llvm-svn: 317623

6 years agoAllow yaml2obj to order implicit sections for ELF
Dave Lee [Tue, 7 Nov 2017 22:05:24 +0000 (22:05 +0000)]
Allow yaml2obj to order implicit sections for ELF

Summary:
This change allows yaml input to control the order of implicitly added sections
(`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a
placeholder section of the given name to the Sections field.

This change is to support changes in D39582, where it is desirable to control
the location of the `.dynsym` section.

Reviewers: compnerd, jakehehrlich

Reviewed By: jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 317622

6 years ago[ObjC++] Don't warn about pessimizing move for __block variables
Alex Lorenz [Tue, 7 Nov 2017 21:40:11 +0000 (21:40 +0000)]
[ObjC++] Don't warn about pessimizing move for __block variables

rdar://33316951

llvm-svn: 317620

6 years ago[SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer...
Dinar Temirbulatov [Tue, 7 Nov 2017 21:25:34 +0000 (21:25 +0000)]
[SLPVectorizer] Failure to beneficially vectorize 'copyable' elements in integer binary ops.

    Patch tries to improve vectorization of the following code:

    void add1(int * __restrict dst, const int * __restrict src) {
      *dst++ = *src++;
      *dst++ = *src++ + 1;
      *dst++ = *src++ + 2;
      *dst++ = *src++ + 3;
    }
    Allows to vectorize even if the very first operation is not a binary add, but just a load.

    Fixed PR34619 and other issues related to previous commit.

    Reviewers: spatel, mzolotukhin, mkuper, hfinkel, RKSimon, filcab, ABataev

    Reviewed By: ABataev, RKSimon

    Subscribers: llvm-commits, RKSimon

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

llvm-svn: 317618

6 years agoExtend SpecialCaseList to allow users to blame matches on entries in the file.
Mitch Phillips [Tue, 7 Nov 2017 21:16:46 +0000 (21:16 +0000)]
Extend SpecialCaseList to allow users to blame matches on entries in the file.

Summary:
Extends SCL functionality to allow users to find the line number in the file the SCL is built from through SpecialCaseList::inSectionBlame(...).

Also removes the need to compile the SCL before use. As the matcher now contains a list of regexes to test against instead of a single regex, the regexes can be individually built on each insertion rather than one large compilation at the end of construction.

This change also fixes a bug where blank lines would cause the parser to become out-of-sync with the line number. An error on line `k` was being reported as being on line `k - num_blank_lines_before_k`.

Note: This change has a cyclical dependency on D39486. Both these changes must be submitted at the same time to avoid a build breakage.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: kcc, pcc, llvm-commits

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

llvm-svn: 317617

6 years agoUpdate SanitizerSpecialCaseList to use renamed functions in base class.
Mitch Phillips [Tue, 7 Nov 2017 21:16:37 +0000 (21:16 +0000)]
Update SanitizerSpecialCaseList to use renamed functions in base class.

Note: This change has a cyclical dependency on D39485. Both these changes must be submitted at the same time to avoid a build breakage.

Reviewers: vlad.tsyrklevich

Subscribers: llvm-commits

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

llvm-svn: 317616

6 years ago[CodeGenPrepare] Fix typo in comment. NFC
Craig Topper [Tue, 7 Nov 2017 20:56:17 +0000 (20:56 +0000)]
[CodeGenPrepare] Fix typo in comment. NFC

llvm-svn: 317614

6 years agoUse new vector insert half-word and byte instructions when we see insertelement on...
Graham Yiu [Tue, 7 Nov 2017 20:55:43 +0000 (20:55 +0000)]
Use new vector insert half-word and byte instructions when we see insertelement on '8 x i16' and '16 x i8' types.  Also extended existing lit testcase to cover these cases.

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

llvm-svn: 317613

6 years agoConvert a dwarfdump test from checked-in binary to assembler source.
Paul Robinson [Tue, 7 Nov 2017 20:35:44 +0000 (20:35 +0000)]
Convert a dwarfdump test from checked-in binary to assembler source.

llvm-svn: 317612

6 years agoTeach test suite about C++2a dialect flag.
Eric Fiselier [Tue, 7 Nov 2017 20:26:23 +0000 (20:26 +0000)]
Teach test suite about C++2a dialect flag.

This patch teaches the test suite configuration about the -std=c++2a
flag. And, since it's the newest dialect, change the test suite to
choose it, if possible, by default.

llvm-svn: 317611

6 years agoChange test suite to support c++17 dialect flag instead of c++1z.
Eric Fiselier [Tue, 7 Nov 2017 20:20:58 +0000 (20:20 +0000)]
Change test suite to support c++17 dialect flag instead of c++1z.

This patch changes the test suite to attempt and prefer -std=c++17 over
-std=c++1z. It also fixes the REQUIRES and UNSUPPORTED lit markers
to refer to c++17 over c++1z.

llvm-svn: 317610

6 years ago[DWARFv5] Add new test for previous commit.
Paul Robinson [Tue, 7 Nov 2017 20:12:58 +0000 (20:12 +0000)]
[DWARFv5] Add new test for previous commit.

llvm-svn: 317609

6 years ago[sanitizer] Fix sanitizer_common compile errors on gcc trunk
Vitaly Buka [Tue, 7 Nov 2017 20:10:17 +0000 (20:10 +0000)]
[sanitizer] Fix sanitizer_common compile errors on gcc trunk

Summary:
When testing a merge of compiler-rt r304709 into gcc trunk on x86-64-pc-linux-gnu,
I ran into two compile errors:
sanitizer_common/sanitizer_symbolizer_libbacktrace.cc:96:73: error: no matching function for call to '__sanitizer::AddressInfo::FillModuleInfo(char*&, __sanitizer::uptr&)'

All other files in sanitizer_common (with the exception of sanitizer_malloc_mac.inc
which is special) include sanitizer_platform.h without directory name.

Patch by Mike Jongen

Reviewers: kcc, vitalybuka

Reviewed By: kcc

Subscribers: kubamracek, fedor.sergeev, llvm-commits

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

llvm-svn: 317608

6 years ago[DWARFv5] Support DW_FORM_strp in the .debug_line header.
Paul Robinson [Tue, 7 Nov 2017 19:57:12 +0000 (19:57 +0000)]
[DWARFv5] Support DW_FORM_strp in the .debug_line header.

Supporting this form in .debug_line.dwo will be done as a follow-up.

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

llvm-svn: 317607

6 years agoNew clang option -fno-plt which avoids the PLT and lazy binding while making external...
Sriraman Tallam [Tue, 7 Nov 2017 19:37:51 +0000 (19:37 +0000)]
New clang option -fno-plt which avoids the PLT and lazy binding while making external calls.

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

llvm-svn: 317605

6 years ago[scudo] Make getNumberOfCPUs Fuchsia compliant
Kostya Kortchinsky [Tue, 7 Nov 2017 19:30:08 +0000 (19:30 +0000)]
[scudo] Make getNumberOfCPUs Fuchsia compliant

Summary: This change allows Fuchsia to boot properly using the Scudo allocator.

Reviewers: cryptoad, alekseyshl, krytarowski

Reviewed By: cryptoad, krytarowski

Subscribers: krytarowski, kubamracek, llvm-commits

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

llvm-svn: 317604