platform/upstream/llvm.git
8 years agoReplace a loop with a for-each loop. No behavior change.
Nico Weber [Wed, 20 Apr 2016 19:09:26 +0000 (19:09 +0000)]
Replace a loop with a for-each loop. No behavior change.

llvm-svn: 266903

8 years agoIR: Avoid mallocs in constructor of ModuleSlotTracker
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 19:05:59 +0000 (19:05 +0000)]
IR: Avoid mallocs in constructor of ModuleSlotTracker

A ModuleSlotTracker can be created without actually being used (e.g.,
r266889 added one to the Verifier).  Create the SlotTracker within it
lazily on the first call to ModuleSlotTracker::getMachine.

llvm-svn: 266902

8 years ago[MC] Silence warning due to unused variable in !Debug builds.
Davide Italiano [Wed, 20 Apr 2016 18:45:31 +0000 (18:45 +0000)]
[MC] Silence warning due to unused variable in !Debug builds.

llvm-svn: 266901

8 years agoVerifier: Add ModuleSlotTracker to printAsOperand call
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 18:42:51 +0000 (18:42 +0000)]
Verifier: Add ModuleSlotTracker to printAsOperand call

I missed this site in r266889.

llvm-svn: 266900

8 years ago[LTO] Another type merge test.
Davide Italiano [Wed, 20 Apr 2016 18:38:09 +0000 (18:38 +0000)]
[LTO] Another type merge test.

llvm-svn: 266899

8 years ago[lanai] Add subword scheduling itineraries.
Jacques Pienaar [Wed, 20 Apr 2016 18:28:55 +0000 (18:28 +0000)]
[lanai] Add subword scheduling itineraries.

Differentiate between word and subword memory operations as they take different
amount of cycles to complete. This just adds a basic model of the subword
latency to the scheduler.

llvm-svn: 266898

8 years agoVerifier: Prefer early continue over if-nesting, NFC
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 18:27:18 +0000 (18:27 +0000)]
Verifier: Prefer early continue over if-nesting, NFC

llvm-svn: 266897

8 years ago[LTO] Add a test to ensure we handle basic type merging correctly.
Davide Italiano [Wed, 20 Apr 2016 18:10:25 +0000 (18:10 +0000)]
[LTO] Add a test to ensure we handle basic type merging correctly.

llvm-svn: 266896

8 years ago[MC] EmitNop: Make an assertion more useful.
Davide Italiano [Wed, 20 Apr 2016 17:53:21 +0000 (17:53 +0000)]
[MC] EmitNop: Make an assertion more useful.

Differential Revision:  http://reviews.llvm.org/D19334

llvm-svn: 266895

8 years agoLTO: Verify the input even if optimize() isn't called
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 17:48:22 +0000 (17:48 +0000)]
LTO: Verify the input even if optimize() isn't called

Clients may call writeMergedModules before calling optimize, or call
compileOptimized without calling optimize.  Make sure they don't sneak
past the verifier.  This adds LTOCodeGenerator::verifyMergedModuleOnce,
and calls it from writeMergedModule, optimize, and codegenOptimized.

I couldn't find a good way to test this.  I tried writing broken IR to
send into llvm-lto, but LTOCodeGenerator doesn't understand textual IR,
and assembler runs the verifier itself anyway.  Checking in
valid-but-doesn't-verify bitcode here doesn't seem valuable.

llvm-svn: 266894

8 years agoModuleLinker: only import what is in GlobalsToImport, regarless if it is a function...
Mehdi Amini [Wed, 20 Apr 2016 17:47:42 +0000 (17:47 +0000)]
ModuleLinker: only import what is in GlobalsToImport, regarless if it is a function or not.

The alias handling was specific to the old iterative inlining
mechanism, so that is dead now. The variable handling could make a
difference, since we were previously falling through to the normal
selection logic, but we don't observe changes in the validation
because no client seems to rely on it.

Differential Revision: http://reviews.llvm.org/D19307

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266893

8 years agobuiltins: fix -Werror,-Wunused-variable warning
Saleem Abdulrasool [Wed, 20 Apr 2016 17:43:43 +0000 (17:43 +0000)]
builtins: fix -Werror,-Wunused-variable warning

This removes the unused variable `flags`.  NFC

llvm-svn: 266892

8 years agobuiltins: remove use of __attribute__((pcs("aapcs"))) on Windows
Saleem Abdulrasool [Wed, 20 Apr 2016 17:43:40 +0000 (17:43 +0000)]
builtins: remove use of __attribute__((pcs("aapcs"))) on Windows

Windows does not honour the __attribute__((pcs)) on ARM.  Although this will
result in ABI mismatches, compiler-rt should largely be unneeded for resolving
dependencies as we generate MS ABI compliant library calls now for the most
part.

llvm-svn: 266891

8 years agoDelete refersToGotEntry.
Rafael Espindola [Wed, 20 Apr 2016 17:30:22 +0000 (17:30 +0000)]
Delete refersToGotEntry.

It can be computed from the expression.

llvm-svn: 266890

8 years agoIR: Use a single ModuleSlotTracker in the Verifier
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 17:27:44 +0000 (17:27 +0000)]
IR: Use a single ModuleSlotTracker in the Verifier

Speed up Verifier output by sharing a single ModuleSlotTracker for the
duration.  There should be no functionality change here except for much
faster output when there's more than one statement.

Now the Verifier won't be traversing the full Metadata graph every time
it prints an error.  The TypePrinter is still not shared, but that would
take some extra plumbing.

llvm-svn: 266889

8 years agoSimplify mips gp0 handling.
Rafael Espindola [Wed, 20 Apr 2016 17:20:49 +0000 (17:20 +0000)]
Simplify mips gp0 handling.

