platform/upstream/llvm.git
7 years agoDIE::addAttribute(): Prune a redundant \param. [-Wdocumentation]
NAKAMURA Takumi [Thu, 8 Dec 2016 15:00:07 +0000 (15:00 +0000)]
DIE::addAttribute(): Prune a redundant \param. [-Wdocumentation]

llvm-svn: 289056

7 years ago[Sema] Avoid "case value not in enumerated type" warning for C++11 opaque enums
Alex Lorenz [Thu, 8 Dec 2016 14:46:05 +0000 (14:46 +0000)]
[Sema] Avoid "case value not in enumerated type" warning for C++11 opaque enums

This commit ensures that the switch warning "case value not in enumerated type"
isn't shown for opaque enums. We don't know the actual list of values in opaque
enums, so that warning is incorrect.

rdar://29230764

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

llvm-svn: 289055

7 years agoLanaiInstPrinter: Prune unused libdeps.
NAKAMURA Takumi [Thu, 8 Dec 2016 14:26:30 +0000 (14:26 +0000)]
LanaiInstPrinter: Prune unused libdeps.

llvm-svn: 289054

7 years agoDebugInfoDWARFTests: Prune unused libdeps.
NAKAMURA Takumi [Thu, 8 Dec 2016 14:26:23 +0000 (14:26 +0000)]
DebugInfoDWARFTests: Prune unused libdeps.

llvm-svn: 289053

7 years agoDebugInfoDWARFTests: Add missing deps, AsmPrinter and Object.
NAKAMURA Takumi [Thu, 8 Dec 2016 14:11:02 +0000 (14:11 +0000)]
DebugInfoDWARFTests: Add missing deps, AsmPrinter and Object.

llvm-svn: 289052

7 years agoDebugInfoDWARFTests: Reorder LLVM_LINK_COMPONENTS.
NAKAMURA Takumi [Thu, 8 Dec 2016 14:10:57 +0000 (14:10 +0000)]
DebugInfoDWARFTests: Reorder LLVM_LINK_COMPONENTS.

llvm-svn: 289051

7 years ago[SelectionDAG] Add expansion and promotion of [US]MUL_LOHI
Nicolai Haehnle [Thu, 8 Dec 2016 14:08:14 +0000 (14:08 +0000)]
[SelectionDAG] Add expansion and promotion of [US]MUL_LOHI

Summary:
Most targets set the action for these nodes to Expand even though there
isn't actually any code for them in ExpandNode. Instead, targets simply
relied on the fact that no code generates these nodes as long as the
nodes aren't legal or custom.

However, generating these nodes can be useful e.g. for divide-by-constant
in wider integer types.

Expand of [US]MUL_LOHI will use MULH[US] when legal or custom, and
a sequence of half-width multiplications otherwise. Promote uses a wider
multiply.

This patch intends to not change the generated code, but indirect effects
are possible since expansions/promotions that were previously done in
DAGCombine may now be done in LegalizeDAG.

See D24822 for a change that actually uses the new expansion.

Reviewers: spatel, bkramer, venkatra, efriedma, hfinkel, ast, nadav, tstellarAMD

Subscribers: arsenm, jyknight, nemanjai, wdng, nhaehnle, llvm-commits

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

llvm-svn: 289050

7 years agoX86: Add checks for fma_patterns[_wide].ll with -enable-no-infs-fp-math
Nicolai Haehnle [Thu, 8 Dec 2016 14:08:08 +0000 (14:08 +0000)]
X86: Add checks for fma_patterns[_wide].ll with -enable-no-infs-fp-math

This re-adds checks for the patterns that were disabled with r288506.

Reviewers: spatel, delena, craig.topper

Subscribers: llvm-commits

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

llvm-svn: 289049

7 years agoAMDGPU: Properly implement SIRegisterInfo::isFrameOffsetLegal and needsFrameBaseReg
Nicolai Haehnle [Thu, 8 Dec 2016 14:08:02 +0000 (14:08 +0000)]
AMDGPU: Properly implement SIRegisterInfo::isFrameOffsetLegal and needsFrameBaseReg

Summary:
Without the fix to isFrameOffsetLegal to consider the instruction's
immediate offset, the new test case hits the corresponding assertion in
resolveFrameIndex, because the LocalStackSlotAllocation pass re-uses a
different base register.

With only the fix to isFrameOffsetLegal, code quality reduces in a bunch of
places because frame base registers are added where they're not needed.
This is addressed by properly implementing needsFrameBaseReg, which also
helps to avoid unnecessary zero frame indices in a bunch of other places.

Fixes piglit glsl-1.50/execution/variable-indexing/gs-output-array-vec4-index-wr.shader_test

Reviewers: arsenm, tstellarAMD

Subscribers: qcolombet, kzhuravl, wdng, yaxunl, tony-tye, llvm-commits

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

llvm-svn: 289048

7 years ago[analyzer] Add dispatch_data_create as a special case in RetainCountChecker.
Artem Dergachev [Thu, 8 Dec 2016 14:05:48 +0000 (14:05 +0000)]
[analyzer] Add dispatch_data_create as a special case in RetainCountChecker.

This function receives a callback block. The analyzer suspects that this block
may be used to take care of releasing the libdispatch object returned from
the function. In fact, it doesn't - it only releases the raw data buffer.
Inform the analyzer about that. Fixes the resulting false negatives.

rdar://problem/22280098

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

llvm-svn: 289047

7 years ago[ELF] - Read 16 bits for R_386_16/R_386_PC16 relocations instead of 32.
George Rimar [Thu, 8 Dec 2016 13:50:28 +0000 (13:50 +0000)]
[ELF] - Read 16 bits for R_386_16/R_386_PC16 relocations instead of 32.

