platform/upstream/llvm.git
8 years agoCorrected wording of REPL not available messaging (contained a repeated word and...
Kate Stone [Thu, 21 Apr 2016 00:56:08 +0000 (00:56 +0000)]
Corrected wording of REPL not available messaging (contained a repeated word and lacked clarity.)

llvm-svn: 266941

8 years agoAdded command prefix to new help messages to ensure that they're correctly words...
Kate Stone [Thu, 21 Apr 2016 00:55:20 +0000 (00:55 +0000)]
Added command prefix to new help messages to ensure that they're correctly words in REPL mode.

llvm-svn: 266940

8 years agoAdd optimization for 'icmp slt (or A, B), A' and some related idioms based on knowled...
Nick Lewycky [Thu, 21 Apr 2016 00:53:14 +0000 (00:53 +0000)]
Add optimization for 'icmp slt (or A, B), A' and some related idioms based on knowledge of the sign bit for A and B.

No matter what value you OR in to A, the result of (or A, B) is going to be UGE A. When A and B are positive, it's SGE too. If A is negative, OR'ing a value into it can't make it positive, but can increase its value closer to -1, therefore (or A, B) is SGE A. Working through all possible combinations produces this truth table:

```
A is
+, -, +/-
F  F   F   +    B is
T  F   ?   -
?  F   ?   +/-
```

The related optimizations are flipping the 'slt' for 'sge' which always NOTs the result (if the result is known), and swapping the LHS and RHS while swapping the comparison predicate.

There are more idioms left to implement (aren't there always!) but I've stopped here because any more would risk becoming unreasonable for reviewers.

llvm-svn: 266939

8 years agoRemove the (ignored) -Wreceived-is-weak diagnostic.
Bob Wilson [Thu, 21 Apr 2016 00:11:24 +0000 (00:11 +0000)]
Remove the (ignored) -Wreceived-is-weak diagnostic.

We kept this around for a while since Xcode 6 and earlier had a build
setting for this warning. It was removed in Xcode 7 so there should be
no need for this warning now.

llvm-svn: 266938

8 years agoModule Debugging: Emit the canonical debug info for Objective-C classes
Adrian Prantl [Wed, 20 Apr 2016 23:59:32 +0000 (23:59 +0000)]
Module Debugging: Emit the canonical debug info for Objective-C classes
in the compile unit that contains their implementation even if their
interface is declared in a module.

The private @implementation of an @interface may have additional
hidden ivars so we should not defer to the public version of the
type that is found in the module.

<rdar://problem/25541798>

llvm-svn: 266937

8 years agoRefine instruction weight annotation algorithm for sample profiler.
Dehao Chen [Wed, 20 Apr 2016 23:36:23 +0000 (23:36 +0000)]
Refine instruction weight annotation algorithm for sample profiler.

Summary:
This patch refined the instruction weight anootation algorithm:
1. Do not use dbg_value intrinsics for annotation.
2. Annotate cold calls if the call is inlined in profile, but not inlined before preparation. This indicates that the annotation preparation step found no sample for the inlined callsite, thus the call should be very cold.

Reviewers: dnovillo, davidxl

Subscribers: mgrang, llvm-commits

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

llvm-svn: 266936

8 years agounbreak COFF/out.test after r266929
Nico Weber [Wed, 20 Apr 2016 23:30:14 +0000 (23:30 +0000)]
unbreak COFF/out.test after r266929

llvm-svn: 266935

8 years ago[sanitizer] update the sanitizer_allocator_testlib
Kostya Serebryany [Wed, 20 Apr 2016 23:28:06 +0000 (23:28 +0000)]
[sanitizer] update the sanitizer_allocator_testlib

llvm-svn: 266934

8 years agoFix another compilation error from r266919 for clang-atom-d525-fedora-rel which
Kevin Enderby [Wed, 20 Apr 2016 23:10:14 +0000 (23:10 +0000)]
Fix another compilation error from r266919 for clang-atom-d525-fedora-rel which
is another place that libObject’s getName() for symbols returns Expected<...>
that needed to be updated.

llvm-svn: 266933

8 years ago[asan] Increase LocatePcInTrace threshold.
Evgeniy Stepanov [Wed, 20 Apr 2016 22:45:25 +0000 (22:45 +0000)]
[asan] Increase LocatePcInTrace threshold.

Not sure what changed, but on my machine this is literally one byte
short. Only happens when malloc_context_size <= 2 due to the special
case in GET_STACK_TRACE definition (see asan_stack.h):
StackTrace::GetCurrentPc() on the right (context size > 2) branch
returns the address that is 200-something bytes from the return
address it is later matched to, while the same call on the left
branch is 321 bytes away from it.

This fixes the double-free test on my machine.

llvm-svn: 266932

8 years ago[asan] Add __strdup interceptor.
Evgeniy Stepanov [Wed, 20 Apr 2016 22:45:23 +0000 (22:45 +0000)]
[asan] Add __strdup interceptor.

This happens on Linux when building as C (not C++) with optimization.

llvm-svn: 266931

8 years agoFix compilation error in r266919.
Evgeniy Stepanov [Wed, 20 Apr 2016 22:44:40 +0000 (22:44 +0000)]
Fix compilation error in r266919.

lib/Object/MachOObjectFile.cpp:53:44: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
  return malformedError(Obj.getFileName(), std::move(Msg.str()), ECOverride);

llvm-svn: 266930

8 years agolld-link: Fix default output name with /dll flag.
Nico Weber [Wed, 20 Apr 2016 22:34:15 +0000 (22:34 +0000)]
lld-link: Fix default output name with /dll flag.

If /dll is passed, the default output filename should be foo.dll,
not foo.exe.
http://reviews.llvm.org/D19321

llvm-svn: 266929

8 years ago[test/PGOProfile] Make tests independent of the raw profile version (NFC)
Vedant Kumar [Wed, 20 Apr 2016 22:24:01 +0000 (22:24 +0000)]
[test/PGOProfile] Make tests independent of the raw profile version (NFC)

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

llvm-svn: 266928

8 years agounwind: remove another instance of -Wexpansion-to-defined
Saleem Abdulrasool [Wed, 20 Apr 2016 22:18:50 +0000 (22:18 +0000)]
unwind: remove another instance of -Wexpansion-to-defined

Remove the use of undefined behaviour in the c preprocessor by always defining
the value according to the state that was being checked.  NFC.

llvm-svn: 266927

8 years agounwind: unify the definition of _LIBUNWIND_SUPPORT_FRAME_APIS
Saleem Abdulrasool [Wed, 20 Apr 2016 22:18:47 +0000 (22:18 +0000)]
unwind: unify the definition of _LIBUNWIND_SUPPORT_FRAME_APIS

Unify the definition of the _LIBUNWIND_SUPPORT_FRAME_APIS macro.  This is in
preparation to remove another instance of -Wexpansion-to-defined.  NFC.

llvm-svn: 266926

8 years ago[Tooling] Fix getting fully qualified names of template alias types.
Chaoren Lin [Wed, 20 Apr 2016 22:12:07 +0000 (22:12 +0000)]
[Tooling] Fix getting fully qualified names of template alias types.

Reviewers: rsmith, rnk

Subscribers: cfe-commits, klimek

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

llvm-svn: 266925

8 years agoRemoved extraneous print() in decorator for enabling module debugging
Kate Stone [Wed, 20 Apr 2016 21:59:43 +0000 (21:59 +0000)]
Removed extraneous print() in decorator for enabling module debugging

llvm-svn: 266924

8 years ago[ELF][MIPS] Treat R_MIPS_TLS_{D}TPREL_HI16/LO16 as relative relocations
Simon Atanasyan [Wed, 20 Apr 2016 21:57:51 +0000 (21:57 +0000)]
[ELF][MIPS] Treat R_MIPS_TLS_{D}TPREL_HI16/LO16 as relative relocations

These relocations are calculated as S + A - DTPREL or S + A - TPREL,
where DTPREL = TlsVA - 0x8000, TPREL = TlsVA - 0x7000. So the result
is relative to the TLS output section and is not an absolut value
The fix allows to escape creation of unnecessary dynamic relocations
in case of DSO linking.

llvm-svn: 266923

8 years agoWhen making an array or stuct/union/class elements, make sure the type is complete...
Greg Clayton [Wed, 20 Apr 2016 21:47:56 +0000 (21:47 +0000)]
When making an array or stuct/union/class elements, make sure the type is complete. If the type isn't complete, complete the type so that clang won't assert and kill your program. Since the DWARF assists in doing layout, it won't show the array or struct/unions/class elements correctly, but it will stop you from crashing if you have a struct/union/class that contains one of these arrays.

<rdar://problem/25057391>

llvm-svn: 266922

8 years ago[ELF][MIPS] Create GOT entries for R_MIPS_REL32 dynamic relocations
Simon Atanasyan [Wed, 20 Apr 2016 21:40:33 +0000 (21:40 +0000)]
[ELF][MIPS] Create GOT entries for R_MIPS_REL32 dynamic relocations

MIPS ABI turns using of GOT and dynamic relocations inside out. While
regular ABI uses dynamic relocations to fill up GOT entries MIPS ABI
requires dynamic linker to fills up GOT entries using specially sorted
dynamic symbol table. This affects even dynamic relocations against
symbols which do not require GOT entries creation explicitly, i.e. do
not have any GOT-relocations. So if a preemptible symbol has a dynamic
relocation we anyway have to create a GOT entry for it.

If a non-preemptible symbol has a dynamic relocation against it, dynamic
linker takes it st_value, adds offset and writes down result of the
dynamic relocation. In case of preemptible symbol dynamic linker
performs symbol resolution, writes the symbol value to the GOT entry and
reads the GOT entry when it needs to perform a dynamic relocation.

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

llvm-svn: 266921

8 years agoNeeded change to lld for the change to libObject’s getName() for symbols now returnin...
Kevin Enderby [Wed, 20 Apr 2016 21:24:51 +0000 (21:24 +0000)]
Needed change to lld for the change to libObject’s getName() for symbols now returning Expected<...>

With the llvm change in r266919 this is the matching needed change to the lld code
now that libObject’s getName() for symbols now returning Expected<...> .

llvm-svn: 266920

8 years agoThread Expected<...> up from libObject’s getName() for symbols to allow llvm-objdump...
Kevin Enderby [Wed, 20 Apr 2016 21:24:34 +0000 (21:24 +0000)]
Thread Expected<...> up from libObject’s getName() for symbols to allow llvm-objdump to produce a good error message.

Produce another specific error message for a malformed Mach-O file when a symbol’s
string index is past the end of the string table.  The existing test case in test/Object/macho-invalid.test
for macho-invalid-symbol-name-past-eof now reports the error with the message indicating
that a symbol at a specific index has a bad sting index and that bad string index value.

Again converting interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. Where the existing code reported the error with a
string message or an error code it was converted to do the same.  There is some
code for this that could be factored into a routine but I would like to leave that for
the code owners post-commit to do as they want for handling an llvm::Error.  An
example of how this could be done is shown in the diff in
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine
already for std::error_code so I added one like it for llvm::Error .

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(NameOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there fixes needed to lld that goes along with this that I will commit right after this.
So expect lld not to built after this commit and before the next one.

llvm-svn: 266919

8 years ago[Hexagon] Add -mv.. options to override CPU selection
Krzysztof Parzyszek [Wed, 20 Apr 2016 21:17:40 +0000 (21:17 +0000)]
[Hexagon] Add -mv.. options to override CPU selection

This is for compatibility with scripts that use -mv5, etc. with the
assembler.

llvm-svn: 266918

8 years agoupdate Jenkins Xcode buildbot target for r266885
Todd Fiala [Wed, 20 Apr 2016 20:54:59 +0000 (20:54 +0000)]
update Jenkins Xcode buildbot target for r266885

llvm-svn: 266917

8 years agounwind: remove a second instance of -Wexpansion-to-defined
Saleem Abdulrasool [Wed, 20 Apr 2016 20:54:55 +0000 (20:54 +0000)]
unwind: remove a second instance of -Wexpansion-to-defined

Remove the use of undefined behaviour in the c preprocessor by always defining
the value according to the state that was being checked.  NFC.

llvm-svn: 266916

8 years agounwind: remove an instance of -Wexpansion-to-defined
Saleem Abdulrasool [Wed, 20 Apr 2016 20:54:51 +0000 (20:54 +0000)]
unwind: remove an instance of -Wexpansion-to-defined

This follows the pattern in the Apple clause duplicating a tuple of definitions.
However, it will define them to a value rather than a defined check to remove
the `-Wexpansion-to-defined` warning (which may be treated as an error).

This also opens the door to unifying the two code paths into one.

NFC.

llvm-svn: 266915

8 years agoDefine and use a utility function. NFC.
Rui Ueyama [Wed, 20 Apr 2016 20:54:13 +0000 (20:54 +0000)]
Define and use a utility function. NFC.

llvm-svn: 266914

8 years agounwind: unify _LIBUNWIND_SUPPORT_DWARF_UNWIND
Saleem Abdulrasool [Wed, 20 Apr 2016 20:53:40 +0000 (20:53 +0000)]
unwind: unify _LIBUNWIND_SUPPORT_DWARF_UNWIND

Join the two paths for this macro.  At the end of the day, the difference was
that MIPS and ARM on Apple have different behaviour.  This is a setup change to
remove an instance of -Wexpansion-to-defined.  NFC.

llvm-svn: 266913

8 years agoELF: Redefine parseExpr to parse an expression. NFC.
Rui Ueyama [Wed, 20 Apr 2016 20:48:25 +0000 (20:48 +0000)]
ELF: Redefine parseExpr to parse an expression. NFC.

Previously the function reads an operator and the rest of
the expressions. This patch makes it to actually parse an expression
which starts with a primary pexression followed by other expressions
concatenated with operators.

llvm-svn: 266912

8 years agoFix a bug where LLDB would crash if 'apropos <anything>' was used after spawning...
Enrico Granata [Wed, 20 Apr 2016 20:48:05 +0000 (20:48 +0000)]
Fix a bug where LLDB would crash if 'apropos <anything>' was used after spawning an inferior process

llvm-svn: 266911

8 years ago[msan] Implement GetPageSize in the test.
Evgeniy Stepanov [Wed, 20 Apr 2016 20:32:18 +0000 (20:32 +0000)]
[msan] Implement GetPageSize in the test.

Instead of calling a sanitizer_common function, implement GetPageSize in the
test directly. MSan runtime does not export __sanitizer::* symbols, and the
current code breaks when the test and the runtime library are in the separate
link units (ex. when the test is built as a shared library).

llvm-svn: 266910

8 years agoIR: Use SmallVector instead of std::vector of TrackingMDRef
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 20:14:09 +0000 (20:14 +0000)]
IR: Use SmallVector instead of std::vector of TrackingMDRef

Don't use std::vector<TrackingMDRef>, since (at least in some versions
of libc++) std::vector apparently copies values on grow operations
instead of moving them.  Found this when I was temporarily deleting the
copy constructor for TrackingMDRef to investigate a performance
bottleneck.

llvm-svn: 266909

8 years agoELF: Template LinkerScript class.
Rui Ueyama [Wed, 20 Apr 2016 20:13:41 +0000 (20:13 +0000)]
ELF: Template LinkerScript class.

Originally, linker scripts were basically an alternative way to specify
options to the command line options. But as we add more features to hanlde
symbols and sections, many member functions needed to be templated.
Now most the members are templated. It is probably time to template the
entire class.

Previously, LinkerScript is an executor of the linker script as well as
a storage of linker script configurations. This is not suitable to template
the class because when we are reading linker script files, we don't know
the ELF type yet, so we can't instantiate ELF-templated classes.

In this patch, I defined a new class, ScriptConfiguration, to store
linker script configurations. ScriptParser writes parse results to it,
and LinkerScript uses them.

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

llvm-svn: 266908

8 years agoIR: Stop copying vectors of TrackingMDRef in DIBuilder
Duncan P. N. Exon Smith [Wed, 20 Apr 2016 20:03:59 +0000 (20:03 +0000)]
IR: Stop copying vectors of TrackingMDRef in DIBuilder

No real functionality change here, just avoiding an unnecessary copy of
std::vector<TrackingMDRef> for every subprogram with variables.

llvm-svn: 266907

8 years agoRename asan-check-lifetime into asan-stack-use-after-scope
Kostya Serebryany [Wed, 20 Apr 2016 20:02:58 +0000 (20:02 +0000)]
Rename asan-check-lifetime into asan-stack-use-after-scope

Summary:
This is done for consistency with asan-use-after-return.
I see no other users than tests.

Reviewers: aizatsky, kcc

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

llvm-svn: 266906

8 years agoTypo.
Chad Rosier [Wed, 20 Apr 2016 19:16:23 +0000 (19:16 +0000)]
Typo.

llvm-svn: 266905

8 years ago[ValueTracking] Make isImpliedCondition return an Optional<bool>. NFC.
Chad Rosier [Wed, 20 Apr 2016 19:15:26 +0000 (19:15 +0000)]
[ValueTracking] Make isImpliedCondition return an Optional<bool>. NFC.

Phabricator Revision: http://reviews.llvm.org/D19277

llvm-svn: 266904

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