In all currently supported cases this is a nop.

llvm-svn: 266888

8 years agoAdd warning about CR+LF line endings on Windows.
Adrian McCarthy [Wed, 20 Apr 2016 16:43:34 +0000 (16:43 +0000)]
Add warning about CR+LF line endings on Windows.

s/checkout/check out/ when used as a verb.

Differential Revision: http://reviews.llvm.org/D19285

llvm-svn: 266887

8 years agoAdd missing file needed for PDB unittests.
Zachary Turner [Wed, 20 Apr 2016 16:41:02 +0000 (16:41 +0000)]
Add missing file needed for PDB unittests.

llvm-svn: 266886

8 years agotest infra: move test event-related handling into its own package
Todd Fiala [Wed, 20 Apr 2016 16:27:27 +0000 (16:27 +0000)]
test infra: move test event-related handling into its own package

This change moves all the test event handling and its related
ResultsFormatter classes out of the packages/Python/lldbsuite/test dir
into a packages/Python/lldbsuite/test_event package. Formatters are
moved into a sub-package under that.

I am limiting the scope of this change to just the motion and a few
minor issues caught by a static Python checker (e.g. removing unused
import statements).

This is a pre-step for adding package-level tests to the test event
system. I also intend to simplify test event results formatter selection
after I make sure this doesn't break anybody.

See:
http://reviews.llvm.org/D19288

Reviewed by:
Pavel Labath

llvm-svn: 266885

8 years agoIR: Don't use raw_null_ostream in Verifier
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 16:17:37 +0000 (16:17 +0000)]
IR: Don't use raw_null_ostream in Verifier

While using a raw_null_ostream meant that the Verifier didn't have to
think about whether to print, it's actually quite expensive to print out
IR.  Only print if the output is going somewhere.

llvm-svn: 266884

8 years agoIR: Use default member initialization in Verifier, NFC
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 15:55:24 +0000 (15:55 +0000)]
IR: Use default member initialization in Verifier, NFC

llvm-svn: 266883

8 years ago[Hexagon] Fix handling of lcomm directive
Krzysztof Parzyszek [Wed, 20 Apr 2016 15:54:13 +0000 (15:54 +0000)]
[Hexagon] Fix handling of lcomm directive

Patch by Colin LeMahieu.

llvm-svn: 266882

8 years agoRe-enable "[gold-plugin] Disable name for values other than GlobalValue"
Teresa Johnson [Wed, 20 Apr 2016 15:16:57 +0000 (15:16 +0000)]
Re-enable "[gold-plugin] Disable name for values other than GlobalValue"

This restores r266871 with a fix for gold tests relying on the value
names, when using a release compiler, by adding a way to disable the
default discarding. Update affected tests to use the new mechanism so
that value names are preserved as expected, regardless of how the
compiler was built.

llvm-svn: 266881

8 years agoInline canRelaxTls.
Rafael Espindola [Wed, 20 Apr 2016 15:01:42 +0000 (15:01 +0000)]
Inline canRelaxTls.

It was always called in a position where the relocation type was already
known.

llvm-svn: 266880

8 years agoSimplify canRelaxTls.
Rafael Espindola [Wed, 20 Apr 2016 14:52:18 +0000 (14:52 +0000)]
Simplify canRelaxTls.

Check isTls in the called and pass a SymbolBody&.

llvm-svn: 266879

8 years agoMove canRelaxTls to Writer.cpp. NFC.
Rafael Espindola [Wed, 20 Apr 2016 14:41:55 +0000 (14:41 +0000)]
Move canRelaxTls to Writer.cpp. NFC.

llvm-svn: 266878

8 years ago[ThinLTO] Prevent importing of "llvm.used" values
Teresa Johnson [Wed, 20 Apr 2016 14:39:45 +0000 (14:39 +0000)]
[ThinLTO] Prevent importing of "llvm.used" values

Summary:
This patch prevents importing from (and therefore exporting from) any
module with a "llvm.used" local value. Local values need to be promoted
and renamed when importing, and their presense on the llvm.used variable
indicates that there are opaque uses that won't see the rename. One such
example is a use in inline assembly.

See also the discussion at:
http://lists.llvm.org/pipermail/llvm-dev/2016-April/098047.html

As part of this, move collectUsedGlobalVariables out of Transforms/Utils
and into IR/Module so that it can be used more widely. There are several
other places in LLVM that used copies of this code that can be cleaned
up as a follow on NFC patch.

Reviewers: joker.eph

Subscribers: pcc, llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D18986

llvm-svn: 266877

8 years agoDelete needsDynRelative.
Rafael Espindola [Wed, 20 Apr 2016 14:36:24 +0000 (14:36 +0000)]
Delete needsDynRelative.

It is now redundant. Writer.cpp can reason that 2 dynamic relocations
are needed: one to find the final got entry address and one to fill the
got entry.

llvm-svn: 266876

8 years ago[RDF] Consider register as live if any alias is live
Krzysztof Parzyszek [Wed, 20 Apr 2016 14:33:23 +0000 (14:33 +0000)]
[RDF] Consider register as live if any alias is live

This only affects the recomputation of kill flags.

llvm-svn: 266875

8 years agoIncludeFixerTest.cpp: Tweak not to assume clang-tools-extra were onto clang/tools...
NAKAMURA Takumi [Wed, 20 Apr 2016 14:14:16 +0000 (14:14 +0000)]
IncludeFixerTest.cpp: Tweak not to assume clang-tools-extra were onto clang/tools/extra.

llvm-svn: 266874

