platform/upstream/llvm.git
8 years agoThinLTO: initialize variables
Mehdi Amini [Thu, 21 Apr 2016 06:43:41 +0000 (06:43 +0000)]
ThinLTO: initialize variables

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

8 years ago[AVX512] Add support for lowering CTTZ v64i8 and v32i16 with BWI instructions.
Craig Topper [Thu, 21 Apr 2016 06:39:34 +0000 (06:39 +0000)]
[AVX512] Add support for lowering CTTZ v64i8 and v32i16 with BWI instructions.

llvm-svn: 266963

8 years ago[X86] Remove redundant calls to setOperationAction for EXTRACT_VECTOR_ELT/INSERT_VECT...
Craig Topper [Thu, 21 Apr 2016 06:39:32 +0000 (06:39 +0000)]
[X86] Remove redundant calls to setOperationAction for EXTRACT_VECTOR_ELT/INSERT_VECTOR_ELT from SSE41 block. They were already done in an earlier block. NFC

llvm-svn: 266962

8 years ago[X86] Remove some operations from the default Expand all vector ops loop. Instead...
Craig Topper [Thu, 21 Apr 2016 06:39:29 +0000 (06:39 +0000)]
[X86] Remove some operations from the default Expand all vector ops loop. Instead let them stay Legal and mark them Expand for specific types where needed. Reduces overall number of calls to setOperationAction. NFC

llvm-svn: 266961

8 years ago[X86] Remove old leftover MMX code that sets various 64-bit vector operations to...
Craig Topper [Thu, 21 Apr 2016 06:39:26 +0000 (06:39 +0000)]
[X86] Remove old leftover MMX code that sets various 64-bit vector operations to Expand. These vector types aren't legal so these operations would never make it far enough to need to expand. NFC

llvm-svn: 266960

8 years agoThinLTO: add module caching handling.
Mehdi Amini [Thu, 21 Apr 2016 05:54:23 +0000 (05:54 +0000)]
ThinLTO: add module caching handling.

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

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

8 years agoThinLTO: Resolve linkonce_odr aliases just like functions
Mehdi Amini [Thu, 21 Apr 2016 05:47:17 +0000 (05:47 +0000)]
ThinLTO: Resolve linkonce_odr aliases just like functions

This help to streamline the process of handling importing since
we don't need to special case alias everywhere: just like
linkonce_odr function, make sure at least one alias is emitted
by turning it weak.

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

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

8 years ago[LTO/Test] Make x86_64-darwin bot happy again.
Davide Italiano [Thu, 21 Apr 2016 05:30:32 +0000 (05:30 +0000)]
[LTO/Test] Make x86_64-darwin bot happy again.

llvm-svn: 266957

8 years ago[libc++] fix macro redef warning when exception is disabled
Weiming Zhao [Thu, 21 Apr 2016 05:28:18 +0000 (05:28 +0000)]
[libc++] fix macro redef warning when exception is disabled

Summary:
 when setting LIBCXX_ENABLE_EXCEPTIONS=false, _LIBCPP_NO_EXCEPTIONS wil be defined in both commandline and _config

Reviewers: bcraig, EricWF

Subscribers: cfe-commits

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

llvm-svn: 266956

8 years ago[SimplifyCFG] Fold `llvm.guard(false)` to unreachable
Sanjoy Das [Thu, 21 Apr 2016 05:09:12 +0000 (05:09 +0000)]
[SimplifyCFG] Fold `llvm.guard(false)` to unreachable

Summary:
`llvm.guard(false)` always bails out of the current compilation unit, so
we can prune any control flow following it.

Reviewers: hfinkel, pcc, reames

Subscribers: majnemer, reames, mcrosier, llvm-commits

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

llvm-svn: 266955

8 years ago[LTO] Another couple of tests for cases we already get right.
Davide Italiano [Thu, 21 Apr 2016 04:50:08 +0000 (04:50 +0000)]
[LTO] Another couple of tests for cases we already get right.

-> Drop linkage when converting to decl
-> Handling of unnamed_addr.

llvm-svn: 266954

8 years ago[LTO] Discard names for Values that are not global.
Davide Italiano [Thu, 21 Apr 2016 04:46:22 +0000 (04:46 +0000)]
[LTO] Discard names for Values that are not global.

This is not on by default (but it might be in the future).
The knob to enable the optimization is -lto-discard-value-names.

llvm-svn: 266953

8 years ago[X86] Remove unnecessary setting of CTTZ_ZERO_UNDEF to Custom for vector types where...
Craig Topper [Thu, 21 Apr 2016 04:44:00 +0000 (04:44 +0000)]
[X86] Remove unnecessary setting of CTTZ_ZERO_UNDEF to Custom for vector types where we can't do any better than the Custom lowering of CTTZ. LegalizeVectorOps will expand to CTTZ since its marked Custom.

