platform/upstream/llvm.git
5 years ago[GlobalISel][LegalizerHelper] Add some missing MI change observer calls.
Amara Emerson [Wed, 30 Jan 2019 23:42:46 +0000 (23:42 +0000)]
[GlobalISel][LegalizerHelper] Add some missing MI change observer calls.

No test as it's a preventative fix.

llvm-svn: 352691

5 years ago[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn...
Julian Lettner [Wed, 30 Jan 2019 23:42:13 +0000 (23:42 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls

Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every unreachable instruction. However, the
optimizer will remove code after calls to functions marked with
noreturn. To avoid this UBSan removes noreturn from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
_asan_handle_no_return before noreturn functions. This is important for
functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* longjmp (longjmp itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the noreturn attributes are missing and ASan cannot
unpoison the stack, so it has false positives when stack unwinding is
used.

Changes:
Clang-CodeGen now directly insert calls to `__asan_handle_no_return`
when a call to a noreturn function is encountered and both
UBsan-unreachable and ASan are enabled. This allows UBSan to continue
removing the noreturn attribute from functions without any changes to
the ASan pass.

Previously generated code:
```
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

Generated code (for now):
```
  call void @__asan_handle_no_return
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

rdar://problem/40723397

Reviewers: delcypher, eugenis, vsk

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

llvm-svn: 352690

5 years ago[PowerPC] delete no more needed workaround for readsRegister() in PowerPC
Chen Zheng [Wed, 30 Jan 2019 23:18:38 +0000 (23:18 +0000)]
[PowerPC] delete no more needed workaround for readsRegister() in PowerPC
Differential Revision: https://reviews.llvm.org/D57439

llvm-svn: 352689

5 years ago[CMake] Use correct visibility for linked libraries in CMake
Petr Hosek [Wed, 30 Jan 2019 23:18:05 +0000 (23:18 +0000)]
[CMake] Use correct visibility for linked libraries in CMake

When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

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

llvm-svn: 352688

5 years ago[CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone
Erik Pilkington [Wed, 30 Jan 2019 23:17:38 +0000 (23:17 +0000)]
[CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone

objc_alloc and objc_allocWithZone may throw exceptions if the
underlying method does. If we're in a @try block, then make sure we
emit an invoke instead of a call.

rdar://47610407

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

llvm-svn: 352687

5 years agoMIR: Reject non-power-of-4 alignments in MMO parsing
Matt Arsenault [Wed, 30 Jan 2019 23:09:28 +0000 (23:09 +0000)]
MIR: Reject non-power-of-4 alignments in MMO parsing

llvm-svn: 352686

5 years ago[GlobalISel][AArch64] Select G_FABS
Jessica Paquette [Wed, 30 Jan 2019 22:54:21 +0000 (22:54 +0000)]
[GlobalISel][AArch64] Select G_FABS

This adds instruction selection support for G_FABS in AArch64. It also updates
the existing basic FP tests, adds a selection test for G_FABS.

https://reviews.llvm.org/D57418

llvm-svn: 352684

5 years ago[WebAssembly] MC: Use WritePatchableLEB helper function. NFC.
Sam Clegg [Wed, 30 Jan 2019 22:47:35 +0000 (22:47 +0000)]
[WebAssembly] MC: Use WritePatchableLEB helper function. NFC.

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 352683

5 years ago[WebAssembly] Restore stack pointer right after catch instruction
Heejin Ahn [Wed, 30 Jan 2019 22:44:45 +0000 (22:44 +0000)]
[WebAssembly] Restore stack pointer right after catch instruction

Summary:
After the staack is unwound due to a thrown exxception,
`__stack_pointer` global can point to an invalid address. So
a `global.set` to restore `__stack_pointer` should be inserted right
after `catch` instruction.

But after r352598 the `global.set` instruction is inserted not right
after `catch` but after `block` - `br-on-exn` - `end_block` -
`extract_exception` sequence. This CL fixes it.

While doing that, we can actually move ReplacePhysRegs pass after
LateEHPrepare and merge EHRestoreStackPointer pass into LateEHPrepare,
and now placing `global.set` to `__stack_pointer` right after `catch` is
much easier. Otherwise it is hard to guarantee that `global.set` is
still right after `catch` and not touched with other transformations, in
which case we have to do something to hoist it.

Reviewers: dschuff

Subscribers: mgorny, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 352681

5 years ago[DAGCombiner] sub X, 0/1 --> add X, 0/-1
Sanjay Patel [Wed, 30 Jan 2019 22:41:35 +0000 (22:41 +0000)]
[DAGCombiner] sub X, 0/1 --> add X, 0/-1

This extends the existing transform for:
add X, 0/1 --> sub X, 0/-1
...to allow the sibling subtraction fold.

This pattern could regress with the proposed change in D57401.

llvm-svn: 352680

5 years ago[AArch64][x86] add tests for add/sub signbits fold; NFC
Sanjay Patel [Wed, 30 Jan 2019 21:58:20 +0000 (21:58 +0000)]
[AArch64][x86] add tests for add/sub signbits fold; NFC

As discussed/shown in D57401, we are missing a fold for
subtract of 0/1 --> add 0/-1.

llvm-svn: 352678

5 years agoFix handling of CreateTemplateParameterList when there is an empty pack
Shafik Yaghmour [Wed, 30 Jan 2019 21:48:56 +0000 (21:48 +0000)]
Fix handling of CreateTemplateParameterList when there is an empty pack

Summary:
When we are creating a ClassTemplateSpecializationDecl in ParseTypeFromDWARF(...) we are not handling the case where variadic pack is empty in the specialization. This patch handles that case and adds a test to prevent future regressions.

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

llvm-svn: 352677

5 years ago[ASTDump] Inline traverse methods into class
Stephen Kelly [Wed, 30 Jan 2019 21:48:32 +0000 (21:48 +0000)]
[ASTDump] Inline traverse methods into class

This API will be extracted into a new template class.  This change will
make the follow-up commit easier to review.

llvm-svn: 352676

5 years ago[GlobalISel][AArch64] Add instruction selection support for @llvm.log2
Jessica Paquette [Wed, 30 Jan 2019 21:16:04 +0000 (21:16 +0000)]
[GlobalISel][AArch64] Add instruction selection support for @llvm.log2

This teaches GlobalISel to emit a RTLib call for @llvm.log2 when it encounters
it.

It updates the existing floating point tests to show that we don't fall back on
the intrinsic, and select the correct instructions. It also adds a legalizer
test for G_FLOG2.

https://reviews.llvm.org/D57357

llvm-svn: 352673

5 years agoDon't define __has_feature(objc_fixed_enum) in non-objc mode
Erik Pilkington [Wed, 30 Jan 2019 21:14:08 +0000 (21:14 +0000)]
Don't define __has_feature(objc_fixed_enum) in non-objc mode

This is only a formal language feature in ObjC, otherwise its just an
extension. Making this change was also an ABI break.

llvm-svn: 352672

5 years ago[GlobalISel][AArch64] Add instruction selection support for @llvm.sqrt
Jessica Paquette [Wed, 30 Jan 2019 21:03:52 +0000 (21:03 +0000)]
[GlobalISel][AArch64] Add instruction selection support for @llvm.sqrt

This teaches the legalizer about G_FSQRT in AArch64. Also adds a legalizer
test for G_FSQRT, a selection test for it, and updates existing floating point
tests.

https://reviews.llvm.org/D57361

llvm-svn: 352671

5 years ago[GlobalISel] Add IRTranslator support for @llvm.sqrt -> G_FSQRT
Jessica Paquette [Wed, 30 Jan 2019 20:58:14 +0000 (20:58 +0000)]
[GlobalISel] Add IRTranslator support for @llvm.sqrt -> G_FSQRT

Follow-up commit to https://reviews.llvm.org/D57359. (r352668)

This adds IRTranslator support for recognising a @llvm.sqrt intrinsic and
translating it into a G_FSQRT.

https://reviews.llvm.org/D57360

llvm-svn: 352670

5 years ago[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
Alexey Bataev [Wed, 30 Jan 2019 20:49:52 +0000 (20:49 +0000)]
[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
required.

Function __kmpc_push_target_tripcount should be emitted only if the
offloading entry is going to be emitted (for use in tgt_target...
functions). Otherwise, it should not be emitted.

llvm-svn: 352669

5 years ago[GlobalISel] Introduce a G_FSQRT generic instruction
Jessica Paquette [Wed, 30 Jan 2019 20:49:50 +0000 (20:49 +0000)]
[GlobalISel] Introduce a G_FSQRT generic instruction

This introduces a generic instruction for computing the floating point
square root of a value.

Right now, we can't select @llvm.sqrt, so this is working towards fixing that.

llvm-svn: 352668

5 years ago[LTO] Set CGOptLevel in LTO config.
Sam Clegg [Wed, 30 Jan 2019 20:46:18 +0000 (20:46 +0000)]
[LTO] Set CGOptLevel in LTO config.

Previously we were never setting this which means it was always being
set to Default (-O2/-Os).

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

llvm-svn: 352667

5 years agoReverting r352642 - Handle restore instructions in LiveDebugValues - as it's causing
Wolfgang Pieb [Wed, 30 Jan 2019 20:37:14 +0000 (20:37 +0000)]
Reverting r352642 - Handle restore instructions in LiveDebugValues - as it's causing
assertions on some buildbots.

llvm-svn: 352666

5 years agoAdd a new builtin: __builtin_dynamic_object_size
Erik Pilkington [Wed, 30 Jan 2019 20:34:53 +0000 (20:34 +0000)]
Add a new builtin: __builtin_dynamic_object_size

This builtin has the same UI as __builtin_object_size, but has the
potential to be evaluated dynamically. It is meant to be used as a
drop-in replacement for libraries that use __builtin_object_size when
a dynamic checking mode is enabled. For instance,
__builtin_object_size fails to provide any extra checking in the
following function:

  void f(size_t alloc) {
    char* p = malloc(alloc);
    strcpy(p, "foobar"); // expands to __builtin___strcpy_chk(p, "foobar", __builtin_object_size(p, 0))
  }

This is an overflow if alloc < 7, but because LLVM can't fold the
object size intrinsic statically, it folds __builtin_object_size to
-1. With __builtin_dynamic_object_size, alloc is passed through to
__builtin___strcpy_chk.

rdar://32212419

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

llvm-svn: 352665

5 years agoAdd a 'dynamic' parameter to the objectsize intrinsic
Erik Pilkington [Wed, 30 Jan 2019 20:34:35 +0000 (20:34 +0000)]
Add a 'dynamic' parameter to the objectsize intrinsic

This is meant to be used with clang's __builtin_dynamic_object_size.
When 'true' is passed to this parameter, the intrinsic has the
potential to be folded into instructions that will be evaluated
at run time. When 'false', the objectsize intrinsic behaviour is
unchanged.

rdar://32212419

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

llvm-svn: 352664

5 years ago[ASTDump] Make method definition order matches declaration order
Stephen Kelly [Wed, 30 Jan 2019 20:06:52 +0000 (20:06 +0000)]
[ASTDump] Make method definition order matches declaration order

This will make follow-up changes easier to review.

llvm-svn: 352663

5 years ago[Tests] Add tests for propagation of undef elements in vector GEPs
Philip Reames [Wed, 30 Jan 2019 20:06:24 +0000 (20:06 +0000)]
[Tests] Add tests for propagation of undef elements in vector GEPs

llvm-svn: 352662

5 years ago[ASTDump] Re-arrange method declarations to group Visit together
Stephen Kelly [Wed, 30 Jan 2019 20:03:47 +0000 (20:03 +0000)]
[ASTDump] Re-arrange method declarations to group Visit together

This will make follow-up commits easier to review.

llvm-svn: 352661

5 years ago[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7.
Craig Topper [Wed, 30 Jan 2019 19:57:01 +0000 (19:57 +0000)]
[X86] Mark EMMS and FEMMS as clobbering MM0-7 and ST0-7.

This fixes the test case in PR35982 by preventing MMX instructions that read MM0-7 from being moved below EMMS/FEMMS by the post RA scheduler.

Though as discussed in bugzilla, this is not a complete fix. There is still the possibility of reordering in IR or by the pre-RA scheduler.

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

llvm-svn: 352660

5 years agogn build: Set executable bit on get.py
Nico Weber [Wed, 30 Jan 2019 19:53:58 +0000 (19:53 +0000)]
gn build: Set executable bit on get.py

llvm-svn: 352659

5 years agoRevert "[CMake] Use correct visibility for linked libraries in CMake"
Petr Hosek [Wed, 30 Jan 2019 19:51:18 +0000 (19:51 +0000)]
Revert "[CMake] Use correct visibility for linked libraries in CMake"

This reverts commit r352654: this broke libcxx and sanitizer bots.

llvm-svn: 352658

5 years ago[ASTDump] Rename methods which are conceptually Visits
Stephen Kelly [Wed, 30 Jan 2019 19:49:49 +0000 (19:49 +0000)]
[ASTDump] Rename methods which are conceptually Visits

This is consistent with the TextNodeDumper, and is the appropriate name
for the traverser class which will be extracted.

llvm-svn: 352657

5 years ago[ASTDump] NFC: Inline vestigial methods
Stephen Kelly [Wed, 30 Jan 2019 19:41:04 +0000 (19:41 +0000)]
[ASTDump] NFC: Inline vestigial methods

This was a porting aid.

llvm-svn: 352656

5 years ago[ASTDump] Move Decl node dumping to TextNodeDumper
Stephen Kelly [Wed, 30 Jan 2019 19:32:48 +0000 (19:32 +0000)]
[ASTDump] Move Decl node dumping to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: jfb, cfe-commits

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

llvm-svn: 352655

5 years ago[CMake] Use correct visibility for linked libraries in CMake
Petr Hosek [Wed, 30 Jan 2019 19:27:26 +0000 (19:27 +0000)]
[CMake] Use correct visibility for linked libraries in CMake

When linking library dependencies, we shouldn't need to export linked
libraries to dependents. We should be explicit about this in
target_link_libraries, otherwise other targets that depend on these such
as sanitizers get repeated (and possibly even conflicting) dependencies.

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

llvm-svn: 352654

5 years agoSimplifyDemandedVectorElts for all intrinsics
Philip Reames [Wed, 30 Jan 2019 19:21:11 +0000 (19:21 +0000)]
SimplifyDemandedVectorElts for all intrinsics

The point is that this simplifies integration of new intrinsics into SimplifiedDemandedVectorElts, and ensures we don't miss any existing ones.

This is intended to be NFC-ish, but as seen from the diffs, can produce slightly different output.  This is due to order of transforms w/in instcombine resulting in two slightly different fixed points.  That's something we should fix, but isn't a problem w/this patch per se.

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

llvm-svn: 352653

5 years agoThe test comitted with r348896 needed -march=x86=64 on the llc command line.
Wolfgang Pieb [Wed, 30 Jan 2019 19:15:43 +0000 (19:15 +0000)]
The test comitted with r348896 needed -march=x86=64 on the llc command line.

llvm-svn: 352651

5 years agoRevert "gn build: Add BPF target."
Yonghong Song [Wed, 30 Jan 2019 19:13:16 +0000 (19:13 +0000)]
Revert "gn build: Add BPF target."

This reverts commit r352638.

The change in this patch is not trivial and it is merged
without component owner approval.

llvm-svn: 352649

5 years ago[libc++] Explicitly initialize std::nothrow
Thomas Anderson [Wed, 30 Jan 2019 19:09:41 +0000 (19:09 +0000)]
[libc++] Explicitly initialize std::nothrow

When building on Windows without libc++abi, this change fixes a build error of the form:

    src/new.cpp(38,17):  error: chosen constructor is explicit in copy-initialization
    const nothrow_t nothrow = {};
    include/vcruntime_new.h(53,22):  note: explicit constructor declared here
                explicit nothrow_t() = default;

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

llvm-svn: 352648

5 years ago[libc++] Don't define operator new/delete when using vcruntime
Thomas Anderson [Wed, 30 Jan 2019 19:08:32 +0000 (19:08 +0000)]
[libc++] Don't define operator new/delete when using vcruntime

Fixes build errors on Windows without libc++abi of the form:

    new(173,36):  error: redeclaration of 'operator delete' cannot add 'dllexport' attribute
    _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p) _NOEXCEPT;
    vcruntime_new.h(87,16):  note: previous declaration is here
    void __CRTDECL operator delete(
    new(205,70):  error: redefinition of 'operator new'
    _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new  (std::size_t, void* __p) _NOEXCEPT {return __p;}
    vcruntime_new.h(184,28):  note: previous definition is here
        inline void* __CRTDECL operator new(size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept
    new(206,70):  error: redefinition of 'operator new[]'
    _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
    vcruntime_new.h(199,28):  note: previous definition is here
        inline void* __CRTDECL operator new[](size_t _Size,
    new(207,40):  error: redefinition of 'operator delete'
    inline _LIBCPP_INLINE_VISIBILITY void  operator delete  (void*, void*) _NOEXCEPT {}
    vcruntime_new.h(190,27):  note: previous definition is here
        inline void __CRTDECL operator delete(void*, void*) noexcept
    new(208,40):  error: redefinition of 'operator delete[]'
    inline _LIBCPP_INLINE_VISIBILITY void  operator delete[](void*, void*) _NOEXCEPT {}
    vcruntime_new.h(206,27):  note: previous definition is here
        inline void __CRTDECL operator delete[](void*, void*) noexcept

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

llvm-svn: 352647

5 years ago[libc++] Don't define exception destructors when using vcruntime
Thomas Anderson [Wed, 30 Jan 2019 19:07:30 +0000 (19:07 +0000)]
[libc++] Don't define exception destructors when using vcruntime

Exception destructors are provided by vcruntime.  Fixes link errors like:

    lld-link: error: duplicate symbol: "public: virtual __cdecl std::invalid_argument::~invalid_argument(void)" (??1invalid_argument@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::length_error::~length_error(void)" (??1length_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::out_of_range::~out_of_range(void)" (??1out_of_range@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)
    lld-link: error: duplicate symbol: "public: virtual __cdecl std::overflow_error::~overflow_error(void)" (??1overflow_error@std@@UEAA@XZ) in stdexcept.obj and in libcpmt.lib(xthrow.obj)

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

llvm-svn: 352646

5 years ago[WebAssembly] Fix crash with LTO + relocatable + undefined symbols
Sam Clegg [Wed, 30 Jan 2019 18:55:15 +0000 (18:55 +0000)]
[WebAssembly] Fix crash with LTO + relocatable + undefined symbols

Change the way we create the symbol table to be closer to how its done
on ELF.  Now the output symbol table matches the internal symtab order
and includes local and undefined symbols.

Fixes PR40204

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

llvm-svn: 352645

5 years agoAdd LLDB website and documentation in reStructuredText for Sphinx
Jonas Devlieghere [Wed, 30 Jan 2019 18:51:40 +0000 (18:51 +0000)]
Add LLDB website and documentation in reStructuredText for Sphinx

The current LLDB website is written in HTML which is hard to maintain.
We have quite a bit of HTML code checked in which can make it hard to
differentiate between documentation written by us and documentation
generated by a tool.

In line with the other LLVM projects, I propose generating the
documentation with Sphix. I think text/rst files provide a lower barrier
for new or casual contributors to fix or update.

This patch adds a copy of the LLDB website and documentation in
reStructuredText. It also adds a new ninja target `docs-lldb-html` when
-DLLVM_ENABLE_SPHINX:BOOL is enabled.

This is the first step in having the website and documentation being
generated from the repository, rather than having the output checked-in
under the www folder. During the hopefully short transition period,
please also update the reStructuredText files when modifying the
website.

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

llvm-svn: 352644

5 years ago[Scalar] Remove partially wrong and unused functions.
Davide Italiano [Wed, 30 Jan 2019 18:40:05 +0000 (18:40 +0000)]
[Scalar] Remove partially wrong and unused functions.

I originally thought about fixing them, but hey, nobody is
using them anyway.

llvm-svn: 352643

5 years ago[DEBUGINFO] Handle restore instructions in LiveDebugValues
Wolfgang Pieb [Wed, 30 Jan 2019 18:34:07 +0000 (18:34 +0000)]
[DEBUGINFO] Handle restore instructions in LiveDebugValues

The LiveDebugValues pass recognizes spills but not restores, which can
cause large gaps in location information for some variables, depending
on control flow. This patch make LiveDebugValues recognize restores and
generate appropriate DBG_VALUE instructions.

Reviewers: aprantl, NicolaPrica

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

llvm-svn: 352642

5 years ago[Scalar] Hoist a duplicated (and sometimes wrong) comment.
Davide Italiano [Wed, 30 Jan 2019 18:24:16 +0000 (18:24 +0000)]
[Scalar] Hoist a duplicated (and sometimes wrong) comment.

Pointed out by Zachary and Adrian.

llvm-svn: 352641

5 years ago[llvm-objcopy][NFC] More error propagation (linkToBuildIdDir)
Jordan Rupprecht [Wed, 30 Jan 2019 18:13:30 +0000 (18:13 +0000)]
[llvm-objcopy][NFC] More error propagation (linkToBuildIdDir)

llvm-svn: 352640

5 years ago[Scalar] Implement support for 512-bit values.
Davide Italiano [Wed, 30 Jan 2019 18:05:36 +0000 (18:05 +0000)]
[Scalar] Implement support for 512-bit values.

(useful, e.g. when reading 512-bits registers, a-la AVX-512).

<rdar://problem/46886288>

llvm-svn: 352639

5 years agogn build: Add BPF target.
Peter Collingbourne [Wed, 30 Jan 2019 18:04:08 +0000 (18:04 +0000)]
gn build: Add BPF target.

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

llvm-svn: 352638

5 years agoGlobalISel: Add simpler way of always specifying custom lowering
Matt Arsenault [Wed, 30 Jan 2019 17:52:25 +0000 (17:52 +0000)]
GlobalISel: Add simpler way of always specifying custom lowering

llvm-svn: 352637

5 years agoGlobalISel: Add assert that legalize mutation makes sense
Matt Arsenault [Wed, 30 Jan 2019 17:52:23 +0000 (17:52 +0000)]
GlobalISel: Add assert that legalize mutation makes sense

I've repeatedly encountered bugs resulting from custom legalize
mutations returning nonsense legalize results, such as increasing the
number of elements for FewerElements. Add an assert function to make
sure the type to mutate to is consistent with the legalize action.

llvm-svn: 352636

5 years agoAMDGPU: Stop generating unused intrinsic .inc files
Matt Arsenault [Wed, 30 Jan 2019 17:25:37 +0000 (17:25 +0000)]
AMDGPU: Stop generating unused intrinsic .inc files

llvm-svn: 352635

5 years ago[X86][AVX] Prefer to combine shuffle to broadcasts whenever possible
Simon Pilgrim [Wed, 30 Jan 2019 16:19:19 +0000 (16:19 +0000)]
[X86][AVX] Prefer to combine shuffle to broadcasts whenever possible

This is the first step towards improving broadcast support on AVX1 targets.

llvm-svn: 352634

5 years ago[utils] Fix update scripts output when run on python3.
Simon Pilgrim [Wed, 30 Jan 2019 16:15:59 +0000 (16:15 +0000)]
[utils] Fix update scripts output when run on python3.

This fixes a "bytes-like object is required, not 'str'" python3 error I hit on update_llc_test_checks.py (but present on the other scripts as well) by matching what update_mca_test_checks.py already does, plus I've added an explicit 'utf-8' encoding.

llvm-svn: 352633

5 years ago[llvm-exegesis] Add throughput mode.
Clement Courbet [Wed, 30 Jan 2019 16:02:20 +0000 (16:02 +0000)]
[llvm-exegesis] Add throughput mode.

Summary:
This just uses the latency benchmark runner on the parallel uops snippet
generator.

Fixes PR37698.

Reviewers: gchatelet

Subscribers: tschuett, RKSimon, llvm-commits

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

llvm-svn: 352632

5 years ago[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
Roman Lebedev [Wed, 30 Jan 2019 15:41:20 +0000 (15:41 +0000)]
[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

Summary:
Was trying to understand how complicated it would be to write
a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.

Just so it happens, all the data is already there,
it is just conveniently omitted from AST dump.

Reviewers: aaron.ballman, steveire, ABataev

Reviewed By: ABataev

Subscribers: ABataev, guansong, cfe-commits

Tags: #openmp, #clang

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

llvm-svn: 352631

5 years ago[llvm-readobj] - Few minor cleanups. NFC.
George Rimar [Wed, 30 Jan 2019 15:39:05 +0000 (15:39 +0000)]
[llvm-readobj] - Few minor cleanups. NFC.

Minor code simplifications, relocations,
renamings (to match LLVM style).

llvm-svn: 352630

5 years ago[CMake] Accept entitlements for code signing in add_lldb_library()
Stefan Granitz [Wed, 30 Jan 2019 15:13:16 +0000 (15:13 +0000)]
[CMake] Accept entitlements for code signing in add_lldb_library()

Summary:
D57334 added entitlements support in `add_llvm_library()` so we can use it for library targets in LLDB.

Additionally this patch fixes the way that the entitlements argument is passed on from `add_lldb_executable()` to `add_llvm_executable()`. We still need the explicit parsing and passing on of single- and multi-value arguments as long as we are on CMake < 3.7 (due to bug https://gitlab.kitware.com/cmake/cmake/merge_requests/133).

Reviewers: beanz, JDevlieghere, aprantl

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

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

llvm-svn: 352629

5 years ago[CMake] Accept ENTITLEMENTS in llvm_add_library()
Stefan Granitz [Wed, 30 Jan 2019 15:10:08 +0000 (15:10 +0000)]
[CMake] Accept ENTITLEMENTS in llvm_add_library()

Summary: We added support for code signing entitlements in add_llvm_executable() with D54443. In the future it would be useful to have this functionality available also for libraries.

Reviewers: beanz, bogner

Reviewed By: bogner

Subscribers: mgorny, llvm-commits, lldb-commits, #lldb

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

llvm-svn: 352628

5 years ago[InstCombine][x86] add tests for addcarry intrinsic; NFC
Sanjay Patel [Wed, 30 Jan 2019 15:07:49 +0000 (15:07 +0000)]
[InstCombine][x86] add tests for addcarry intrinsic; NFC

llvm-svn: 352627

5 years ago[llvm-objcopy] Support -X|--discard-locals.
Jordan Rupprecht [Wed, 30 Jan 2019 14:58:13 +0000 (14:58 +0000)]
[llvm-objcopy] Support -X|--discard-locals.

Summary:
This adds support for the --discard-locals flag, which acts similarly to --discard-all, except it only applies to compiler-generated symbols (i.e. symbols starting with `.L` in ELF).

I am not sure about COFF local symbols: those appear to also use `.L` in most cases, but also use just `L` in other cases, so for now I am just leaving it unimplemented there.

Fixes PR36160

Reviewers: jhenderson, alexshap, jakehehrlich, mstorsjo, espindola

Reviewed By: jhenderson

Subscribers: llvm-commits, emaste, arichardson

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

llvm-svn: 352626

5 years ago[llvm-objcopy][NFC] More error propagation
Jordan Rupprecht [Wed, 30 Jan 2019 14:36:53 +0000 (14:36 +0000)]
[llvm-objcopy][NFC] More error propagation

Summary: Do some more error cleanup, removing some dependencies from llvm-objcopy's error/reportError in [ELF/COFF]Objcopy methods.

Reviewers: jhenderson, alexshap, jakehehrlich, mstorsjo, espindola

Subscribers: emaste, arichardson

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

llvm-svn: 352625

5 years ago[clangd] Drop fixes if replying with tweaks resulted in an error
Ilya Biryukov [Wed, 30 Jan 2019 14:24:17 +0000 (14:24 +0000)]
[clangd] Drop fixes if replying with tweaks resulted in an error

This should not happen in normal operation, as it implies that the diagnostics
with some available fixes were produced but the AST is invalid.
Moreover, the code had an error: always returned code actions ignoring the
SupportsCodeAction capability and writing a test for this is impossible,
since this can only happen due to programmer's error rather than invalid inputs.

llvm-svn: 352624

5 years ago[llvm-readobj] - Simplify the code.
George Rimar [Wed, 30 Jan 2019 14:08:55 +0000 (14:08 +0000)]
[llvm-readobj] - Simplify the code.

We have a Field struct which has a StringRef member Str.

The code needs to create and keep alive the temporarily
std::string variables because of that.
That is not convenient and makes the code be more complicated
than it could be.

There seems to be no reason to keep Str be StringRef.
The patch changes it to be std::string and
rearranges the code around slightly.

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

llvm-svn: 352623

5 years ago[clang-format] Fix line parsing for noexcept lambdas
Ben Hamilton [Wed, 30 Jan 2019 13:54:32 +0000 (13:54 +0000)]
[clang-format] Fix line parsing for noexcept lambdas

Summary:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |clang-format

```
int c = [b]() mutable noexcept {
  return [&b] { return b++; }();
}
();
```
with patch:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |bin/clang-format
```
int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();
```

Contributed by hultman.

Reviewers: benhamilton, jolesiak, klimek, Wizard

Reviewed By: benhamilton

Subscribers: cfe-commits

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

llvm-svn: 352622

5 years agoProperly use DT.verify in LoopSimplifyCFG
Max Kazantsev [Wed, 30 Jan 2019 12:32:19 +0000 (12:32 +0000)]
Properly use DT.verify in LoopSimplifyCFG

llvm-svn: 352621

5 years ago[HIP] Fix size_t for MSVC environment
Yaxun Liu [Wed, 30 Jan 2019 12:26:54 +0000 (12:26 +0000)]
[HIP] Fix size_t for MSVC environment

In 64 bit MSVC environment size_t is defined as unsigned long long.
In single source language like HIP, data layout should be consistent
in device and host compilation, therefore copy data layout controlling
fields from Aux target for AMDGPU target.

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

llvm-svn: 352620

5 years agoEnable IRCE for narrow latch by defailt
Max Kazantsev [Wed, 30 Jan 2019 11:25:12 +0000 (11:25 +0000)]
Enable IRCE for narrow latch by defailt

llvm-svn: 352619

5 years ago[OpenGL] Fix test on PPC after r352540
Eric Liu [Wed, 30 Jan 2019 11:24:04 +0000 (11:24 +0000)]
[OpenGL] Fix test on PPC after r352540

Summary:
Specify -triple like test/SemaOpenCL/logical-ops.cl. Otherwise, this test fails
on PPC.

Reviewers: bkramer

Subscribers: Anastasia, cfe-commits

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

llvm-svn: 352618

5 years ago[OpenCL] Add generic addr space to the return of implicit assignment.
Anastasia Stulova [Wed, 30 Jan 2019 11:18:08 +0000 (11:18 +0000)]
[OpenCL] Add generic addr space to the return of implicit assignment.

When creating the prototype of implicit assignment operators the
returned reference to the class should be qualified with the same
addr space as 'this' (i.e. __generic in OpenCL).

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

llvm-svn: 352617

5 years ago[RISCV] Insert R_RISCV_ALIGN relocation type and Nops for code alignment when linker...
Shiva Chen [Wed, 30 Jan 2019 11:16:59 +0000 (11:16 +0000)]
[RISCV] Insert R_RISCV_ALIGN relocation type and Nops for code alignment when linker relaxation enabled

Linker relaxation may change code size. We need to fix up the alignment
of alignment directive in text section by inserting Nops and R_RISCV_ALIGN
relocation type. So then linker could satisfy the alignment by removing Nops.

To do this:

1. Add shouldInsertExtraNopBytesForCodeAlign target hook to calculate
   the Nops we need to insert.

2. Add shouldInsertFixupForCodeAlign target hook to insert
   R_RISCV_ALIGN fixup type.

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

llvm-svn: 352616

5 years ago[NativePDB] Fix access to both old & new fpo data entries from dbi stream
Aleksandr Urakov [Wed, 30 Jan 2019 10:40:45 +0000 (10:40 +0000)]
[NativePDB] Fix access to both old & new fpo data entries from dbi stream

Summary:
This patch fixes access to fpo streams in native pdb from DbiStream and makes
code consistent with DbiStreamBuilder.

Patch By: leonid.mashinskiy

Reviewers: zturner, aleksandr.urakov

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 352615

5 years agoAdd lit config file to skip tests if WebAssembly target is not available.
Douglas Yung [Wed, 30 Jan 2019 09:49:39 +0000 (09:49 +0000)]
Add lit config file to skip tests if WebAssembly target is not available.

llvm-svn: 352614

5 years agoCommit tests for changes in revision D41342
Dmitry Venikov [Wed, 30 Jan 2019 09:49:25 +0000 (09:49 +0000)]
Commit tests for changes in revision D41342

llvm-svn: 352613

5 years ago[clangd] Fix a use after move
Ilya Biryukov [Wed, 30 Jan 2019 09:39:01 +0000 (09:39 +0000)]
[clangd] Fix a use after move

Introduced in r352494.

llvm-svn: 352612

5 years ago[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime
Joachim Protze [Wed, 30 Jan 2019 08:41:06 +0000 (08:41 +0000)]
[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime

Redo after revert by hans. The wrong include in one test is fixed.

Make sure that OMPT is enabled in runtime entry points that access internals
of the runtime. Else, return an appropiate value indicating an error or that
the data is not available.

Patch provided by @sconvent

Reviewers: jlpeyton, omalyshe, hbae, Hahnfeld, joachim.protze

Reviewed By: joachim.protze

Tags: #openmp, #ompt

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

llvm-svn: 352611

5 years ago[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
Michal Gorny [Wed, 30 Jan 2019 08:20:24 +0000 (08:20 +0000)]
[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes

Append appropriate -rpath when using shared compiler-rt runtimes,
e.g. '-fsanitize=address -shared-libasan'.  There's already a similar
logic in CommonArgs.cpp but it uses non-standard arch-suffixed
installation directory while we want our driver to work with standard
installation paths.

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

llvm-svn: 352610

5 years ago[X86] Remove unnecessary code from the top of handleCompareFP in X86FloatingPoint...
Craig Topper [Wed, 30 Jan 2019 08:04:06 +0000 (08:04 +0000)]
[X86] Remove unnecessary code from the top of handleCompareFP in X86FloatingPoint.cpp.

There were checks to ensure some tables were sorted, but those tables aren't used by this function. The same tables are checked in the function that does use them. Maybe this was copy/pasted?

llvm-svn: 352609

5 years ago[X86] Remove a couple places where we unnecessarily pass 0 to the EmitPriority of...
Craig Topper [Wed, 30 Jan 2019 07:33:24 +0000 (07:33 +0000)]
[X86] Remove a couple places where we unnecessarily pass 0 to the EmitPriority of some FP instruction aliases. NFC

As far as I can tell we already won't emit these aliases due to an operand count check in the tablegen code. Removing these because I couldn't make sense of the inconsistency between fadd and fmul from reading the code.

I checked the AsmMatcher and AsmWriter files before and after this change and there were no differences.

llvm-svn: 352608

5 years ago[X86] Add FPSW as a Def on some FP instructions that were missing it.
Craig Topper [Wed, 30 Jan 2019 07:08:44 +0000 (07:08 +0000)]
[X86] Add FPSW as a Def on some FP instructions that were missing it.

llvm-svn: 352607

5 years agoRecognize FreeBSD specific BFD names in OUTPUT_FORMAT
Dimitry Andric [Wed, 30 Jan 2019 06:31:52 +0000 (06:31 +0000)]
Recognize FreeBSD specific BFD names in OUTPUT_FORMAT

Summary:
After rLLD344952 ("Add OUTPUT_FORMAT linker script directive support"),
using BFD names such as `elf64-x86-64-freebsd` the `OUTPUT_FORMAT`
linker script command does not work anymore, resulting in errors like:

```
ld: error: /home/dim/src/clang800-import/stand/efi/loader/arch/amd64/ldscript.amd64:2: unknown output format name: elf64-x86-64-freebsd
>>> OUTPUT_FORMAT("elf64-x86-64-freebsd", "elf64-x86-64-freebsd", "elf64-x86-64-freebsd")
>>>               ^
```

To fix this, recognize a `-freebsd` suffix in BFD names, and also set
`Configuration::OSABI` to `ELFOSABI_FREEBSD` for those cases.

Add and/or update several test cases to check for the correct results of
these new `OUTPUT_FORMAT` arguments.

Reviewers: ruiu, atanasyan, grimar, hokein, emaste, espindola

Reviewed By: ruiu

Subscribers: nemanjai, javed.absar, arichardson, krytarowski, kristof.beyls, kbarton, llvm-commits

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

llvm-svn: 352606

5 years ago[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)
Jonas Devlieghere [Wed, 30 Jan 2019 06:26:26 +0000 (06:26 +0000)]
[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)

Use the real_path implementation from llvm::sys::fs::real_path instead
of having a custom implementation in the ModuleDependencyCollector.

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

llvm-svn: 352605

5 years ago[libFuzzer] remove stale code, NFC
Kostya Serebryany [Wed, 30 Jan 2019 06:21:20 +0000 (06:21 +0000)]
[libFuzzer] remove stale code, NFC

llvm-svn: 352604

5 years ago[libFuzzer] refactor the handling of instrumentation counters so that they are groupe...
Kostya Serebryany [Wed, 30 Jan 2019 06:15:52 +0000 (06:15 +0000)]
[libFuzzer] refactor the handling of instrumentation counters so that they are grouped in regions one full page each. Needed for future optimization. NFC

llvm-svn: 352603

5 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Wed, 30 Jan 2019 05:26:31 +0000 (05:26 +0000)]
[NFC] fix trivial typos in comments

llvm-svn: 352602

5 years agoGlobalISel: Implement fewerElementsVector for select
Matt Arsenault [Wed, 30 Jan 2019 04:19:31 +0000 (04:19 +0000)]
GlobalISel: Implement fewerElementsVector for select

llvm-svn: 352601

5 years ago[IR] Use CallBase to simplify some code
Craig Topper [Wed, 30 Jan 2019 03:43:41 +0000 (03:43 +0000)]
[IR] Use CallBase to simplify some code

Summary:
This patch does the following to simplify the asm-goto patch

-Move isInlineAsm from CallInst to CallBase to share with CallBrInst in the asm-goto patch.
-Forward CallSite's data_operands_begin()/data_operands_end() to CallBase's implementation.
-Forward CallSite's getOperandBundlesAsDefs to CallBase.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: nickdesaulniers, llvm-commits

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

llvm-svn: 352600

5 years agoAMDGPU/GlobalISel: Fix clamping shifts with 16-bit insts
Matt Arsenault [Wed, 30 Jan 2019 03:36:25 +0000 (03:36 +0000)]
AMDGPU/GlobalISel: Fix clamping shifts with 16-bit insts

llvm-svn: 352599

5 years ago[WebAssembly] Exception handling: Switch to the new proposal
Heejin Ahn [Wed, 30 Jan 2019 03:21:57 +0000 (03:21 +0000)]
[WebAssembly] Exception handling: Switch to the new proposal

Summary:
This switches the EH implementation to the new proposal:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
(The previous proposal was
 https://github.com/WebAssembly/exception-handling/blob/master/proposals/old/Exceptions.md)

- Instruction changes
  - Now we have one single `catch` instruction that returns a except_ref
    value
  - `throw` now can take variable number of operations
  - `rethrow` does not have 'depth' argument anymore
  - `br_on_exn` queries an except_ref to see if it matches the tag and
    branches to the given label if true.
  - `extract_exception` is a pseudo instruction that simulates popping
    values from wasm stack. This is to make `br_on_exn`, a very special
    instruction, work: `br_on_exn` puts values onto the stack only if it
    is taken, and the # of values can vay depending on the tag.

- Now there's only one `catch` per `try`, this patch removes all special
  handling for terminate pad with a call to `__clang_call_terminate`.
  Before it was the only case there are two catch clauses (a normal
  `catch` and `catch_all` per `try`).

- Make `rethrow` act as a terminator like `throw`. This splits BB after
  `rethrow` in WasmEHPrepare, and deletes an unnecessary `unreachable`
  after `rethrow` in LateEHPrepare.

- Now we stop at all catchpads (because we add wasm `catch` instruction
  that catches all exceptions), this creates new
  `findWasmUnwindDestinations` function in SelectionDAGBuilder.

- Now we use `br_on_exn` instrution to figure out if an except_ref
  matches the current tag or not, LateEHPrepare generates this sequence
  for catch pads:
```
  catch
  block i32
  br_on_exn $__cpp_exception
  end_block
  extract_exception
```

- Branch analysis for `br_on_exn` in WebAssemblyInstrInfo

- Other various misc. changes to switch to the new proposal.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 352598

5 years agoGlobalISel: Use appropriate extension for legalizing select conditions
Matt Arsenault [Wed, 30 Jan 2019 02:57:43 +0000 (02:57 +0000)]
GlobalISel: Use appropriate extension for legalizing select conditions

llvm-svn: 352597

5 years ago[PowerPC] [NFC] Create a helper function to copy register to particular register...
Zi Xuan Wu [Wed, 30 Jan 2019 02:56:22 +0000 (02:56 +0000)]
[PowerPC] [NFC] Create a helper function to copy register to particular register class at PPCFastISel

Make copy register code as common function as following.

unsigned copyRegToRegClass(const TargetRegisterClass *ToRC, unsigned SrcReg, unsigned Flag = 0, unsigned SubReg = 0);

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

llvm-svn: 352596

5 years agoCleanup: replace uses of CallSite with CallBase.
James Y Knight [Wed, 30 Jan 2019 02:54:28 +0000 (02:54 +0000)]
Cleanup: replace uses of CallSite with CallBase.

llvm-svn: 352595

5 years agoGlobalISel: Support narrowScalar for uneven loads
Matt Arsenault [Wed, 30 Jan 2019 02:35:38 +0000 (02:35 +0000)]
GlobalISel: Support narrowScalar for uneven loads

llvm-svn: 352594

5 years agoSimplify and modernize this code a little.
Richard Smith [Wed, 30 Jan 2019 02:23:34 +0000 (02:23 +0000)]
Simplify and modernize this code a little.

No functionality change intended.

llvm-svn: 352593

5 years ago[WebAssembly] Optimize BUILD_VECTOR lowering for size
Thomas Lively [Wed, 30 Jan 2019 02:23:29 +0000 (02:23 +0000)]
[WebAssembly] Optimize BUILD_VECTOR lowering for size

Summary:
Implements custom lowering logic that finds the optimal value for the
initial splat of the vector and either uses it or uses v128.const if
it is available and if it would produce smaller code. This logic
replaces large TableGen ISEL patterns that would lower all non-splat
BUILD_VECTORs into a splat followed by a fixed number of replace_lane
instructions. This CL fixes PR39685.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 352592

5 years agoGlobalISel: Handle some odd splits in fewerElementsVector
Matt Arsenault [Wed, 30 Jan 2019 02:22:13 +0000 (02:22 +0000)]
GlobalISel: Handle some odd splits in fewerElementsVector

Also add some quick hacks to AMDGPU legality for the tests.

llvm-svn: 352591

5 years agolld/coff: Implement some support for the comdat selection field
Nico Weber [Wed, 30 Jan 2019 02:17:27 +0000 (02:17 +0000)]
lld/coff: Implement some support for the comdat selection field

LLD used to handle comdats as if the selection field was always set to
IMAGE_COMDAT_SELECT_ANY. This means for obj files produced by `cl /Gy`, LLD
would never report a duplicate symbol error.

This change:
- adds validation for the Selection field (should make no difference in
  practice for compiler-generated obj inputs)
- rejects comdats that have different Selection fields in different obj files
  (likewise). This is a bit more strict but also more self-consistent thank
  link.exe (see comment in code)
- implements handling for all the selection kinds

In practice, compilers only generate comdats with
IMAGE_COMDAT_SELECT_NODUPLICATES (LLD now produces duplicate symbol errors for
these), IMAGE_COMDAT_SELECT_ANY (no behavior change), and
IMAGE_COMDAT_SELECT_LARGEST (for RTTI data; here LLD should no longer create
broken executables when linking some TUs with RTTI enabled and some with it
disabled – but see below).

The implementation of `IMAGE_COMDAT_SELECT_LARGEST` is incomplete: If one
SELECT_LARGEST comdat replaces an earlier one, the comdat symbol is replaced
correctly, but the old section stays loaded and if /opt:ref is disabled (via
/opt:noref or /debug) it's still written to the output. That's not ideal, but
better than the current treatment of just picking any one of those comdats. I
hope to fix this better later.

Fixes most of PR40094.

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

llvm-svn: 352590

5 years agolld-link: Add test I forgot to add in 332012
Nico Weber [Wed, 30 Jan 2019 02:15:08 +0000 (02:15 +0000)]
lld-link: Add test I forgot to add in 332012

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

llvm-svn: 352589

5 years ago[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective...
George Karpenkov [Wed, 30 Jan 2019 02:11:04 +0000 (02:11 +0000)]
[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective-C methods

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

llvm-svn: 352588

5 years agoAdd enum values to CodeGenOpt::Level
Sam Clegg [Wed, 30 Jan 2019 02:08:34 +0000 (02:08 +0000)]
Add enum values to CodeGenOpt::Level

The absolute values of this enum are important at least in that
they get printed by SelectionDAGISel. e.g:
  `Before: -O2 ; After: -O0`

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

llvm-svn: 352587

5 years ago[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard
Petr Hosek [Wed, 30 Jan 2019 02:06:06 +0000 (02:06 +0000)]
[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard

Turned out this is used by Flutter which uses Fuchsia Clang toolchain.

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

llvm-svn: 352586

5 years agoGlobalISel: Handle more cases for widenScalar for G_STORE
Matt Arsenault [Wed, 30 Jan 2019 02:04:31 +0000 (02:04 +0000)]
GlobalISel: Handle more cases for widenScalar for G_STORE

llvm-svn: 352585