8 years ago[mips][microMIPS] Implement BGEC, BGEUC, BLTC, BLTUC, BEQC and BNEC instructions
Zoran Jovanovic [Wed, 20 Apr 2016 14:07:46 +0000 (14:07 +0000)]
[mips][microMIPS] Implement BGEC, BGEUC, BLTC, BLTUC, BEQC and BNEC instructions

Differential Revision: http://reviews.llvm.org/D14206

llvm-svn: 266873

8 years agoRevert "[gold-plugin] Disable name for values other than GlobalValue"
Teresa Johnson [Wed, 20 Apr 2016 13:18:47 +0000 (13:18 +0000)]
Revert "[gold-plugin] Disable name for values other than GlobalValue"

This reverts commit r266871. Setting the default based on the NDEBUG
flag is causing test failures. Need to figure out whether to change this
approach or update tests.

llvm-svn: 266872

8 years ago[gold-plugin] Disable name for values other than GlobalValue
Teresa Johnson [Wed, 20 Apr 2016 13:01:37 +0000 (13:01 +0000)]
[gold-plugin] Disable name for values other than GlobalValue

Summary:
Applies Mehdi's optimization (r263086) to disable value names other than
for GlobalValues to LTO/ThinLTO performed via the gold-plugin, in the
same manner as it is applied in libLTO.

Reviewers: rafael, joker-eph

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19269

llvm-svn: 266871

8 years ago[include-fixer] Add a prototype for a new include fixing tool.
Benjamin Kramer [Wed, 20 Apr 2016 12:43:43 +0000 (12:43 +0000)]
[include-fixer] Add a prototype for a new include fixing tool.

Summary:
The goal of this tool is fairly simple, look up unknown identifiers in a
global database and add the corresponding #include line. It accomplishes
this by hooking into Sema as an ExternalSemaSource and responding to typo
correction callbacks. This means we can see the unknown identifier before
it's being munged by error recovery.

This doesn't work perfectly yet as some typo corrections don't emit
callbacks (delayed typos), but I think this is fixable. We also handle
only one include at a time as this is meant to be run directly from
the editing environment eventually. Adding multiple includes at the same
time is tricky because of error recovery.

This version only has a a dummy database, so all you can do is fixing
missing includes of <string>, but the indexer to build a database will
follow soon.

Reviewers: djasper

Subscribers: ioeric, hokein, cfe-commits

Differential Revision: http://reviews.llvm.org/D19314

llvm-svn: 266870

8 years agoAlways inlining PrintCurrentStackSlow of tsan library to fix tail-call issue
Chuang-Yu Cheng [Wed, 20 Apr 2016 10:28:41 +0000 (10:28 +0000)]
Always inlining PrintCurrentStackSlow of tsan library to fix tail-call issue

The real problem is that sanitizer_print_stack_trace obtains current PC and
expects the PC to be in the stack trace after function calls. We don't
prevent tail calls in sanitizer runtimes, so this assumption does not
necessary hold.

We add "always inline" attribute on PrintCurrentStackSlow to address this
issue, however this solution is not reliable enough, but unfortunately, we
don't see any simple, reliable solution.

Reviewers: samsonov hfinkel kbarton tjablin dvyukov kcc

http://reviews.llvm.org/D19148

Thanks Hal, dvyukov, and kcc for invaluable discussion, I have even borrowed
part of dvyukov's summary as my commit message!

llvm-svn: 266869

8 years ago[sanitizer] Fix 'dyld: Symbol not found: _dyldVersionNumber' link error on old Darwin...
Maxim Ostapenko [Wed, 20 Apr 2016 10:22:37 +0000 (10:22 +0000)]
[sanitizer] Fix 'dyld: Symbol not found: _dyldVersionNumber' link error on old Darwin systems.

This patch fixes https://github.com/google/sanitizers/issues/669. On older Darwin systems (in particular, Darwin 10),
dyld doesn't export '_dyldVersionNumber' symbol so we would have 'undefined reference' error in sanitzer library. Although
sanitizers support was added to LLVM on OS X 10.7+ where '_dyldVersionNumber' symbol is already exported, GCC users still
may want use them on older systems.

Differential Revision: http://reviews.llvm.org/D19218

llvm-svn: 266868

8 years agoFix xfail for test_tilde_home_directory on windows
Tamas Berghammer [Wed, 20 Apr 2016 09:54:47 +0000 (09:54 +0000)]
Fix xfail for test_tilde_home_directory on windows

llvm-svn: 266867

8 years agoclang-tidy: [misc-unused-using-decls] Support template types.
Daniel Jasper [Wed, 20 Apr 2016 09:48:56 +0000 (09:48 +0000)]
clang-tidy: [misc-unused-using-decls] Support template types.

This fixes llvm.org/PR27429.

llvm-svn: 266866

8 years agoAMDGPU/SI: Assembler: improvements to support trap handlers.
Nikolay Haustov [Wed, 20 Apr 2016 09:34:48 +0000 (09:34 +0000)]
AMDGPU/SI: Assembler: improvements to support trap handlers.

Add ParseAMDGPURegister which can be invoked recursively for parsing lists.
Rename getRegForName to getSpecialRegForName.
Support legacy SP3 register list syntax: [s2,s3,s4,s5] or [flat_scratch_lo,flat_scratch_hi].
Add 64-bit registers TBA, TMA where missing.
Add some tests.

Differential Revision: http://reviews.llvm.org/D19163

llvm-svn: 266865

8 years agoclang-tidy: [misc-unused-using-decls] Always use the canonical decl to
Daniel Jasper [Wed, 20 Apr 2016 08:58:27 +0000 (08:58 +0000)]
clang-tidy: [misc-unused-using-decls] Always use the canonical decl to
identify things.