Looks it was theoretically incorrect if the section is at the very end of the file as
reading 32 bits would pass the end of file

llvm-svn: 289046

7 years ago[ELF] ifunc implementation using synthetic sections
Peter Smith [Thu, 8 Dec 2016 12:58:55 +0000 (12:58 +0000)]
[ELF] ifunc implementation using synthetic sections

This change introduces new synthetic sections IpltSection, IgotPltSection
that represent the ifunc entries that would previously have been put in
the PltSection and the GotPltSection. The separation makes sure that
the R_*_IRELATIVE relocations are placed after the non R_*_IRELATIVE
relocations, which permits ifunc resolvers to know that the .got.plt
slots will be initialized prior to the resolver being called.

A secondary benefit is that for ARM we can move the IgotPltSection and its
dynamic relocations to the .got and .rel.dyn as the ARM glibc expects all
the R_*_IRELATIVE relocations to be in the .rel.dyn

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

llvm-svn: 289045

7 years agoMove DwarfGenerator.cpp to unittests
Daniel Jasper [Thu, 8 Dec 2016 12:45:29 +0000 (12:45 +0000)]
Move DwarfGenerator.cpp to unittests

So far it creates a test helper and so it should be moved there. It also
create a layering cycle between CodeGen and CodeGen/AsmPrinter, which
should be avoided.

Review: https://reviews.llvm.org/D27570
llvm-svn: 289044

7 years ago[SLP] Fix for PR6246: vectorization for scalar ops on vector elements.
Alexey Bataev [Thu, 8 Dec 2016 11:57:51 +0000 (11:57 +0000)]
[SLP] Fix for PR6246: vectorization for scalar ops on vector elements.

When trying to vectorize trees that start at insertelement instructions
function tryToVectorizeList() uses vectorization factor calculated as
MinVecRegSize/ScalarTypeSize. But sometimes it does not work as tree
cost for this fixed vectorization factor is too high.
Patch tries to improve the situation. It tries different vectorization
factors from max(PowerOf2Floor(NumberOfVectorizedValues),
MinVecRegSize/ScalarTypeSize) to MinVecRegSize/ScalarTypeSize and tries
to choose the best one.

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

llvm-svn: 289043