CTTZ_ZERO_UNDEF can be custom lowered specially if CTLZ is supported. Otherwise CTTZ and CTTZ_ZERO_UNDEF are handled the same way by using CTPOP and bitmath.

llvm-svn: 266952

8 years ago[SelectionDAG] Teach LegalizeVectorOps to directly Expand CTTZ_ZERO_UNDEF/CTLZ_ZERO_U...
Craig Topper [Thu, 21 Apr 2016 04:43:57 +0000 (04:43 +0000)]
[SelectionDAG] Teach LegalizeVectorOps to directly Expand CTTZ_ZERO_UNDEF/CTLZ_ZERO_UNDEF to CTTZ/CTLZ directly if those ops are Legal/Custom instead of deferring it to LegalizeOps.

This is needed to support CTTZ/CTLZ Custom correctly since LegalizeOps would be too late to do the custom lowering.

llvm-svn: 266951

8 years ago[AVX512] Add support for popcount of v8i64 and v16i32 with and without BWI instructions.
Craig Topper [Thu, 21 Apr 2016 03:57:24 +0000 (03:57 +0000)]
[AVX512] Add support for popcount of v8i64 and v16i32 with and without BWI instructions.

Without BWI we have to split the vectors into 256-bit vectors so we can use AVX2 pshufb and then concatenate the results.

llvm-svn: 266950

8 years agoValueMapper: Map uniqued nodes in post-order
Duncan P. N. Exon Smith [Thu, 21 Apr 2016 02:34:36 +0000 (02:34 +0000)]
ValueMapper: Map uniqued nodes in post-order

The iteratitive algorithm from r265456 claimed but failed to create a
post-order traversal.  It had the same error that was fixed in the
ValueEnumerator in r266947: now, instead of pushing all operands on the
worklist at once, we pause whenever an operand gets pushed in order to
go depth-first (I know, it sounds obvious).

Sadly, I have no idea how to observe this from outside the algorithm and
so I haven't written a test.  The output should be the same; it should
just use fewer temporary nodes now.  I've added some comments that I
hope make the current logic clear enough it's unlikely to regress.

llvm-svn: 266949

8 years agoThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing
Mehdi Amini [Thu, 21 Apr 2016 01:59:39 +0000 (01:59 +0000)]
ThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing

Summary:
The function importer already decided what symbols need to be pulled
in. Also these magically added ones will not be in the export list
for the source module, which can confuse the internalizer for
instance.

Reviewers: tejohnson, rafael

Subscribers: joker.eph, llvm-commits

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

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

8 years agoBitcodeWriter: Emit metadata in post-order (again)
Duncan P. N. Exon Smith [Thu, 21 Apr 2016 01:55:12 +0000 (01:55 +0000)]
BitcodeWriter: Emit metadata in post-order (again)

Emit metadata nodes in post-order.  The iterative algorithm from r266709
failed to maintain this property.  After understanding my mistake, it
wasn't too hard to write a test with llvm-bcanalyzer (and I've actually
made this change once before: see r220340).

This also reverts the "noisy" testcase change from r266709.  That should
have been more of a red flag :/.

Note: The same bug crept into the ValueMapper in r265456.  I'm still
working on the fix.

llvm-svn: 266947

8 years agoMachineSched: Cleanup; NFC
Matthias Braun [Thu, 21 Apr 2016 01:54:13 +0000 (01:54 +0000)]
MachineSched: Cleanup; NFC

llvm-svn: 266946

8 years ago[modules] Make the tweak to avoid circular inclusion of emmintrin.h and
Richard Smith [Thu, 21 Apr 2016 01:46:37 +0000 (01:46 +0000)]
[modules] Make the tweak to avoid circular inclusion of emmintrin.h and
xmmintrin.h a bit more directed. If for whatever reason modules are enabled but
we textually include one of these headers, don't deploy the special case for
modules. To make this work cleanly, extend __building_module to be defined
even when modules is disabled.

llvm-svn: 266945

8 years agoExpressions can run without a process.
Jim Ingham [Thu, 21 Apr 2016 01:46:11 +0000 (01:46 +0000)]
Expressions can run without a process.

Code was added in ClangExpressionParser::ClangExpressionParser that was calling through
the process w/o checking that it was good.  Also, we were pretending that we could do something
reasonable if we had no target, but that's actually not true, so I check for a target at the
beginning of the constructor and don't make a compiler in that case.

<rdar://problem/25841198>

llvm-svn: 266944

8 years agoReland test change.
Nico Weber [Thu, 21 Apr 2016 01:33:04 +0000 (01:33 +0000)]
Reland test change.

llvm-svn: 266943

8 years agoRevert unintentionally commited bits in r266935.
Nico Weber [Thu, 21 Apr 2016 01:31:37 +0000 (01:31 +0000)]
Revert unintentionally commited bits in r266935.

llvm-svn: 266942

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