This fixes llvm.org/PR27430.

llvm-svn: 266864

8 years ago[X86] enable PIE for functions
Asaf Badouh [Wed, 20 Apr 2016 08:32:57 +0000 (08:32 +0000)]
[X86] enable PIE for functions

Call locally defined function directly for PIE/fPIE

Differential Revision: http://reviews.llvm.org/D19226

llvm-svn: 266863

8 years agoFix a crash in cppcoreguidelines-pro-type-member-init related to missing constructor...
Haojian Wu [Wed, 20 Apr 2016 08:29:08 +0000 (08:29 +0000)]
Fix a crash in cppcoreguidelines-pro-type-member-init related to missing constructor bodies.

Summary: Fixes a crash in cppcoreguidelines-pro-type-member-init when checking some record types with a constructor without a body. We now check to make sure the constructor has a body before looking for missing members and base initializers.

Patch by Michael Miller!

Reviewers: aaron.ballman, alexfh, hokein

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D19270

llvm-svn: 266862

8 years ago[mips][microMIPS]Implement CFC*, CTC* and LDC* instructions
Hrvoje Varga [Wed, 20 Apr 2016 06:34:48 +0000 (06:34 +0000)]
[mips][microMIPS]Implement CFC*, CTC* and LDC* instructions
Differential Revision: http://reviews.llvm.org/D18640

llvm-svn: 266861

8 years ago[AVX512] Add avx512cd+vl runs to vector-tzcnt-128/256 tests to show using the vplzcnt...
Craig Topper [Wed, 20 Apr 2016 05:19:01 +0000 (05:19 +0000)]
[AVX512] Add avx512cd+vl runs to vector-tzcnt-128/256 tests to show using the vplzcntd/q instructions.

llvm-svn: 266860

8 years ago[AVX512] Update vector-tzcnt-512 test to show how bad v32i16 and v64i8 is with avx512...
Craig Topper [Wed, 20 Apr 2016 05:18:58 +0000 (05:18 +0000)]
[AVX512] Update vector-tzcnt-512 test to show how bad v32i16 and v64i8 is with avx512bw enabled.

llvm-svn: 266859

8 years ago[AVX512] Add popcount support for v32i16 and v64i8.
Craig Topper [Wed, 20 Apr 2016 05:18:55 +0000 (05:18 +0000)]
[AVX512] Add popcount support for v32i16 and v64i8.

llvm-svn: 266858

8 years agoRevert "[ELF] - Avoid using memset for zero-initialization of struct member. NFC."
Sean Silva [Wed, 20 Apr 2016 04:26:16 +0000 (04:26 +0000)]
Revert "[ELF] - Avoid using memset for zero-initialization of struct member. NFC."

This reverts commit r266618. It breaks basically everything.

I think VS2013 doesn't interpret this code in the same way.
The size field (at least) is left uninitialized, causing all sorts of havok
(e.g. creating a 34GB file for a trivial hello world program).

The offending compiler reports itself as follows:

    c:\release-vs2013>cl /?
    Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.

llvm-svn: 266857

8 years agoThinLTO: never promote as external weak
Mehdi Amini [Wed, 20 Apr 2016 04:18:11 +0000 (04:18 +0000)]
ThinLTO: never promote as external weak

This linkage is *not* intended to express that a declaration refers
to a weak symbol, but that the symbol might not be present at link
time. I don't believe it was the intent.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266856

8 years agoAdd cxx_runtime_root options for testing against a different libc++ at runtime
Eric Fiselier [Wed, 20 Apr 2016 04:17:39 +0000 (04:17 +0000)]
Add cxx_runtime_root options for testing against a different libc++ at runtime

llvm-svn: 266855

8 years agoFunctionImport: make sure we always select the right callee in presence of alias
Mehdi Amini [Wed, 20 Apr 2016 04:17:36 +0000 (04:17 +0000)]
FunctionImport: make sure we always select the right callee in presence of alias

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266854

8 years ago[OPENMP] Codegen for untied tasks.
Alexey Bataev [Wed, 20 Apr 2016 04:01:36 +0000 (04:01 +0000)]
[OPENMP] Codegen for untied tasks.

If the untied clause is present on a task construct, any thread in the
team can resume the task region after a suspension. Patch adds proper
codegen for untied tasks.

llvm-svn: 266853

8 years agoEnable ODR uniquing of DITypes for ThinLTO backends
Teresa Johnson [Wed, 20 Apr 2016 02:23:52 +0000 (02:23 +0000)]
Enable ODR uniquing of DITypes for ThinLTO backends

Summary:
This is a follow-on to apply Duncan's new DIType ODR uniquing from
r266549 and r266713 in more places.

When invoking ThinLTO backend compiles via clang (for a distributed
build), invoke enableDebugTypeODRUniquing() before parsing the module.

Reviewers: dexonsmith, joker.eph

Subscribers: llvm-commits, joker.eph

Differential Revision: http://reviews.llvm.org/D19264

llvm-svn: 266852

8 years ago[libcxx] Fix PR15638 - Only allocate in parent when starting a thread to prevent...
Eric Fiselier [Wed, 20 Apr 2016 02:21:33 +0000 (02:21 +0000)]
[libcxx] Fix PR15638 - Only allocate in parent when starting a thread to prevent calling terminate.

Summary:
Hi,

When creating a new thread libc++ performs at least 2 allocations. The first allocates a tuple of args and the functor that will be passed to the new thread. The second allocation is for the thread local storage needed internally by libc++. Currently the second allocation happens in the child thread, meaning that if it throws the program will terminate with an uncaught bad alloc.

The solution to this is to allocate ALL memory in the parent thread and then pass it to the child.

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

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13748