7 years ago[ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmType
Malcolm Parsons [Thu, 8 Dec 2016 11:46:22 +0000 (11:46 +0000)]
[ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmType

Summary: Needed for https://reviews.llvm.org/D27166

Reviewers: sbenza, bkramer, klimek

Subscribers: aemerson, cfe-commits

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

llvm-svn: 289042

7 years agoFix MSCV compilation broken by r289040
Pavel Labath [Thu, 8 Dec 2016 11:45:38 +0000 (11:45 +0000)]
Fix MSCV compilation broken by r289040

I wanted to use the "not" keyword to make sure it does not get lost in between
other checks. MSVC does not like that.

llvm-svn: 289041

7 years agoImprove format member detection in llvm::formatv
Pavel Labath [Thu, 8 Dec 2016 11:31:19 +0000 (11:31 +0000)]
Improve format member detection in llvm::formatv

Summary:
The existing detection of a format member function has a couple of deficiencies:
- the member function does not get detected if one calls formatv with an lvalue,
  because the template parameter gets deduced as T&, which fails the is_class
  check.
- it also did not work if the function was called with a const variable because
  the template parameter would get deduced as const T&, again failing the
  is_class check.

This fixes the problem by stripping the references in the uses_format_member
template, to make sure the type is correctly detected as class. It also provides
specializations of the has_FormatMember template for const and non-const members
of the types in order to enable declaring the format member as a "const"
function. I have added tests that verify that formatv can be now called in these
scenarios. As some scenarios could not be verified at runtime (e.g. making sure
that calling a non-const format member on a const object does *not* compile), I
have also added some static_asserts which test the behaviour of the template
classes used internally by formatv().

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 289040

7 years ago[AVR] Add MIR tests for pseudo instruction expansions
Dylan McKay [Thu, 8 Dec 2016 10:52:13 +0000 (10:52 +0000)]
[AVR] Add MIR tests for pseudo instruction expansions

This adds tests for 13 pseudo instruction expansions.

llvm-svn: 289039

7 years agoWdocumentation fix
Simon Pilgrim [Thu, 8 Dec 2016 10:41:41 +0000 (10:41 +0000)]
Wdocumentation fix

llvm-svn: 289038

7 years agoWdocumentation fix
Simon Pilgrim [Thu, 8 Dec 2016 10:31:32 +0000 (10:31 +0000)]
Wdocumentation fix

llvm-svn: 289037

7 years agoAdd a comment consumer mechanism to MCAsmLexer
Oliver Stannard [Thu, 8 Dec 2016 10:31:21 +0000 (10:31 +0000)]
Add a comment consumer mechanism to MCAsmLexer

This allows clients to register an AsmCommentConsumer with the MCAsmLexer,
which receives a callback each time a comment is parsed.

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

llvm-svn: 289036

7 years ago[X86][SSE] Add vector test for (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2...
Simon Pilgrim [Thu, 8 Dec 2016 10:17:25 +0000 (10:17 +0000)]
[X86][SSE] Add vector test for (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2) detailed in D19325

llvm-svn: 289035

7 years agoAdd more test cases to packaged_task copyability test
Eric Fiselier [Thu, 8 Dec 2016 10:02:04 +0000 (10:02 +0000)]
Add more test cases to packaged_task copyability test

llvm-svn: 289034

7 years agoAvoid C++17 guaranteed copy elision when testing for non-copyability
Eric Fiselier [Thu, 8 Dec 2016 09:57:00 +0000 (09:57 +0000)]
Avoid C++17 guaranteed copy elision when testing for non-copyability

llvm-svn: 289033

7 years agoSupport of mips & mips64 for openmprtl
Sylvestre Ledru [Thu, 8 Dec 2016 09:22:24 +0000 (09:22 +0000)]
Support of mips & mips64 for openmprtl

Summary:
Implemented by Dejan Latinovic
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790735 for more more information

Reviewers: AndreyChurbanov, jlpeyton

Subscribers: openmp-commits, mgorny

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

llvm-svn: 289032

7 years ago[AVR] Add MIR tests for a few pseudo instructions
Dylan McKay [Thu, 8 Dec 2016 08:54:41 +0000 (08:54 +0000)]
[AVR] Add MIR tests for a few pseudo instructions

llvm-svn: 289031

7 years ago[AVR] Add an assertion to ensure we don't emit LPM when it's unsupported
Dylan McKay [Thu, 8 Dec 2016 08:34:13 +0000 (08:34 +0000)]
[AVR] Add an assertion to ensure we don't emit LPM when it's unsupported

llvm-svn: 289030

7 years agoFix PR30323: numeric_limits<T>::max_digits10 when using 16 bit ints.
Eric Fiselier [Thu, 8 Dec 2016 07:30:01 +0000 (07:30 +0000)]
Fix PR30323: numeric_limits<T>::max_digits10 when using 16 bit ints.

Summary: Also see https://llvm.org/bugs/show_bug.cgi?id=30323

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 289029

7 years agoFix _LIBCPP_VERSION tests with modules on Darwin
Eric Fiselier [Thu, 8 Dec 2016 06:37:41 +0000 (06:37 +0000)]
Fix _LIBCPP_VERSION tests with modules on Darwin

llvm-svn: 289028

7 years ago[MSAN][MIPS] Fix fork.cc test on MIPS
Sagar Thakur [Thu, 8 Dec 2016 06:30:58 +0000 (06:30 +0000)]
[MSAN][MIPS] Fix fork.cc test on MIPS

Summary: For platforms which support slow unwinder only, we restrict the store context size to 1, basically only storing the current pc. We do this because the slow unwinder which is based on libunwind is not async signal safe and causes random freezes in forking applications as well as in signal handlers.

Reviewed by eugenis.
Differential: D23107

llvm-svn: 289027

7 years agoWhen we interrupt a process, it was possible or the thread names
Jason Molenda [Thu, 8 Dec 2016 06:27:29 +0000 (06:27 +0000)]
When we interrupt a process, it was possible or the thread names
to not be set by Process::WillPublicStop() so the driver won't get
access to them.  The fix is straightforward, moving the call to
WillPublicStop above the early return for the interrupt case.  (the
interrupt case does an early return because the rest of the function
is concerned with running stop hooks etc and those are not applicable
when we've interrupted the process).

Also added a test case for it.  The test case is a little complicated
because I needed to drive lldb asynchronously to give the program
a chance to get up and running before I interrupt it.  Running to
a breakpoint was not sufficient to catch this bug.

<rdar://problem/22693778>

llvm-svn: 289026

7 years ago[ELF][MIPS] Make _gp, _gp_disp, __gnu_local_gp global symbols
Simon Atanasyan [Thu, 8 Dec 2016 06:19:47 +0000 (06:19 +0000)]
[ELF][MIPS] Make _gp, _gp_disp, __gnu_local_gp global symbols

These MIPS specific symbols should be global because in general they can
have an arbitrary value. By default this value is a fixed offset from .got
section.

This patch adds more checks to the mips-gp-local.s test case but marks
it as XFAIL because LLD does not allow redefinition of absolute symbols
value by a linker script. This should be fixed by D27276.

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

llvm-svn: 289025

7 years agoLTO: Hash the parts of the LTO configuration that affect code generation.
Peter Collingbourne [Thu, 8 Dec 2016 05:28:30 +0000 (05:28 +0000)]
LTO: Hash the parts of the LTO configuration that affect code generation.

Most importantly, we need to hash the relocation model, otherwise we can
end up trying to link non-PIC object files into PIEs or DSOs.

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

llvm-svn: 289024

7 years agoIncrease timeout for Frontboard app launch request from 9 to 20 seconds
Jason Molenda [Thu, 8 Dec 2016 05:12:45 +0000 (05:12 +0000)]
Increase timeout for Frontboard app launch request from 9 to 20 seconds
to match other timeouts.

llvm-svn: 289023

7 years ago[DOXYGEN] Improved doxygen comments for avxintrin.h intrinsics.
Ekaterina Romanova [Thu, 8 Dec 2016 04:09:17 +0000 (04:09 +0000)]
[DOXYGEN] Improved doxygen comments for avxintrin.h intrinsics.

Tagged parameter names with \a doxygen command to display them in italics.
Formatted comments to fit into 80 chars.

llvm-svn: 289022

7 years ago[c++1z] P0490R0, NB comment GB 20: if std::tuple_size<T> is complete, use the
Richard Smith [Thu, 8 Dec 2016 03:24:55 +0000 (03:24 +0000)]
[c++1z] P0490R0, NB comment GB 20: if std::tuple_size<T> is complete, use the
tuple-like interpretation of decomposition declaration even if there is no
::value member. We already did this, anticipating this resolution, just update
comments and tweak a testcase.

llvm-svn: 289021

7 years agoDelete dead code.
Rafael Espindola [Thu, 8 Dec 2016 03:17:05 +0000 (03:17 +0000)]
Delete dead code.

Thanks to George Rimar for pointing it out.

llvm-svn: 289020

7 years ago[c++1z] P0003R5: Removing dynamic exception specifications.
Richard Smith [Thu, 8 Dec 2016 02:49:07 +0000 (02:49 +0000)]
[c++1z] P0003R5: Removing dynamic exception specifications.

We continue to support dynamic exception specifications in C++1z as an
extension, but produce an error-by-default warning when we encounter one. This
allows users to opt back into the feature with a warning flag, and implicitly
opts system headers back into the feature should they happen to use it.

There is one semantic change implied by P0003R5 but not implemented here:
violating a throw() exception specification should now call std::terminate
directly instead of calling std::unexpected(), but since P0003R5 also removes
std::unexpected() and std::set_unexpected, and the default unexpected handler
calls std::terminate(), a conforming C++1z program cannot tell that we are
still calling it. The upside of this strategy is perfect backwards
compatibility; the downside is that we don't get the more efficient 'noexcept'
codegen for 'throw()'.

llvm-svn: 289019

7 years ago[Headers] Enable #include_next<float.h> on Darwin
Bruno Cardoso Lopes [Thu, 8 Dec 2016 02:13:56 +0000 (02:13 +0000)]
[Headers] Enable #include_next<float.h> on Darwin

Allows darwin targets to provide additional definitions and
implementation specifc values for float.h

rdar://problem/21961491

llvm-svn: 289018

7 years agoUnbreak buildbots where the debug info test was crashing due to unchecked error.
Greg Clayton [Thu, 8 Dec 2016 02:11:03 +0000 (02:11 +0000)]
Unbreak buildbots where the debug info test was crashing due to unchecked error.

llvm-svn: 289017

7 years agoSet the address size based on the target's arch instead
Jason Molenda [Thu, 8 Dec 2016 02:02:45 +0000 (02:02 +0000)]
Set the address size based on the target's arch instead
of using the address of the all_image_infos struct.
<rdar://problem/29547847>

llvm-svn: 289016

7 years agoConvert CommandObjectFrame to entry-based Args access.
Zachary Turner [Thu, 8 Dec 2016 02:02:09 +0000 (02:02 +0000)]
Convert CommandObjectFrame to entry-based Args access.

In the process, discovered a bug related to the use of an
uninitialized-pointer, and fixed as suggested by Enrico
in an lldb-dev mailing list thread.

llvm-svn: 289015

7 years agoRevert "[CodeGen] Fix invalid DWARF info on Win64"
Keno Fischer [Thu, 8 Dec 2016 01:56:23 +0000 (01:56 +0000)]
Revert "[CodeGen] Fix invalid DWARF info on Win64"

Appears to break on build bots. Reverting pending investigation.

llvm-svn: 289014

7 years ago[CodeGen] Fix invalid DWARF info on Win64
Keno Fischer [Thu, 8 Dec 2016 01:40:21 +0000 (01:40 +0000)]
[CodeGen] Fix invalid DWARF info on Win64

The relocations for `DIEEntry::EmitValue` were wrong for Win64
(emitting FK_Data_4 instead of FK_SecRel_4). This corrects that
oversight so that the DWARF data is correct in Win64 COFF files.

Fixes PR15393.

Patch by Jameson Nash <jameson@juliacomputing.com> based on a patch
by David Majnemer.

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

llvm-svn: 289013

7 years agoConvert CommandObjectCommands to entry-based Args access.
Zachary Turner [Thu, 8 Dec 2016 01:31:04 +0000 (01:31 +0000)]
Convert CommandObjectCommands to entry-based Args access.

llvm-svn: 289012

7 years agoLoosen checks for _MSC_FULL_VER under -fms-extensions.
David L. Jones [Thu, 8 Dec 2016 01:11:41 +0000 (01:11 +0000)]
Loosen checks for _MSC_FULL_VER under -fms-extensions.

Summary:
On actual Windows hosts :-) , this could report something other than the
fallback, with a non-zero minor/build number.

Reviewers: rnk, llvm-commits

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

llvm-svn: 289011

7 years agoMake a DWARF generator so we can unit test DWARF APIs with gtest.
Greg Clayton [Thu, 8 Dec 2016 01:03:48 +0000 (01:03 +0000)]
Make a DWARF generator so we can unit test DWARF APIs with gtest.

The only tests we have for the DWARF parser are the tests that use llvm-dwarfdump and expect output from textual dumps.

More DWARF parser modification are coming in the next few weeks and I wanted to add tests that can verify that we can encode and decode all form types, as well as test some other basic DWARF APIs where we ask DIE objects for their children and siblings.

DwarfGenerator.cpp was added in the lib/CodeGen directory. This file contains the code necessary to easily create DWARF for tests:

dwarfgen::Generator DG;
Triple Triple("x86_64--");
bool success = DG.init(Triple, Version);
if (!success)
  return;
dwarfgen::CompileUnit &CU = DG.addCompileUnit();
dwarfgen::DIE CUDie = CU.getUnitDIE();

CUDie.addAttribute(DW_AT_name, DW_FORM_strp, "/tmp/main.c");
CUDie.addAttribute(DW_AT_language, DW_FORM_data2, DW_LANG_C);

dwarfgen::DIE SubprogramDie = CUDie.addChild(DW_TAG_subprogram);
SubprogramDie.addAttribute(DW_AT_name, DW_FORM_strp, "main");
SubprogramDie.addAttribute(DW_AT_low_pc, DW_FORM_addr, 0x1000U);
SubprogramDie.addAttribute(DW_AT_high_pc, DW_FORM_addr, 0x2000U);

dwarfgen::DIE IntDie = CUDie.addChild(DW_TAG_base_type);
IntDie.addAttribute(DW_AT_name, DW_FORM_strp, "int");
IntDie.addAttribute(DW_AT_encoding, DW_FORM_data1, DW_ATE_signed);
IntDie.addAttribute(DW_AT_byte_size, DW_FORM_data1, 4);

dwarfgen::DIE ArgcDie = SubprogramDie.addChild(DW_TAG_formal_parameter);
ArgcDie.addAttribute(DW_AT_name, DW_FORM_strp, "argc");
// ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref4, IntDie);
ArgcDie.addAttribute(DW_AT_type, DW_FORM_ref_addr, IntDie);

StringRef FileBytes = DG.generate();
MemoryBufferRef FileBuffer(FileBytes, "dwarf");
auto Obj = object::ObjectFile::createObjectFile(FileBuffer);
EXPECT_TRUE((bool)Obj);
DWARFContextInMemory DwarfContext(*Obj.get());
This code is backed by the AsmPrinter code that emits DWARF for the actual compiler.

While adding unit tests it was discovered that DIEValue that used DIEEntry as their values had bugs where DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref8, and DW_FORM_ref_udata forms were not supported. These are all now supported. Added support for DW_FORM_string so we can emit inlined C strings.

Centralized the code to unique abbreviations into a new DIEAbbrevSet class and made both the dwarfgen::Generator and the llvm::DwarfFile classes use the new class.

Fixed comments in the llvm::DIE class so that the Offset is known to be the compile/type unit offset.

DIEInteger now supports more DW_FORM values.

There are also unit tests that cover:

Encoding and decoding all form types and values
Encoding and decoding all reference types (DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata, DW_FORM_ref_addr) including cross compile unit references with that go forward one compile unit and backward on compile unit.

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

llvm-svn: 289010

7 years agoWork around a bogus warning on MSVC.
Zachary Turner [Thu, 8 Dec 2016 00:54:24 +0000 (00:54 +0000)]
Work around a bogus warning on MSVC.

llvm-svn: 289009

7 years agoCFI-icall on Thumb
Evgeniy Stepanov [Thu, 8 Dec 2016 00:32:26 +0000 (00:32 +0000)]
CFI-icall on Thumb

Replace @progbits in the section directive with %progbits, because "@" starts a comment on arm/thumb.
Use b.w branch instruction.
Use .thumb_function and .thumb_set for proper arm/thumb interwork. This way jumptable entry addresses on thumb have bit 0 set (correctly). This does not affect CFI check math, because the address of the jumptable start also has that bit set.

This does not work on thumbv5, because it does not support b.w, and the linker would not insert a veneer (trampoline?) to extend the range of b.n. We may need to do full-range plt-style jumptables on thumbv54, which are 12 bytes per entry. Another option is "push lr; bl; pop pc" (4 bytes) but that needs unwinding instructions, etc.

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

llvm-svn: 289008

7 years agoLTO: Remove the unused Config::Features field.
Peter Collingbourne [Thu, 8 Dec 2016 00:27:37 +0000 (00:27 +0000)]
LTO: Remove the unused Config::Features field.

We are currently initializing Features via MAttrs.

llvm-svn: 289007

7 years agoImprove crashlog.py so it can handle more iOS crashlog files.
Greg Clayton [Thu, 8 Dec 2016 00:22:45 +0000 (00:22 +0000)]
Improve crashlog.py so it can handle more iOS crashlog files.

<rdar://problem/29191857>

llvm-svn: 289006

7 years ago[Driver][Darwin] Disable default stack protector levels in freestanding mode.
Bruno Cardoso Lopes [Thu, 8 Dec 2016 00:22:06 +0000 (00:22 +0000)]
[Driver][Darwin] Disable default stack protector levels in freestanding mode.

Currently -fstack-protector is on by default when using -ffreestanding.
Change the default behavior to have it off when using -ffreestanding.

rdar://problem/14089363

llvm-svn: 289005

7 years agoThe few days mentioned in r267095 are over
Matthias Braun [Thu, 8 Dec 2016 00:16:42 +0000 (00:16 +0000)]
The few days mentioned in r267095 are over

llvm-svn: 289004

7 years agoTargetPassConfig: Rename DisablePostRA -> DisablePostRASched; NFC
Matthias Braun [Thu, 8 Dec 2016 00:16:08 +0000 (00:16 +0000)]
TargetPassConfig: Rename DisablePostRA -> DisablePostRASched; NFC

llvm-svn: 289003

7 years agoLivePhysReg: Use reference instead of pointer in init(); NFC
Matthias Braun [Thu, 8 Dec 2016 00:15:51 +0000 (00:15 +0000)]
LivePhysReg: Use reference instead of pointer in init(); NFC

llvm-svn: 289002

7 years ago[InlineSpiller] Don't call TargetInstrInfo::foldMemoryOperand with an empty list.
Quentin Colombet [Thu, 8 Dec 2016 00:06:51 +0000 (00:06 +0000)]
[InlineSpiller] Don't call TargetInstrInfo::foldMemoryOperand with an empty list.

Since r287792 if we try to do that we will hit an assert.

llvm-svn: 289001

7 years agoFix an unannotated fallthrough that was causing a warning.
Greg Clayton [Wed, 7 Dec 2016 23:52:27 +0000 (23:52 +0000)]
Fix an unannotated fallthrough that was causing a warning.

llvm-svn: 289000

7 years agoFixed DoConnectRemote issues where ProcessKDP wasn't switched over to use the version...
Greg Clayton [Wed, 7 Dec 2016 23:51:49 +0000 (23:51 +0000)]
Fixed DoConnectRemote issues where ProcessKDP wasn't switched over to use the version that needed a StringRef as the URL, and also updated all virtual functions to say "override" to make sure this doesn't happen again.

llvm-svn: 288999

7 years agoRefactor how the MSVC toolchain searches for a compatibility version.
David L. Jones [Wed, 7 Dec 2016 23:41:58 +0000 (23:41 +0000)]
Refactor how the MSVC toolchain searches for a compatibility version.

Summary:
The MSVC toolchain and Clang driver combination currently uses a fairly complex
sequence of steps to determine the MS compatibility version to pass to cc1.
There is some oddness in this sequence currently, with some code which inspects
flags in the toolchain, and some code which inspects the triple and local
environment in the driver code.

This change is an attempt to consolidate most of this logic so that
Win32-specific code lives in MSVCToolChain.cpp. I'm not 100% happy with the
split, so any suggestions are welcome.

There are a few things you might want to watch for for specifically:

 - On all platforms, if MSVC compatibility flags are provided (and valid), use
   those.
 - The fallback sequence should be the same as before, but is now consolidated
   into MSVCToolChain::getMSVCVersion:
   - Otherwise, try to use the Triple.
   - Otherwise, on Windows, check the executable.
   - Otherwise, on Windows or with --fms-extensions, default to 18.
   - Otherwise, we can't determine the version.
 - MSVCToolChain::ComputeEffectiveTriple no longer calls the base
   ToolChain::ComputeEffectiveClangTriple. The only thing it would change for
   Windows the architecture, which we don't care about for the compatibility
   version.
    - I'm not sure whether this is philosophically correct (but it should
      be easy to add back to MSVCToolChain::getMSVCVersionFromTriple if not).
    - Previously, Tools.cpp just called getTriple() anyhow, so it doesn't look
      like the effective triple was always being used previously anyhow.

Reviewers: hans, compnerd, llvm-commits, rnk

Subscribers: amccarth

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

llvm-svn: 288998

7 years agoAdd more tests for MSVC version handling.
David L. Jones [Wed, 7 Dec 2016 23:39:44 +0000 (23:39 +0000)]
Add more tests for MSVC version handling.

Summary:
This change adds more test cases for the default MSVC compatibility version:
 1. When -fms-extensions is supplied, but -fmsc-version and
    -fms-compatibility-version are not.
 2. With the target triple specifies an MSVC environment, but no other
    -fms* flags.

Reviewers: rnk, llvm-commits

Subscribers: hans, compnerd, amccarth

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

llvm-svn: 288997

7 years agoRemove redundant call of std::unique_ptr::get.
Rui Ueyama [Wed, 7 Dec 2016 23:26:39 +0000 (23:26 +0000)]
Remove redundant call of std::unique_ptr::get.

Obj is an instance of std::unique_ptr, so *Obj.get() is the same as *Obj.

llvm-svn: 288996

7 years agoFix Windows buildbots.
Rui Ueyama [Wed, 7 Dec 2016 23:24:32 +0000 (23:24 +0000)]
Fix Windows buildbots.

clang-format-diff sorted these #include's in the asciibetical order,
but they need to be in this order.

llvm-svn: 288995

7 years ago[Driver] Add tests for default stack protector values on Darwin
Bruno Cardoso Lopes [Wed, 7 Dec 2016 23:20:30 +0000 (23:20 +0000)]
[Driver] Add tests for default stack protector values on Darwin

llvm-svn: 288994

7 years agoMake demangle() return None instead of "" if a given string is not a mangled symbol.
Rui Ueyama [Wed, 7 Dec 2016 23:17:05 +0000 (23:17 +0000)]
Make demangle() return None instead of "" if a given string is not a mangled symbol.

llvm-svn: 288993

7 years agoCOFF: Define overloaded toString functions.
Rui Ueyama [Wed, 7 Dec 2016 23:17:02 +0000 (23:17 +0000)]
COFF: Define overloaded toString functions.

Previously, we had different way to stringize SymbolBody and InputFile
to construct error messages. This patch defines overloaded function
toString() so that we don't need to memorize all these different
function names.

With that change, it is now easy to include demangled names in error
messages. Now, if there is a symbol name conflict, we'll print out
both mangled and demangled names.

llvm-svn: 288992

7 years ago[asan] Split load and store checks in test. NFCI
Filipe Cabecinhas [Wed, 7 Dec 2016 22:37:11 +0000 (22:37 +0000)]
[asan] Split load and store checks in test. NFCI

llvm-svn: 288991

7 years ago[yaml2obj] Refactor and abstract yaml2dwarf functions
Chris Bieneman [Wed, 7 Dec 2016 22:30:15 +0000 (22:30 +0000)]
[yaml2obj] Refactor and abstract yaml2dwarf functions

This abstracts the code for emitting DWARF binary from the DWARFYAML types into reusable interfaces that could be used by ELF and COFF.

llvm-svn: 288990

7 years ago[ADT, IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use...
Eugene Zelenko [Wed, 7 Dec 2016 22:06:02 +0000 (22:06 +0000)]
[ADT, IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 288989

7 years ago[XRay][AArch64] Disable the unstable test XRay-aarch64-linux::patching-unpatching.cc
Serge Rogatch [Wed, 7 Dec 2016 22:00:02 +0000 (22:00 +0000)]
[XRay][AArch64] Disable the unstable test XRay-aarch64-linux::patching-unpatching.cc

Summary:
The test `XRay-aarch64-linux::patching-unpatching.cc` sometimes passes, sometimes fails on buildbots.
This patch disables test `patching-unpatching.cc` for AArch64 targets.

Reviewers: rengolin, dberris

Subscribers: llvm-commits, iid_iunknown, aemerson

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

llvm-svn: 288988

7 years ago[BDCE] Skip metadata while replacing uses.
Davide Italiano [Wed, 7 Dec 2016 21:47:32 +0000 (21:47 +0000)]
[BDCE] Skip metadata while replacing uses.

The fix committed in r288851 doesn't cover all the cases.
In particular, if we have an instruction with side effects
which has a no non-dbg use not depending on the bits, we still
perform RAUW destroying the dbg.value's first argument.
Prevent metadata from being replaced here to avoid the issue.

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

llvm-svn: 288987

7 years ago[obj2yaml] Refactor and abstract dwarf2yaml
Chris Bieneman [Wed, 7 Dec 2016 21:47:28 +0000 (21:47 +0000)]
[obj2yaml] Refactor and abstract dwarf2yaml

This makes the dwarf2yaml code separated and reusable allowing ELF and COFF to share implementations with MachO.

llvm-svn: 288986

7 years agoGlobalISel: use correct builder for ConstantExprs.
Tim Northover [Wed, 7 Dec 2016 21:29:15 +0000 (21:29 +0000)]
GlobalISel: use correct builder for ConstantExprs.

ConstantExpr instances were emitting code into the current block rather than
the entry block. This meant they didn't necessarily dominate all uses, which is
clearly wrong.

llvm-svn: 288985

7 years ago[ObjectYAML] Pull DWARF support into DWARFYAML namespace
Chris Bieneman [Wed, 7 Dec 2016 21:26:32 +0000 (21:26 +0000)]
[ObjectYAML] Pull DWARF support into DWARFYAML namespace

Since DWARF formatting is agnostic to the object file it is stored in, it doesn't make sense for this to be in the MachOYAML implementation. Pulling it into its own namespace means we could modify the ELF and COFF YAML tools to emit DWARF as well.

In a follow-up patch I will better abstract this in obj2yaml and yaml2obj so that the DWARF bits in the tools can be re-used too.

llvm-svn: 288984

7 years agoGlobalISel: store the current MachineFunction as direct state. NFC.
Tim Northover [Wed, 7 Dec 2016 21:17:47 +0000 (21:17 +0000)]
GlobalISel: store the current MachineFunction as direct state. NFC.

Having to ask the MIRBuilder for the current function is a little awkward, and
I'm intending to improve how that's threaded through anyway.

llvm-svn: 288983

7 years agoRename MaxPageSize to DefaultMaxPageSize to avoid confusion.
Rafael Espindola [Wed, 7 Dec 2016 21:13:27 +0000 (21:13 +0000)]
Rename MaxPageSize to DefaultMaxPageSize to avoid confusion.

Thanks to Rui for the suggestion.

llvm-svn: 288982

7 years ago[ObjectYAML] Rename DWARF entries to match section names
Chris Bieneman [Wed, 7 Dec 2016 21:09:37 +0000 (21:09 +0000)]
[ObjectYAML] Rename DWARF entries to match section names

This change makes the yaml tags for the members of the DWARF data match the names of the DWARF sections.

llvm-svn: 288981

7 years agoGlobalISel: simplify MachineIRBuilder interface.
Tim Northover [Wed, 7 Dec 2016 21:05:38 +0000 (21:05 +0000)]
GlobalISel: simplify MachineIRBuilder interface.

MachineIRBuilder had weird before/after and beginning/end flags for the insert
point. Unfortunately the non-default means that instructions will be inserted
in reverse order which is almost never what anyone wants.

Really, I think we just want (like IRBuilder has) the ability to insert at any
C++ iterator-style point (i.e. before any instruction or before MBB.end()). So
this fixes MIRBuilders to behave like IRBuilders in this respect.

llvm-svn: 288980

7 years ago[libFuzzer] include FuzzerIO.h and hopefully fix the Mac build. reported by Dejan...
Kostya Serebryany [Wed, 7 Dec 2016 21:02:48 +0000 (21:02 +0000)]
[libFuzzer] include FuzzerIO.h and hopefully fix the Mac build. reported by Dejan Mircevski

llvm-svn: 288979

7 years agoInstCombine: Fold bitcast of vector to FP scalar
Matt Arsenault [Wed, 7 Dec 2016 20:56:11 +0000 (20:56 +0000)]
InstCombine: Fold bitcast of vector to FP scalar

llvm-svn: 288978

7 years ago[CMake] Add check for HAVE_CRASHREPORTER_INFO
Chris Bieneman [Wed, 7 Dec 2016 20:55:38 +0000 (20:55 +0000)]
[CMake] Add check for HAVE_CRASHREPORTER_INFO

This was also explicitly undef in CMake for some unknown reason.

Hopefully this one won't kill all the bots.

llvm-svn: 288977

7 years ago[RecursiveASTVisitor] Improve post-order traversal unit test
Malcolm Parsons [Wed, 7 Dec 2016 20:38:20 +0000 (20:38 +0000)]
[RecursiveASTVisitor] Improve post-order traversal unit test

llvm-svn: 288976

7 years agoFix Windows buildbots.
Rui Ueyama [Wed, 7 Dec 2016 20:31:46 +0000 (20:31 +0000)]
Fix Windows buildbots.

llvm-svn: 288975

7 years agoUse the correct MaxPageSize.
Rafael Espindola [Wed, 7 Dec 2016 20:29:46 +0000 (20:29 +0000)]
Use the correct MaxPageSize.

Now Target->MaxPageSize is only used as the default value of
Config->MaxPageSize.

llvm-svn: 288974

7 years agoDo not pass line number to convertToUnixPathSeparator.
Rui Ueyama [Wed, 7 Dec 2016 20:25:45 +0000 (20:25 +0000)]
Do not pass line number to convertToUnixPathSeparator.

Line number can never contain '/' or '\', so the previous code
was pointless at that point.

llvm-svn: 288973

7 years agoMake convertToUnixPathSeparator return a new string instead of mutating argument.
Rui Ueyama [Wed, 7 Dec 2016 20:22:27 +0000 (20:22 +0000)]
Make convertToUnixPathSeparator return a new string instead of mutating argument.

llvm-svn: 288972

7 years agoSimplify. NFC.
Rafael Espindola [Wed, 7 Dec 2016 20:20:39 +0000 (20:20 +0000)]
Simplify. NFC.

llvm-svn: 288971

7 years agoUse the correct MaxPageSize.
Rafael Espindola [Wed, 7 Dec 2016 20:10:43 +0000 (20:10 +0000)]
Use the correct MaxPageSize.

Found by inspection.

llvm-svn: 288970

7 years ago[change-namespace] always add a '::' prefix when a symbol reference needs to be fully...
Eric Liu [Wed, 7 Dec 2016 20:08:02 +0000 (20:08 +0000)]
[change-namespace] always add a '::' prefix when a symbol reference needs to be fully-qualified.

llvm-svn: 288969

7 years ago[GVNHoist] Invalidate MemDep when an instruction is moved.
Eli Friedman [Wed, 7 Dec 2016 19:55:59 +0000 (19:55 +0000)]
[GVNHoist] Invalidate MemDep when an instruction is moved.

See also r279907.

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

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

llvm-svn: 288968

7 years agoFormat. NFC.
George Rimar [Wed, 7 Dec 2016 19:44:27 +0000 (19:44 +0000)]
Format. NFC.

llvm-svn: 288967

7 years ago[ELF] - Print absolute file name in errors when possible.
George Rimar [Wed, 7 Dec 2016 19:42:25 +0000 (19:42 +0000)]
[ELF] - Print absolute file name in errors when possible.

Currently LLD prints basename of source file name in error messages,
for example:
$ mkdir foo
$ echo 'void _start(void) { foobar(); }' > foo/bar.c
$ gcc -g -c foo/bar.c
$ bin/ld.lld -o out bar.o
bin/ld.lld: error: bar.c:1: undefined symbol 'foobar'
$
This should say:
bin/ld.lld: error: foo/bar.c:1: undefined symbol 'foobar'

This is PR31299

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

llvm-svn: 288966

7 years ago[X86] Skip over DEBUG_VALUE while looking for start of call sequence
Michael Kuperstein [Wed, 7 Dec 2016 19:31:08 +0000 (19:31 +0000)]
[X86] Skip over DEBUG_VALUE while looking for start of call sequence

If we don't skip over DEBUG_VALUEs, we get differences between -g and non-g
code.

This fixes PR31242.

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

llvm-svn: 288965

7 years ago[X86] Do not assume "ri" instructions always have an immediate operand
Michael Kuperstein [Wed, 7 Dec 2016 19:29:18 +0000 (19:29 +0000)]
[X86] Do not assume "ri" instructions always have an immediate operand

The second operand of an "ri" instruction may be an immediate, but it may
also be a globalvariable, so we should make any assumptions.

This fixes PR31271.

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

llvm-svn: 288964

7 years agoFix the apple build issue caused by r288956
Chris Bieneman [Wed, 7 Dec 2016 19:28:22 +0000 (19:28 +0000)]
Fix the apple build issue caused by r288956

Should be checking if HAVE_CRASHREPORTERCLIENT_H is defined not relying on it having a value.

llvm-svn: 288963

7 years ago[CUDA] Improve target attribute checking for function templates.
Artem Belevich [Wed, 7 Dec 2016 19:27:16 +0000 (19:27 +0000)]
[CUDA] Improve target attribute checking for function templates.

* __host__ __device__ functions are no longer considered to be
  redeclarations of __host__ or __device__ functions. This prevents
  unintentional merging of target attributes across them.
* Function target attributes are not considered (and must match) during
  explicit instantiation and specialization of function templates.

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

llvm-svn: 288962

7 years agoRevert "[CMake] Use cmakedefine01 instead of cmakedefine"
Chris Bieneman [Wed, 7 Dec 2016 19:25:38 +0000 (19:25 +0000)]
Revert "[CMake] Use cmakedefine01 instead of cmakedefine"

This reverts commit r288959.

Apparently using cmakedefine01 explodes.

llvm-svn: 288961

7 years ago[builtin] Add Thumb1 implementation for idivsi3 and aeabi_idivmod
Weiming Zhao [Wed, 7 Dec 2016 19:14:29 +0000 (19:14 +0000)]
[builtin] Add Thumb1 implementation for idivsi3 and aeabi_idivmod

Summary:
For idivsi3, convert the Thumb2 only instruction to thumb1.
For aeabi_idivmod, using __divsi3.

Reviewers: rengolin, compnerd

Subscribers: llvm-commits

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

llvm-svn: 288960

7 years ago[CMake] Use cmakedefine01 instead of cmakedefine
Chris Bieneman [Wed, 7 Dec 2016 19:13:32 +0000 (19:13 +0000)]
[CMake] Use cmakedefine01 instead of cmakedefine

Looks like we need a 01 value for HAVE_CRASHREPORTERCLIENT_H.

llvm-svn: 288959

7 years ago[InstCombine] add tests for smin+icmp; NFC
Sanjay Patel [Wed, 7 Dec 2016 18:56:55 +0000 (18:56 +0000)]
[InstCombine] add tests for smin+icmp; NFC

The tests that already work are folded in InstSimplify, so those
tests should be redundant and we can remove them if they don't
seem worthwhile for completeness.

llvm-svn: 288957

7 years ago[CMake] Add a check for HAVE_CRASHREPORTERCLIENT_H
Chris Bieneman [Wed, 7 Dec 2016 18:53:04 +0000 (18:53 +0000)]
[CMake] Add a check for HAVE_CRASHREPORTERCLIENT_H

The CMake build has been hardcoding this to undef forever, we shouldn't have been doing that.

llvm-svn: 288956