llvm-svn: 266851

8 years ago[X86] Mark some floating point operations that are always expanded for vector types...
Craig Topper [Wed, 20 Apr 2016 01:57:44 +0000 (01:57 +0000)]
[X86] Mark some floating point operations that are always expanded for vector types as Expand in a floating point only loop instead of looping through all vector types.

llvm-svn: 266850

8 years ago[X86] Don't mark vector loads and shifts Expand in advance. Loads are always marked...
Craig Topper [Wed, 20 Apr 2016 01:57:42 +0000 (01:57 +0000)]
[X86] Don't mark vector loads and shifts Expand in advance. Loads are always marked Legal or Promote for all the legal types later. Shifts are always marked custom. NFC

llvm-svn: 266849

8 years ago[X86] Merge the two different SSE2 blocks in the X86TargetLowering constructor. Also...
Craig Topper [Wed, 20 Apr 2016 01:57:40 +0000 (01:57 +0000)]
[X86] Merge the two different SSE2 blocks in the X86TargetLowering constructor. Also qualfiy the XOP block with !useSoftFloat to match the other vector blocks.

llvm-svn: 266848

8 years ago[X86] Don't set vector FADD,FSUB,FMUL,FDIV,FNEG,FSQRT to Expand early. For every...
Craig Topper [Wed, 20 Apr 2016 01:57:38 +0000 (01:57 +0000)]
[X86] Don't set vector FADD,FSUB,FMUL,FDIV,FNEG,FSQRT to Expand early. For every legal FP type we either set them to Legal or Custom anyway. So let them stay defaulted to Legal and only change when they need to be Custom.

llvm-svn: 266847

8 years agollvm-lto: run the module verifier when doing IR level work
Mehdi Amini [Wed, 20 Apr 2016 01:04:26 +0000 (01:04 +0000)]
llvm-lto: run the module verifier when doing IR level work

It seems it was only running during CodeGen previously.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266846

8 years agoThinLTO: Move alias importing decision on the summary
Mehdi Amini [Wed, 20 Apr 2016 01:04:20 +0000 (01:04 +0000)]
ThinLTO: Move alias importing decision on the summary

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266845

8 years ago[SystemZ] Add support for llvm.thread.pointer intrinsic.
Marcin Koscielnicki [Wed, 20 Apr 2016 01:03:48 +0000 (01:03 +0000)]
[SystemZ] Add support for llvm.thread.pointer intrinsic.

Differential Revision: http://reviews.llvm.org/D19054

llvm-svn: 266844

8 years ago[Clang] Remove unwanted --check-prefix=CHECK from unit tests. NFC.
Mandeep Singh Grang [Wed, 20 Apr 2016 01:02:18 +0000 (01:02 +0000)]
[Clang] Remove unwanted --check-prefix=CHECK from unit tests. NFC.

Summary:
    Removed unwanted --check-prefix=CHECK from the following unit tests:
      test/CXX/special/class.copy/implicit-move-def.cpp
      test/CodeGen/cleanup-destslot-simple.c
      test/CodeGen/inline-asm-immediate-ubsan.c
      test/CodeGen/mips-interrupt-attr.c
      test/CodeGenCXX/cfi-stats.cpp
      test/CodeGenCXX/copy-constructor-elim.cpp
      test/CodeGenCXX/microsoft-templ-uuidof.cpp
      test/CodeGenCXX/vtable-linkage.cpp
      test/CodeGenObjC/messages-2.m
      test/Driver/noinline.c
      test/Index/remap-load.c
      test/Index/retain-comments-from-system-headers.c
      test/OpenMP/task_if_codegen.cpp
      test/Preprocessor/comment_save_macro.c

Patch by:  Mandeep Singh Grang (mgrang)

Reviewers: rafael, ABataev, rengolin

Projects: #clang-c

Differential Revision: http://reviews.llvm.org/D19232

llvm-svn: 266843

8 years agoAdd LLVMGetAttrKindID in the C API in order to facilitate migration away from LLVMAtt...
Amaury Sechet [Wed, 20 Apr 2016 01:02:12 +0000 (01:02 +0000)]
Add LLVMGetAttrKindID in the C API in order to facilitate migration away from LLVMAttribute

Summary:
LLVMAttribute has outlived its utility and is becoming a problem for C API users that what to use all the LLVM attributes. In order to help moving away from LLVMAttribute in a smooth manner, this diff introduce LLVMGetAttrKindIDInContext, which can be used instead of the enum values.

See D18749 for reference.

Reviewers: Wallbraker, whitequark, joker.eph, echristo, rafael

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19081

llvm-svn: 266842

8 years agoMipsAsmParser::loadImmediate(): Prune an obsolete \param in r266602. [-Wdocumentation]
NAKAMURA Takumi [Wed, 20 Apr 2016 00:55:38 +0000 (00:55 +0000)]
MipsAsmParser::loadImmediate(): Prune an obsolete \param in r266602. [-Wdocumentation]

llvm-svn: 266841

8 years agoMarkEOLs should only be true for clang-cl.exe.
Stephen Hines [Wed, 20 Apr 2016 00:33:06 +0000 (00:33 +0000)]
MarkEOLs should only be true for clang-cl.exe.

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

This fixes an issue in response files where "\r\n" was being interpreted
as two EOL markers (i.e. we consumed the '\r' as terminating the
previous token, and then parsed the '\n' as a significant EOL). This
breaks response files where joined arguments get split across multiple
lines (like "-x\r\nc"). I also fixed an accidental issue in the
response-file.c test, where the response file is appended to, instead of
being overwritten.

Reviewers: rnk

Subscribers: danalbert, llvm-commits

Differential Revision: http://reviews.llvm.org/D19289

llvm-svn: 266840

8 years agoIR: Use HANDLE_METADATA_LEAF to define MetadataKind enum, NFC
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 00:29:48 +0000 (00:29 +0000)]
IR: Use HANDLE_METADATA_LEAF to define MetadataKind enum, NFC

llvm-svn: 266839

8 years ago[libFuzzer] added -detect_leaks flag (0 by default for now). When enabled, it will...
Kostya Serebryany [Wed, 20 Apr 2016 00:24:21 +0000 (00:24 +0000)]
[libFuzzer] added -detect_leaks flag (0 by default for now). When enabled, it will help finding leaks while fuzzing

llvm-svn: 266838

8 years agoScoreboardHazardRecognizer: unbreak TSAN by moving a static mutated variable to a...
Mehdi Amini [Wed, 20 Apr 2016 00:21:24 +0000 (00:21 +0000)]
ScoreboardHazardRecognizer: unbreak TSAN by moving a static mutated variable to a member

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266837

8 years agoAdd 'is_callable' and 'is_nothrow_callable' traits and cleanup INVOKE.
Eric Fiselier [Wed, 20 Apr 2016 00:14:32 +0000 (00:14 +0000)]
Add 'is_callable' and 'is_nothrow_callable' traits and cleanup INVOKE.

The primary purpose of this patch is to add the 'is_callable' traits.
Since 'is_nothrow_callable' required making 'INVOKE' conditionally noexcept
I also took this oppertunity to implement a constexpr version of INVOKE.
This fixes 'std::experimental::apply' which required constexpr 'INVOKE support'.

This patch will be followed up with some cleanup. Primarly removing most
of "__member_function_traits" since it's no longer used by INVOKE (in C++11 at least).

llvm-svn: 266836

8 years agoIR: Use std::vector instead of SmallPtrSet for distinct nodes, NFC
Duncan P. N. Exon Smith [Tue, 19 Apr 2016 23:59:13 +0000 (23:59 +0000)]
IR: Use std::vector instead of SmallPtrSet for distinct nodes, NFC

We never use the set-ness of SmallPtrSet for distinct nodes.  Eventually
we may start garbage-collecting or reference-counting nodes (in which
cases we'd want to remove things from this collection, and a fast erase
would be valuable), but in the meantime a vector is sufficient.

llvm-svn: 266835

8 years ago[LLVM] Remove unwanted --check-prefix=CHECK from unit tests. NFC.
Mandeep Singh Grang [Tue, 19 Apr 2016 23:51:52 +0000 (23:51 +0000)]
[LLVM] Remove unwanted --check-prefix=CHECK from unit tests. NFC.

Summary: Removed unwanted --check-prefix=CHECK from numerous unit tests.

Reviewers: t.p.northover, dblaikie, uweigand, MatzeB, tstellarAMD, mcrosier

Subscribers: mcrosier, dsanders

Differential Revision: http://reviews.llvm.org/D19279

llvm-svn: 266834

8 years ago[Mips] [MSan] VarArgMIPS64Helper: Use target's endian, not host's.
Marcin Koscielnicki [Tue, 19 Apr 2016 23:46:59 +0000 (23:46 +0000)]
[Mips] [MSan] VarArgMIPS64Helper: Use target's endian, not host's.

Ugh.

Differential Revision: http://reviews.llvm.org/D19292

llvm-svn: 266833

8 years agollvm::sys::path::home_directory() relies on having "HOME" set in the environment...
Greg Clayton [Tue, 19 Apr 2016 23:04:35 +0000 (23:04 +0000)]
llvm::sys::path::home_directory() relies on having "HOME" set in the environment and that might not always be set. Our FileSpec class uses this function to resolve any paths that start with "~/" on systems that support home directories as '~'. I have modified FileSpec::ResolveUsername (llvm::SmallVectorImpl<char> &path) to deal with the cases where llvm::sys::path::home_directory() returns false by digging a little further on unix systems and setting "HOME" in the environment so that subsequent calls to llvm::sys::path::home_directory() will succeed.

I also added a test to ensure we don't regress.

<rdar://problem/25342377>

llvm-svn: 266832

8 years agoSimplify mips got handling.
Rafael Espindola [Tue, 19 Apr 2016 22:46:03 +0000 (22:46 +0000)]
Simplify mips got handling.

This avoids computing the address of a position in the got just to then
subtract got->getva().

llvm-svn: 266831

8 years ago[libFuzzer] more trophies
Kostya Serebryany [Tue, 19 Apr 2016 22:37:44 +0000 (22:37 +0000)]
[libFuzzer] more trophies

llvm-svn: 266830

8 years ago[Parse] Reuse OptionUnroll rather than matching it again. NFC
Adam Nemet [Tue, 19 Apr 2016 22:29:24 +0000 (22:29 +0000)]
[Parse] Reuse OptionUnroll rather than matching it again. NFC

llvm-svn: 266829

8 years agoARM: fix assertion failure on -O0 cmpxchg.
Tim Northover [Tue, 19 Apr 2016 22:25:02 +0000 (22:25 +0000)]
ARM: fix assertion failure on -O0 cmpxchg.

Because lowering of CMP_SWAP_64 occurs during type legalization, there can be
i64 types produced by more than just a BUILD_PAIR or similar. My initial tests
used just incoming function args.

llvm-svn: 266828

8 years ago[Parse] Use StringSwitch to improve readability. NFC
Adam Nemet [Tue, 19 Apr 2016 22:17:45 +0000 (22:17 +0000)]
[Parse] Use StringSwitch to improve readability. NFC

A subsequent patch will propose a "distribute" loop hint.  Similarly to
unroll, this does not have a "assume_safety" argument either so this
condition will get more complex.

llvm-svn: 266827

8 years agoAdd IntrWrite[Arg]Mem intrinsic property
Nicolai Haehnle [Tue, 19 Apr 2016 21:58:33 +0000 (21:58 +0000)]
Add IntrWrite[Arg]Mem intrinsic property

Summary:
This property is used to mark an intrinsic that only writes to memory, but
neither reads from memory nor has other side effects.

An example where this is useful is the llvm.amdgcn.buffer.store.format.*
intrinsic, which corresponds to a store instruction that goes through a special
buffer descriptor rather than through a plain pointer.

With this property, the intrinsic should still be handled as having side
effects at the LLVM IR level, but machine scheduling can make smarter
decisions.

Reviewers: tstellarAMD, arsenm, joker.eph, reames

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D18291

llvm-svn: 266826

8 years agoAMDGPU: Guard VOPC instructions against incorrect commute
Nicolai Haehnle [Tue, 19 Apr 2016 21:58:22 +0000 (21:58 +0000)]
AMDGPU: Guard VOPC instructions against incorrect commute

Summary:
The added testcase, which triggered this, was derived from a shader-db case
via bugpoint. A separate question is why scalar branching wasn't used.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D19208

llvm-svn: 266825

8 years agoAMDGPU/SI: SGPR accounting in getSIProgramInfo must ignore exec_lo/hi
Nicolai Haehnle [Tue, 19 Apr 2016 21:58:17 +0000 (21:58 +0000)]
AMDGPU/SI: SGPR accounting in getSIProgramInfo must ignore exec_lo/hi

Summary:
A shader stored the live mask (initial exec mask) in an SGPR which was then
spilled during register allocation. The allocator quite reasonably
optimized turned the spill into

  v_writelane_b32 %vgpr, exec_lo, N
  v_writelane_b32 %vgpr, exec_hi, N+1

at the beginning of the shader, confusing the SGPR accounting.

No test case, because si-sgpr-spill.ll together with an upcoming patch for
WQM handling exhibits the problem.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D19199

llvm-svn: 266824

8 years ago[TableGen] Make an error message slightly more informative
Nicolai Haehnle [Tue, 19 Apr 2016 21:58:10 +0000 (21:58 +0000)]
[TableGen] Make an error message slightly more informative

Reviewers: ab, spop, stoklund

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19192

llvm-svn: 266823

8 years agoRemove duplicated header contents, NFC
Vedant Kumar [Tue, 19 Apr 2016 21:55:14 +0000 (21:55 +0000)]
Remove duplicated header contents, NFC

It looks like InstrProfiling.h was the victim of a bad merge. The header
guards in the file prevented the build from blowing up.

llvm-svn: 266822

8 years ago[Hexagon] Fix operand swapping in HexagonPeephole
Krzysztof Parzyszek [Tue, 19 Apr 2016 21:36:24 +0000 (21:36 +0000)]
[Hexagon] Fix operand swapping in HexagonPeephole

Also, disable zero- and size-extend optimizations for now.

llvm-svn: 266821

8 years agoXFAILing new test on C++03
Ben Craig [Tue, 19 Apr 2016 21:07:30 +0000 (21:07 +0000)]
XFAILing new test on C++03

initializer_list doesn't exist in C++03.

llvm-svn: 266820

8 years agoDocument how a binary file was created.
Rafael Espindola [Tue, 19 Apr 2016 20:52:28 +0000 (20:52 +0000)]
Document how a binary file was created.

llvm-svn: 266819

8 years ago[AArch64] [ARM] Make a target-independent llvm.thread.pointer intrinsic.
Marcin Koscielnicki [Tue, 19 Apr 2016 20:51:05 +0000 (20:51 +0000)]
[AArch64] [ARM] Make a target-independent llvm.thread.pointer intrinsic.

Both AArch64 and ARM support llvm.<arch>.thread.pointer intrinsics that
just return the thread pointer.  I have a pending patch that does the same
for SystemZ (D19054), and there are many more targets that could benefit
from one.

This patch merges the ARM and AArch64 intrinsics into a single target
independent one that will also be used by subsequent targets.

Differential Revision: http://reviews.llvm.org/D19098

llvm-svn: 266818

8 years ago[AArch64] Fix D19098 fallout.
Marcin Koscielnicki [Tue, 19 Apr 2016 20:51:00 +0000 (20:51 +0000)]
[AArch64] Fix D19098 fallout.

The intrinsic is now called llvm.thread.pointer, not
llvm.aarch64.thread.pointer.  Also, the code handling it in CGBuiltin.cpp
is dead - it's already covered by GCCBuiltin.  Remove it.

Differential Revision: http://reviews.llvm.org/D19099

llvm-svn: 266817

8 years agoMake a function file-scoped.
Rui Ueyama [Tue, 19 Apr 2016 20:50:25 +0000 (20:50 +0000)]
Make a function file-scoped.

llvm-svn: 266816

8 years agoEliminate circular dependency introduced between lldbtest.py and decorators.py
Kate Stone [Tue, 19 Apr 2016 20:45:47 +0000 (20:45 +0000)]
Eliminate circular dependency introduced between lldbtest.py and decorators.py

llvm-svn: 266815

8 years agocc1as: Don't crash when CIE is requested and no DWARF version is specified.
Adrian Prantl [Tue, 19 Apr 2016 20:31:19 +0000 (20:31 +0000)]
cc1as: Don't crash when CIE is requested and no DWARF version is specified.
This patch changes the default DWARF version for cc1as from invalid 0 to 2,
which should be the lowest common denominator on all platforms.

rdar://problem/24735813

llvm-svn: 266814

8 years ago[compiler-rt] Remove unwanted --check-prefix=CHECK from unit tests. NFC.
Mandeep Singh Grang [Tue, 19 Apr 2016 20:29:59 +0000 (20:29 +0000)]
[compiler-rt] Remove unwanted --check-prefix=CHECK from unit tests. NFC.

Summary:
Removed unwanted --check-prefix=CHECK from the following unit tests:
      test/asan/TestCases/Posix/start-deactivated.cc
      test/tsan/Darwin/ignored-interceptors.mm

 Patch by: Mandeep Singh Grang (mgrang)

Reviewers: samsonov, kcc, dvyukov, eugenis

Differential Revision: http://reviews.llvm.org/D19281

llvm-svn: 266813

8 years ago[Orc] Add move ops for OrcRemoteTargetClient and OrcRemoteTargetServer to
Lang Hames [Tue, 19 Apr 2016 20:22:50 +0000 (20:22 +0000)]
[Orc] Add move ops for OrcRemoteTargetClient and OrcRemoteTargetServer to
appease MSVC.

llvm-svn: 266812

8 years ago[Hexagon] Fix printing the address operand of S2_storerinewabs
Krzysztof Parzyszek [Tue, 19 Apr 2016 20:20:33 +0000 (20:20 +0000)]
[Hexagon] Fix printing the address operand of S2_storerinewabs

llvm-svn: 266811

8 years agoFix pr27420.
Rafael Espindola [Tue, 19 Apr 2016 20:18:52 +0000 (20:18 +0000)]
Fix pr27420.

Return the right expression for R_X86_64_GOTPCRELX and
R_X86_64_REX_GOTPCRELX.

llvm-svn: 266810

8 years ago[PPC, SSP] Support PowerPC Linux stack protection.
Tim Shen [Tue, 19 Apr 2016 20:14:52 +0000 (20:14 +0000)]
[PPC, SSP] Support PowerPC Linux stack protection.

llvm-svn: 266809

8 years agoInclude initializer_list from utility
Ben Craig [Tue, 19 Apr 2016 20:13:55 +0000 (20:13 +0000)]
Include initializer_list from utility

The C++11 and C++14 standards both say in the header <utility> synopsis that
<utility> shall include <initializer_list>.

llvm-svn: 266808

8 years ago[ARM NEON] Define vfms_f32 on ARM, and all vfms using vfma.
Ahmed Bougacha [Tue, 19 Apr 2016 19:44:45 +0000 (19:44 +0000)]
[ARM NEON] Define vfms_f32 on ARM, and all vfms using vfma.

r259537 added vfma/vfms to armv7, but the builtin was only lowered
on the AArch64 side. Instead of supporting it on ARM, get rid of it.

The vfms builtin lowered to:
  %nb = fsub float -0.0, %b
  %r = @llvm.fma.f32(%a, %nb, %c)

Instead, define the operation in terms of vfma, and swap the
multiplicands. It now lowers to:
  %na = fsub float -0.0, %a
  %r = @llvm.fma.f32(%na, %b, %c)

This matches the instruction more closely, and lets current LLVM
generate the "natural" operand ordering:
  fmls.2s v0, v1, v2
instead of the crooked (but equivalent):
  fmls.2s v0, v2, v1
Except for theses changes, assembly is identical.

LLVM accepts both commutations, and the LLVM tests in:
  test/CodeGen/AArch64/arm64-fmadd.ll
  test/CodeGen/AArch64/fp-dp3.ll
  test/CodeGen/AArch64/neon-fma.ll
  test/CodeGen/ARM/fusedMAC.ll
already check either the new one only, or both.

Also verified against the test-suite unittests.

llvm-svn: 266807

8 years ago[SSP, 2/2] Create llvm.stackguard() intrinsic and lower it to LOAD_STACK_GUARD
Tim Shen [Tue, 19 Apr 2016 19:40:37 +0000 (19:40 +0000)]
[SSP, 2/2] Create llvm.stackguard() intrinsic and lower it to LOAD_STACK_GUARD

With this change, ideally IR pass can always generate llvm.stackguard
call to get the stack guard; but for now there are still IR form stack
guard customizations around (see getIRStackGuard()). Future SSP
customization should go through LOAD_STACK_GUARD.

There is a behavior change: stack guard values are not CSEed anymore,
since we should never reuse the value in case that it has been spilled (and
corrupted). See ssp-guard-spill.ll. This also cause the change of stack
size and codegen in X86 and AArch64 test cases.

Ideally we'd like to know if the guard created in llvm.stackprotector() gets
spilled or not. If the value is spilled, discard the value and reload
stack guard; otherwise reuse the value. This can be done by teaching
register allocator to know how to rematerialize LOAD_STACK_GUARD and
force a rematerialization (which seems hard), or check for spilling in
expandPostRAPseudo. It only makes sense when the stack guard is a global
variable, which requires more instructions to load. Anyway, this seems to go out
of the scope of the current patch.

llvm-svn: 266806

8 years ago[Orc] Add explicit move ops to OrcRemoteTargetRPCAPI for MSVC.
Lang Hames [Tue, 19 Apr 2016 19:35:16 +0000 (19:35 +0000)]
[Orc] Add explicit move ops to OrcRemoteTargetRPCAPI for MSVC.

llvm-svn: 266805

8 years ago[Orc] Fix missing return in RPC move assignment operator.
Lang Hames [Tue, 19 Apr 2016 19:34:46 +0000 (19:34 +0000)]
[Orc] Fix missing return in RPC move assignment operator.

llvm-svn: 266804