platform/upstream/llvm.git
6 years agoSet dso_local on external rtti GVs.
Rafael Espindola [Wed, 14 Mar 2018 18:14:46 +0000 (18:14 +0000)]
Set dso_local on external rtti GVs.

In this particular case it would be possible to just add an else with
CGM.setDSOLocal(GV), but it seems better to have as many callers as
possible just call setGVProperties so that we can centralize the logic
there.

This patch then makes setGVProperties able to handle null Decls.

llvm-svn: 327543

6 years agoError instead of producing broken binary.
Rafael Espindola [Wed, 14 Mar 2018 18:08:33 +0000 (18:08 +0000)]
Error instead of producing broken binary.

This "fixes" PR36678 by just producing an error when we find a case
where we would produce an plt entry that used ebx but ebx would not be
set.

llvm-svn: 327542

6 years ago[InstSimplify] [NFC] cast-unsigned-icmp-cmp-0.ll - don't run instcombine
Roman Lebedev [Wed, 14 Mar 2018 17:59:12 +0000 (17:59 +0000)]
[InstSimplify] [NFC] cast-unsigned-icmp-cmp-0.ll - don't run instcombine

As disscussed in post-commit review of D44421, there is simply
no reason to run instcombine on this testcase.

llvm-svn: 327541

6 years ago[X86] Add back fast-isel code for handling i8 shifts.
Craig Topper [Wed, 14 Mar 2018 17:57:19 +0000 (17:57 +0000)]
[X86] Add back fast-isel code for handling i8 shifts.

I removed this in r316797 because the coverage report showed no coverage and I thought it should have been handled by the auto generated table. I now see that there is code that bypasses the table if the shift amount is out of bounds.

This adds back the code. We'll codegen out of bounds i8 shifts to effectively (amount & 0x1f). The 0x1f is a strange quirk of x86 that shift amounts are always masked to 5-bits(except 64-bits). So if the masked value is still out bounds the result will be 0.

Fixes PR36731.

llvm-svn: 327540

6 years ago[clangd] Fix indentation in the comment. NFC
Ilya Biryukov [Wed, 14 Mar 2018 17:49:19 +0000 (17:49 +0000)]
[clangd] Fix indentation in the comment. NFC

llvm-svn: 327539

6 years agoFix LLVM IR check lines in utils/update_cc_test_checks.py
Fangrui Song [Wed, 14 Mar 2018 17:47:07 +0000 (17:47 +0000)]
Fix LLVM IR check lines in utils/update_cc_test_checks.py

Reviewers: arichardson

Subscribers: llvm-commits

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

llvm-svn: 327538

6 years ago[clangd] Don't expose vfs in TUScheduler::runWithPreamble.
Ilya Biryukov [Wed, 14 Mar 2018 17:46:52 +0000 (17:46 +0000)]
[clangd] Don't expose vfs in TUScheduler::runWithPreamble.

Summary:
It was previously an easy way to concurrently access a mutable vfs,
which is a recipe for disaster.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, jkorous-apple, cfe-commits, ioeric

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

llvm-svn: 327537

6 years agoReduce code duplication a bit.
Rafael Espindola [Wed, 14 Mar 2018 17:41:34 +0000 (17:41 +0000)]
Reduce code duplication a bit.

The code for computing the offset of an entry in the plt is simple,
but it was duplicated in quite a few places.

llvm-svn: 327536

6 years ago[InstSimplify] [NFC] Add tests for peeking through unsigned FP casts for sign compare...
Roman Lebedev [Wed, 14 Mar 2018 17:31:08 +0000 (17:31 +0000)]
[InstSimplify] [NFC] Add tests for peeking through unsigned FP casts for sign compares (PR36682)

Summary:
This pattern came up in PR36682 / D44390
https://bugs.llvm.org/show_bug.cgi?id=36682
https://reviews.llvm.org/D44390
https://godbolt.org/g/oKvT5H

Looking at the IR pattern in question, as per [[ https://github.com/rutgers-apl/alive-nj | alive-nj ]], for all the type combinations i checked
(input: `i16`, `i32`, `i64`; intermediate: `half`/`i16`, `float`/`i32`, `double`/`i64`)
for the following `icmp` comparisons the `uitofp`+`bitcast`+`icmp` can be evaluated to a boolean:
* `slt 0`
* `sgt -1`
I did not check vectors, but i'm guessing it's the same there.
{F5889242}

Thus all these cases are in the testcase (along with the vector variant with additional `undef` element in the middle).
There are no negative patterns here (unless alive-nj lied/is broken), all of these should be optimized.

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits

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

llvm-svn: 327535

6 years ago[InstCombine] [NFC] Add tests for peeking through unsigned FP casts for zero-equality...
Roman Lebedev [Wed, 14 Mar 2018 17:31:03 +0000 (17:31 +0000)]
[InstCombine] [NFC] Add tests for peeking through unsigned FP casts for zero-equality compares (PR36682)

Summary:
This pattern came up in PR36682 / D44390
https://bugs.llvm.org/show_bug.cgi?id=36682
https://reviews.llvm.org/D44390
https://godbolt.org/g/oKvT5H

Looking at the IR pattern in question, as per [[ https://github.com/rutgers-apl/alive-nj | alive-nj ]], for all the type combinations i checked
(input: `i16`, `i32`, `i64`; intermediate: `half`/`i16`, `float`/`i32`, `double`/`i64`)
for the following `icmp` comparisons the `uitofp`+`bitcast` can be dropped:
* `eq 0`
* `ne 0`
I did not check vectors, but i'm guessing it's the same there.
{F5889189}

Thus all these cases are in the testcase (along with the vector variant with additional `undef` element in the middle).
There are no negative patterns here (unless alive-nj lied/is broken), all of these should be optimized.

Generated with
{F5889196}

Reviewers: spatel, majnemer, efriedma, arsenm

Reviewed By: spatel

Subscribers: wdng, llvm-commits

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

llvm-svn: 327534

6 years ago[AArch64] Keep track of MIFlags in the LoadStoreOptimizer
Francis Visoiu Mistrih [Wed, 14 Mar 2018 17:10:58 +0000 (17:10 +0000)]
[AArch64] Keep track of MIFlags in the LoadStoreOptimizer

Merging:

* $x26, $x25 = frame-setup LDPXi $sp, 0
* $sp = frame-destroy ADDXri $sp, 64, 0

into an LDPXpost should preserve the flags from both instructions as
following:

* frame-setup frame-destroy LDPXpost

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

llvm-svn: 327533

6 years ago[clangd] Remove forceReparse, add a flag to addDocument instead
Ilya Biryukov [Wed, 14 Mar 2018 17:08:41 +0000 (17:08 +0000)]
[clangd] Remove forceReparse, add a flag to addDocument instead

Summary: To make the removal of DraftMgr from ClangdServer easier (D44408).

Reviewers: sammccall, simark

Reviewed By: sammccall, simark

Subscribers: simark, klimek, jkorous-apple, ioeric, cfe-commits

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

llvm-svn: 327532

6 years ago[CMake] Properly quote string arguments to quiet errors from r327528 when built
Frederich Munch [Wed, 14 Mar 2018 16:56:02 +0000 (16:56 +0000)]
[CMake] Properly quote string arguments to quiet errors from r327528 when built
with LLVM_ENABLE_EH and LLVM_ENABLE_RTTI.

llvm-svn: 327531

6 years ago[X86] Teach X86TargetLowering::targetShrinkDemandedConstant to set non-demanded bits...
Craig Topper [Wed, 14 Mar 2018 16:55:15 +0000 (16:55 +0000)]
[X86] Teach X86TargetLowering::targetShrinkDemandedConstant to set non-demanded bits if it helps created an and mask that can be matched as a zero extend.

I had to modify the bswap recognition to allow unshrunk masks to make this work.

Fixes PR36689.

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

llvm-svn: 327530

6 years agoAttempt to fix failure of deep-ast-tree.cpp on ppc64 and atom
Yaxun Liu [Wed, 14 Mar 2018 16:47:49 +0000 (16:47 +0000)]
Attempt to fix failure of deep-ast-tree.cpp on ppc64 and atom

llvm-svn: 327529

6 years agoExpand clang-interpreter with example of throwing in and from the JIT for Windows64.
Frederich Munch [Wed, 14 Mar 2018 16:04:45 +0000 (16:04 +0000)]
Expand clang-interpreter with example of throwing in and from the JIT for Windows64.

Summary:
Getting this to work is not particularly obvious, and having it as an example should be helpful.
Portions of this could be placed into LLVM, but as a whole it seems necessary to do this a higher level.

Reviewers: lhames, mehdi_amini

Reviewed By: lhames

Subscribers: mgrang, martell, cfe-commits, mgorny

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

llvm-svn: 327528

6 years ago[WebAssembly] Use DenseMapInfo traits from LLVM repo. NFC
Nicholas Wilson [Wed, 14 Mar 2018 15:58:16 +0000 (15:58 +0000)]
[WebAssembly] Use DenseMapInfo traits from LLVM repo. NFC

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

llvm-svn: 327527

6 years ago[WebAssembly] Add DenseMap traits and operator== for Wasm type structs
Nicholas Wilson [Wed, 14 Mar 2018 15:58:03 +0000 (15:58 +0000)]
[WebAssembly] Add DenseMap traits and operator== for Wasm type structs

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

llvm-svn: 327526

6 years ago[scudo] Add Chunk::getSize, rework Chunk::getUsableSize
Kostya Kortchinsky [Wed, 14 Mar 2018 15:50:32 +0000 (15:50 +0000)]
[scudo] Add Chunk::getSize, rework Chunk::getUsableSize

Summary:
Using `getActuallyAllocatedSize` from the Combined resulting in mediocre
compiled code, as the `ClassId != 0` predicament was not propagated there,
resulting in additional branches and dead code. Move the logic in the frontend,
which results in better compiled code. Also I think it makes it slightly easier
to distinguish between the size the user requested, and the size that was
actually allocated by the allocator.

`const` a couple of things as well.

This has no functional impact.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 327525

6 years ago[X86][AVX] Use WriteFShuffleLd for broadcast reg-mem instructions
Simon Pilgrim [Wed, 14 Mar 2018 15:47:08 +0000 (15:47 +0000)]
[X86][AVX] Use WriteFShuffleLd for broadcast reg-mem instructions

They shouldn't be treated as pure loads.

Found while investigating D44428

llvm-svn: 327524

6 years ago[WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFC
Nicholas Wilson [Wed, 14 Mar 2018 15:45:11 +0000 (15:45 +0000)]
[WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFC

This reduces the number of lookups to one per COMDAT group, rather than
one per symbol in a COMDAT group.

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

llvm-svn: 327523

6 years ago[WebAssembly] Identify COMDATs by index rather than string. NFC
Nicholas Wilson [Wed, 14 Mar 2018 15:44:45 +0000 (15:44 +0000)]
[WebAssembly] Identify COMDATs by index rather than string. NFC

This will enable an optimisation in LLD.

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

llvm-svn: 327522

6 years agoSjLjEHPrepare: Don't reg-to-mem swifterror values
Arnold Schwaighofer [Wed, 14 Mar 2018 15:44:07 +0000 (15:44 +0000)]
SjLjEHPrepare: Don't reg-to-mem swifterror values

swifterror llvm values model the swifterror register as memory at the
LLVM IR level. ISel will perform adhoc mem-to-reg on them. swifterror
values are constraint in how they can be used. Spilling them to memory
is not allowed.

SjLjEHPrepare tried to lower swifterror values to memory which is
unecessary since the back-end will spill and reload the register as
neccessary (as long as clobbering calls are marked as such which is the
case here) and further leads to invalid IR because swifterror values
can't be stored to memory.

rdar://38164004

llvm-svn: 327521

6 years ago[GlobalIsel][X86] Support for G_SDIV instruction
Alexander Ivchenko [Wed, 14 Mar 2018 15:41:11 +0000 (15:41 +0000)]
[GlobalIsel][X86] Support for G_SDIV instruction

Reviewed By: igorb

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

llvm-svn: 327520

6 years ago[dotest] Rename llvm-dotest -> lldb-dotest and make it a custom target
Jonas Devlieghere [Wed, 14 Mar 2018 15:36:32 +0000 (15:36 +0000)]
[dotest] Rename llvm-dotest -> lldb-dotest and make it a custom target

This renames llvm-dotest to lldb-dotest and makes it a custom target so
you can run `ninja lldb-dotest` to rebuild whatever is necessary before
rerunning the tests.

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

llvm-svn: 327519

6 years ago[CodeGen] allow printing of zero latency in sched comments
Sanjay Patel [Wed, 14 Mar 2018 15:28:48 +0000 (15:28 +0000)]
[CodeGen] allow printing of zero latency in sched comments

I don't know how to expose this in a test. There are ARM / AArch64
sched classes that include zero latency instructions, but I'm not
seeing sched info printed for those targets. X86 will almost
certainly have these soon (see PR36671), but no model has
'let Latency = 0' currently.

llvm-svn: 327518

6 years ago[llvm-mca] Remove unused variable from InstrBuilder.cpp. NFC
Andrea Di Biagio [Wed, 14 Mar 2018 15:19:47 +0000 (15:19 +0000)]
[llvm-mca] Remove unused variable from InstrBuilder.cpp. NFC

This was causing a buildbot failure.

llvm-svn: 327517

6 years agoAdd deep AST tree test for r327515
Yaxun Liu [Wed, 14 Mar 2018 15:03:31 +0000 (15:03 +0000)]
Add deep AST tree test for r327515

llvm-svn: 327516

6 years agoCodeGen: Reduce LValue and CallArgList memory footprint before recommitting r326946
Yaxun Liu [Wed, 14 Mar 2018 15:02:28 +0000 (15:02 +0000)]
CodeGen: Reduce LValue and CallArgList memory footprint before recommitting r326946

Recent change r326946 (https://reviews.llvm.org/D34367) causes regression in Eigen due to increased
memory footprint of CallArg.

This patch reduces LValue size from 112 to 96 bytes and reduces inline argument count of CallArgList
from 16 to 8.

It has been verified that this will let the added deep AST tree test pass with r326946.

In the long run, CallArg or LValue memory footprint should be further optimized.

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

llvm-svn: 327515

6 years ago[llvm-mca] Move the logic that updates the register files from InstrBuilder to Dispat...
Andrea Di Biagio [Wed, 14 Mar 2018 14:57:23 +0000 (14:57 +0000)]
[llvm-mca] Move the logic that updates the register files from InstrBuilder to DispatchUnit. NFCI

Before this patch, the register file was always updated at instruction creation
time. That means, new read-after-write dependencies, and new temporary registers
were allocated at instruction creation time.

This patch refactors the code in InstrBuilder, and move all the logic that
updates the register file into the dispatch unit. We only want to update the
register file when instructions are effectively dispatched (not before).

This refactoring also helps removing a bad dependency between the InstrBuilder
and the DispatchUnit.

No functional change intended.

llvm-svn: 327514

6 years ago[OpenMP] Add OpenMP data sharing infrastructure using global memory
Gheorghe-Teodor Bercea [Wed, 14 Mar 2018 14:17:45 +0000 (14:17 +0000)]
[OpenMP] Add OpenMP data sharing infrastructure using global memory

Summary:
This patch handles the Clang code generation phase for the OpenMP data sharing infrastructure.

TODO: add a more detailed description.

Reviewers: ABataev, carlo.bertolli, caomhin, hfinkel, Hahnfeld

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 327513

6 years ago[test] Disable TestMachCore everywhere except on Darwin
Jonas Devlieghere [Wed, 14 Mar 2018 14:16:23 +0000 (14:16 +0000)]
[test] Disable TestMachCore everywhere except on Darwin

Apparently the parser is wrapped inside ifdef's so the logic isn't
available on non-Darwin platforms.

Should fix build bot failure:
  http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463

llvm-svn: 327512

6 years ago[mips] Add support for CRC ASE
Petar Jovanovic [Wed, 14 Mar 2018 14:13:31 +0000 (14:13 +0000)]
[mips] Add support for CRC ASE

This includes

  Instructions: crc32b, crc32h, crc32w, crc32d,
                crc32cb, crc32ch, crc32cw, crc32cd

  Assembler directives: .set crc, .set nocrc, .module crc, .module nocrc

  Attribute: crc

  .MIPS.abiflags: CRC (0x8000)

Patch by Vladimir Stefanovic.

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

llvm-svn: 327511

6 years ago[X86][Btver2] Fix YMM shuffle, permute and permutevar scheduler costs
Simon Pilgrim [Wed, 14 Mar 2018 14:05:19 +0000 (14:05 +0000)]
[X86][Btver2] Fix YMM shuffle, permute and permutevar scheduler costs

Account for ymm double pumping and add proper pshufb/permutevar support

llvm-svn: 327510

6 years ago[LTO/gold] Fix workaround for old plugin-api.h in --wrap support
Teresa Johnson [Wed, 14 Mar 2018 14:00:57 +0000 (14:00 +0000)]
[LTO/gold] Fix workaround for old plugin-api.h in --wrap support

The workaround for older plugin-api.h in r327506 unfortunately
used another union member that is also fairly new and not available
in the plugin-api.h on some of the bots, leading to:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/9121/steps/build-stage2-LLVMgold.so/logs/stdio

Change to use a different member that we will definitely have (as it
is used elsewhere in gold-plugin.cpp already).

llvm-svn: 327509

6 years ago[WebAssembly] Add missing implementation for --initial/max-memory args
Nicholas Wilson [Wed, 14 Mar 2018 13:53:58 +0000 (13:53 +0000)]
[WebAssembly] Add missing implementation for --initial/max-memory args

Previously, Config->InitialMemory/MaxMemory were hooked up to some
commandline args but had no effect at all.

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

llvm-svn: 327508

6 years ago[WebAssembly] Replace varargs debugPrint with standard log call
Nicholas Wilson [Wed, 14 Mar 2018 13:50:20 +0000 (13:50 +0000)]
[WebAssembly] Replace varargs debugPrint with standard log call

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

llvm-svn: 327507

6 years ago[LTO/gold] Support --wrap
Teresa Johnson [Wed, 14 Mar 2018 13:26:18 +0000 (13:26 +0000)]
[LTO/gold] Support --wrap

Summary:
(Restores r327459 with handling for old plugin-api.h)
Utilize new gold plugin api interface for obtaining --wrap option
arguments, and LTO API handling (added for --wrap support in lld LTO),
to mark symbols so that LTO does not optimize them inappropriately.

Note the test cases will be in a new gold test subdirectory that
is dependent on the next release of gold which will contain the new
interfaces.

Reviewers: pcc, tmsriram

Subscribers: mehdi_amini, llvm-commits, inglorion

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

llvm-svn: 327506

6 years ago[X86][SSE] Use WriteFShuffleLd for MOVDDUP/MOVSHDUP/MOVSLDUP reg-mem instructions
Simon Pilgrim [Wed, 14 Mar 2018 13:22:56 +0000 (13:22 +0000)]
[X86][SSE] Use WriteFShuffleLd for MOVDDUP/MOVSHDUP/MOVSLDUP reg-mem instructions

They shouldn't be treated as pure loads.

Found while investigating D44428

llvm-svn: 327505

6 years ago[Sema] Pop function scope when instantiating a func with skipped body
Ilya Biryukov [Wed, 14 Mar 2018 13:18:30 +0000 (13:18 +0000)]
[Sema] Pop function scope when instantiating a func with skipped body

Summary:
By calling ActOnFinishFunctionBody(). Previously we were only calling
ActOnSkippedFunctionBody, which didn't pop the function scope.
This causes a crash when running on our internal code. No test-case,
though, since I couldn't come up with a small example in reasonable
time.

The bug was introduced in r321174.

Reviewers: bkramer, sammccall, sepavloff, aaron.ballman

Reviewed By: sammccall, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 327504

6 years ago[AArch64] Don't produce R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC
Martin Storsjo [Wed, 14 Mar 2018 13:09:10 +0000 (13:09 +0000)]
[AArch64] Don't produce R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC

Support for this relocation is missing in both LLD and GNU binutils
at the moment.

This reverts the ELF parts of SVN r327316.

llvm-svn: 327503

6 years agoFix 'not all control paths return a value' MSVC warning. NFCI.
Simon Pilgrim [Wed, 14 Mar 2018 12:04:51 +0000 (12:04 +0000)]
Fix 'not all control paths return a value' MSVC warning. NFCI.

llvm-svn: 327502

6 years agoUpdate selected thread after loading mach core
Jonas Devlieghere [Wed, 14 Mar 2018 11:50:10 +0000 (11:50 +0000)]
Update selected thread after loading mach core

The OS plugins might have updated the thread list after a core file has
been loaded. The physical thread in the core file may no longer be the
one that should be selected. Hence we should run the thread selection
logic after loading the core.

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

llvm-svn: 327501

6 years agoFix msvc compiler error in r327498
Pavel Labath [Wed, 14 Mar 2018 11:31:17 +0000 (11:31 +0000)]
Fix msvc compiler error in r327498

msvc reports an "illegal indirection" error here. Attempt to appease it
with a different initialization syntax.

llvm-svn: 327500

6 years ago[GlobalISel][X86] Support G_LSHR/G_ASHR/G_SHL
Alexander Ivchenko [Wed, 14 Mar 2018 11:23:57 +0000 (11:23 +0000)]
[GlobalISel][X86] Support G_LSHR/G_ASHR/G_SHL

Support G_LSHR/G_ASHR/G_SHL. We have 3 variance for
shift instructions : shift gpr, shift imm, shift 1.
Currently GlobalIsel TableGen generate patterns for
shift imm and shift 1, but with shiftCount i8.
In G_LSHR/G_ASHR/G_SHL like LLVM-IR both arguments
has the same type, so for now only shift i8 can use
auto generated TableGen patterns.

The support of G_SHL/G_ASHR enables tryCombineSExt
from LegalizationArtifactCombiner.h to hit, which
results in different legalization for the following tests:
    LLVM :: CodeGen/X86/GlobalISel/ext-x86-64.ll
    LLVM :: CodeGen/X86/GlobalISel/gep.ll
    LLVM :: CodeGen/X86/GlobalISel/legalize-ext-x86-64.mir

-; X64-NEXT:    movsbl %dil, %eax
+; X64-NEXT:    movl $24, %ecx
+; X64-NEXT:    # kill: def $cl killed $ecx
+; X64-NEXT:    shll %cl, %edi
+; X64-NEXT:    movl $24, %ecx
+; X64-NEXT:    # kill: def $cl killed $ecx
+; X64-NEXT:    sarl %cl, %edi
+; X64-NEXT:    movl %edi, %eax

..which is not optimal and should be addressed later.

Rework of the patch by igorb

Reviewed By: igorb

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

llvm-svn: 327499

6 years agoExplicitly initialize dwarf::FormParams in DIEInteger::SizeOf
Pavel Labath [Wed, 14 Mar 2018 11:14:43 +0000 (11:14 +0000)]
Explicitly initialize dwarf::FormParams in DIEInteger::SizeOf

This could end up inititialized if someone called the function with a
null AsmPrinter. Right now this only happens in DIEHash unit tests,
presumably because it was hard to create an AsmPrinter in the context of
unit tests. This only worked before r327486 because those tests did not
use any dwarf forms whose size actually depended on the dwarf version
(otherwise, they would have crashed due to null dereference).

I fix the uninitialized error, by explicitly initializing FormParams to
an invalid value, which will cause getFixedFormByteSize to return None
if called with a form with version-dependent size. A more principled
solution might be to fix the DIEHash tests to always pass in a valid
AsmPrinter.

llvm-svn: 327498

6 years agoTableGen: Explicitly forbid some nestings of class, multiclass, and foreach
Nicolai Haehnle [Wed, 14 Mar 2018 11:01:01 +0000 (11:01 +0000)]
TableGen: Explicitly forbid some nestings of class, multiclass, and foreach

These previously all failed one way or another, but now we produce a more
helpful error message.

Change-Id: I8ffd2e87c8e35a5134c3be289e0a1fecaa2bb8ca

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

llvm-svn: 327497

6 years agoTableGen: Add !ne, !le, !lt, !ge, and !gt comparisons
Nicolai Haehnle [Wed, 14 Mar 2018 11:00:57 +0000 (11:00 +0000)]
TableGen: Add !ne, !le, !lt, !ge, and !gt comparisons

Change-Id: I8e2ece677268972d578a787467f7ef52a1f33a71

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

llvm-svn: 327496

6 years agoTableGen: Allow dag operators to be resolved late
Nicolai Haehnle [Wed, 14 Mar 2018 11:00:48 +0000 (11:00 +0000)]
TableGen: Allow dag operators to be resolved late

Change-Id: I51bb80fd5c48c8ac441ab11e43d43c1b91b4b590

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

llvm-svn: 327495

6 years agoTableGen: Type-check BinOps
Nicolai Haehnle [Wed, 14 Mar 2018 11:00:43 +0000 (11:00 +0000)]
TableGen: Type-check BinOps

Additionally, allow more than two operands to !con, !add, !and, !or
in the same way as is already allowed for !listconcat and !strconcat.

Change-Id: I9659411f554201b90cd8ed7c7e004d381a66fa93

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

llvm-svn: 327494

6 years agoTableGen: Allow ? in lists
Nicolai Haehnle [Wed, 14 Mar 2018 11:00:33 +0000 (11:00 +0000)]
TableGen: Allow ? in lists

This makes using !dag more convenient in some cases.

Change-Id: I0a8c35e15ccd1ecec778fd1c8d64eee38d74517c

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

llvm-svn: 327493

6 years agoTableGen: Add !dag function for construction
Nicolai Haehnle [Wed, 14 Mar 2018 11:00:26 +0000 (11:00 +0000)]
TableGen: Add !dag function for construction

This allows constructing DAG nodes with programmatically determined
names, and can simplify constructing DAG nodes in other cases as
well.

Also, add documentation and some very simple tests for the already
existing !con.

Change-Id: Ida61cd82e99752548d7109ce8da34d29da56a5f7

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

llvm-svn: 327492

6 years agoStaticAnalyzer: fix compiler warning. NFC
Pavel Labath [Wed, 14 Mar 2018 10:16:40 +0000 (10:16 +0000)]
StaticAnalyzer: fix compiler warning. NFC

My compiler (clang-3.8) complains that the RCC variable is unused.
That's not really true, as it's checked by the if-declaration, but it's
also kinda true, because we don't need to declaration if we only check
it in the if statement.

In reality, all this means that the dyn_cast<> can be replaced by isa<>,
so that's what I do here.

llvm-svn: 327491

6 years ago[cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)
Pavel Labath [Wed, 14 Mar 2018 10:08:21 +0000 (10:08 +0000)]
[cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)

Summary:
To make this build work, I needed to add detection code for the pthread
library. This is necessary, because we have direct calls to these
libraries (instead of going through llvm) and in the standalone build we
cannot rely on llvm to detect these for us. In a standalone non-dylib
build this was accidentaly working because these libraries were pulled
in as an interface dependency of the .a files, but in a dylib build
these are no longer part of the link interface, and so we need to add
them explicitly.

Reviewers: krytarowski, zturner

Subscribers: lldb-commits, mgorny

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

llvm-svn: 327490

6 years agoFix build broken by llvm r327486
Pavel Labath [Wed, 14 Mar 2018 09:57:52 +0000 (09:57 +0000)]
Fix build broken by llvm r327486

llvm::DWARFFormParams moved to llvm::dwarf::FormParams.

llvm-svn: 327489

6 years ago[AMDGPU] Fix for DAGCombiner infinite loop in OCLtst
Alexander Timofeev [Wed, 14 Mar 2018 09:48:51 +0000 (09:48 +0000)]
[AMDGPU] Fix for DAGCombiner infinite loop in OCLtst

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

llvm-svn: 327488

6 years ago[clangd] Add an interface that finds symbol by SymbolID in SymbolIndex.
Eric Liu [Wed, 14 Mar 2018 09:48:05 +0000 (09:48 +0000)]
[clangd] Add an interface that finds symbol by SymbolID in SymbolIndex.

Summary:
Potential use case: argument go-to-definition result with symbol
information (e.g. function definition in cc file) that might not be in the AST.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 327487

6 years agoDWARF: Unify form size handling code
Pavel Labath [Wed, 14 Mar 2018 09:39:54 +0000 (09:39 +0000)]
DWARF: Unify form size handling code

Summary:
This patch replaces the two switches which are deducing the size of
various forms with a single implementation. I have put the new
implementation into BinaryFormat, to avoid introducing dependencies
between the two independent libraries (DebugInfo and CodeGen) that need
this functionality.

Reviewers: aprantl, JDevlieghere, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 327486

6 years ago[dsymutil] Print architecture in warning
Jonas Devlieghere [Wed, 14 Mar 2018 09:34:54 +0000 (09:34 +0000)]
[dsymutil] Print architecture in warning

Make the architecture part of the warning in the DebugMapParser. This
makes things consistent with the Apple's internal version of dsymutil.

llvm-svn: 327485

6 years agoExport LLVM_DYLIB_COMPONENTS in LLVMConfig.cmake
Pavel Labath [Wed, 14 Mar 2018 09:28:38 +0000 (09:28 +0000)]
Export LLVM_DYLIB_COMPONENTS in LLVMConfig.cmake

Summary:
This is needed so that external projects (e.g. a standalone build of
lldb) can link to the LLVM shared library via the USE_SHARED argument of
llvm_config. Without this, llvm_config would add LLVM to the link list,
but then also add the constituent static libraries, resulting in
multiply defined symbols.

Reviewers: beanz, mgorny

Subscribers: llvm-commits

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

llvm-svn: 327484

6 years agoSkip TestWatchedVarHitWhenInScope.py everywhere
Pavel Labath [Wed, 14 Mar 2018 09:13:33 +0000 (09:13 +0000)]
Skip TestWatchedVarHitWhenInScope.py everywhere

The expression-hits tracking logic is not available on any platform. The
reason this tests happens to pass on some platforms is that the test is
written poorly -- it relies on the fact that post-main cleanup code will
write to the stack memory once occupied by the watched variable, but
this is not the case everywhere (e.g. linux glibc does not seem to do
this, but android's bionic library does).

llvm-svn: 327483

6 years ago[GlobalIsel][X86] Support for G_ZEXT instruction
Alexander Ivchenko [Wed, 14 Mar 2018 09:11:23 +0000 (09:11 +0000)]
[GlobalIsel][X86] Support for G_ZEXT instruction

Reviewed By: igorb

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

llvm-svn: 327482

6 years ago[ELF] - Never create .gnu_hash with NBuckets == 0.
George Rimar [Wed, 14 Mar 2018 08:52:39 +0000 (08:52 +0000)]
[ELF] - Never create .gnu_hash with NBuckets == 0.

Currently, we can end up with NBuckets==0 and android loader
does not like it (PR36537).

Seems we can go with a minimal amount of changes here for simplicity
and be consistent with gold and so just always use >= 1 value for NBuckets.

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

llvm-svn: 327481

6 years ago[ELF] - Convert overlapping-sections.s testcase to x86 and cleanup.
George Rimar [Wed, 14 Mar 2018 07:44:23 +0000 (07:44 +0000)]
[ELF] - Convert overlapping-sections.s testcase to x86 and cleanup.

Patch do the following changes:

* Test case was converted from MIPS to x86.

* Removed part of the test checking we are able to produce a valid output.
  Since we do that already in other tests, this one's intention should be
  only to check we are still able to report overlaps and/or produce
  broken output with overlaps.

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

llvm-svn: 327480

6 years ago[LLVM-C] Redo unnamed_address attribute bindings
Robert Widmann [Wed, 14 Mar 2018 06:45:51 +0000 (06:45 +0000)]
[LLVM-C] Redo unnamed_address attribute bindings

Summary:
The old bindings should have used an enum instead of a boolean.  This
deprecates LLVMHasUnnamedAddr and LLVMSetUnnamedAddr , replacing them
with LLVMGetUnnamedAddress and LLVMSetUnnamedAddress respectively that do.
Though it is unlikely LLVM will gain more supported global value linker
hints, the new API can scale to accommodate this.

Reviewers: deadalnix, whitequark

Reviewed By: whitequark

Subscribers: llvm-commits, harlanhaskins

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

llvm-svn: 327479

6 years ago[RuntimeDyld] Silence a compiler error.
Lang Hames [Wed, 14 Mar 2018 06:39:49 +0000 (06:39 +0000)]
[RuntimeDyld] Silence a compiler error.

This should fix the error at
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/19008

llvm-svn: 327478

6 years ago[ORC] Fix a data race in the lookup function.
Lang Hames [Wed, 14 Mar 2018 06:25:08 +0000 (06:25 +0000)]
[ORC] Fix a data race in the lookup function.

The Error locals need to be protected by a mutex. (This could be fixed by
having the promises / futures contain Expected and Error values, but
MSVC's future implementation does not support this yet).

Hopefully this will fix some of the errors seen on the builders due to
r327474.

llvm-svn: 327477

6 years ago[ExecutionEngine] Add a getSymbolTable method to RuntimeDyld.
Lang Hames [Wed, 14 Mar 2018 06:25:07 +0000 (06:25 +0000)]
[ExecutionEngine] Add a getSymbolTable method to RuntimeDyld.

This can be used to extract the symbol table from a RuntimeDyld instance prior
to disposing of it.

This patch also updates RTDyldObjectLinkingLayer to use the new method, rather
than requesting symbols one at a time via getSymbol.

llvm-svn: 327476

6 years ago[ORC] Silence a compiler error.
Lang Hames [Wed, 14 Mar 2018 05:23:56 +0000 (05:23 +0000)]
[ORC] Silence a compiler error.

This should fix the builder error at
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/19006

llvm-svn: 327475

6 years ago[ORC] Add a 'lookup' convenience function for finding symbols in a list of VSOs.
Lang Hames [Wed, 14 Mar 2018 04:18:04 +0000 (04:18 +0000)]
[ORC] Add a 'lookup' convenience function for finding symbols in a list of VSOs.

The lookup function takes a list of VSOs, a set of symbol names (or just one
symbol name) and a materialization function object. It returns an
Expected<SymbolMap> (if given a set of names) or an Expected<JITEvaluatedSymbol>
(if given just one name). The lookup method constructs an
AsynchronousSymbolQuery for the given names, applies that query to each VSO in
the list in turn, and then blocks waiting for the query to complete. If
threading is enabled then the materialization function object can be used to
execute the materialization on different threads. If threading is disabled the
MaterializeOnCurrentThread utility must be used.

llvm-svn: 327474

6 years ago[SymbolFilePDB] Rewrite ParseTypes method
Aaron Smith [Wed, 14 Mar 2018 04:05:27 +0000 (04:05 +0000)]
[SymbolFilePDB] Rewrite ParseTypes method

Summary:
The types for the compiland's children are parsed when parsing types for a PDB compiland. Global types also need to be parsed but unfortunately PDBs do not have compiland information about each global type. So we parse them all on the first call to ParseTypes.

If a sc.function is provided then parse the types for that function. Otherwise parse the types for the overall sc.comp_unit.

The ParseTypes method can be very slow if a program has a long list of compile units containing needed modules. Debugging clang-cl with lldb will show the problem.

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327473

6 years agoDisable test debuglineinfo-path on powerpc
Eugene Zemtsov [Wed, 14 Mar 2018 02:10:07 +0000 (02:10 +0000)]
Disable test debuglineinfo-path on powerpc

llvm-svn: 327472

6 years ago[hwasan] update docs
Kostya Serebryany [Wed, 14 Mar 2018 01:55:49 +0000 (01:55 +0000)]
[hwasan] update docs

llvm-svn: 327471

6 years agogrep for global functions only
Eugene Zemtsov [Wed, 14 Mar 2018 01:07:18 +0000 (01:07 +0000)]
grep for global functions only

llvm-svn: 327469

6 years ago[WebAssembly] Fix expected contents of relocations with addends
Sam Clegg [Wed, 14 Mar 2018 00:53:34 +0000 (00:53 +0000)]
[WebAssembly] Fix expected contents of relocations with addends

This fixes issues found on the wasm waterfall related to relocations
with addends. Undefined symbols, even those with addends should
always have a provisional value of zero. At least this is what llvm
emits (and I believe this is true for ELF too).

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

llvm-svn: 327468

6 years agoTargetMachine: Add address space to getPointerSize
Matt Arsenault [Wed, 14 Mar 2018 00:36:23 +0000 (00:36 +0000)]
TargetMachine: Add address space to getPointerSize

llvm-svn: 327467

6 years agoAdd extra output/check to debug clang-ppc64be-linux test failure
Eugene Zemtsov [Wed, 14 Mar 2018 00:15:16 +0000 (00:15 +0000)]
Add extra output/check to debug clang-ppc64be-linux test failure

llvm-svn: 327466

6 years agoRevert "[LTO/gold] Support --wrap"
Teresa Johnson [Tue, 13 Mar 2018 23:55:34 +0000 (23:55 +0000)]
Revert "[LTO/gold] Support --wrap"

This reverts commit r327459. The new gold plugin interface is not
available with older gold installations, leading to compile failures:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/9109/steps/build-stage2-LLVMgold.so/logs/stdio

llvm-svn: 327465

6 years agoCheck that a field is not annotated with attribute "unavailable" before
Akira Hatanaka [Tue, 13 Mar 2018 23:37:51 +0000 (23:37 +0000)]
Check that a field is not annotated with attribute "unavailable" before
setting the NonTrivialToPrimitive* flags of a record.

Union fields that have non-trivial Objective-C ownership qualifications
are normally not legal, but if the union is declared in a system header,
the fields are annotated with attribute "unavailable".

rdar://problem/38431072

llvm-svn: 327464

6 years ago[test] Replace some references to Apple-internal bugs
Vedant Kumar [Tue, 13 Mar 2018 23:37:11 +0000 (23:37 +0000)]
[test] Replace some references to Apple-internal bugs

This removes around 10 references to Apple-internal radars. I've filed
fresh bugs on bugs.llvm.org as appropriate for open issues.

llvm-svn: 327463

6 years ago[X86] Re-generate test to get proper capitalization of its CHECK lines. NFC
Craig Topper [Tue, 13 Mar 2018 23:31:48 +0000 (23:31 +0000)]
[X86] Re-generate test to get proper capitalization of its CHECK lines. NFC

llvm-svn: 327462

6 years ago[GISel]: Fix incorrect type used in Pattern Match for ICst
Aditya Nandakumar [Tue, 13 Mar 2018 23:21:13 +0000 (23:21 +0000)]
[GISel]: Fix incorrect type used in Pattern Match for ICst

getConstantVRegVal() returns int64_t but we use uint64_t.

llvm-svn: 327461

6 years ago[OpenMP] Add flag for linking runtime bitcode library
Gheorghe-Teodor Bercea [Tue, 13 Mar 2018 23:19:52 +0000 (23:19 +0000)]
[OpenMP] Add flag for linking runtime bitcode library

Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode.

Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel

Reviewed By: ABataev, grokos

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 327460

6 years ago[LTO/gold] Support --wrap
Teresa Johnson [Tue, 13 Mar 2018 23:06:19 +0000 (23:06 +0000)]
[LTO/gold] Support --wrap

Summary:
Utilize new gold plugin api interface for obtaining --wrap option
arguments, and LTO API handling (added for --wrap support in lld LTO),
to mark symbols so that LTO does not optimize them inappropriately.

Note the test cases will be in a new gold test subdirectory that
is dependent on the next release of gold which will contain the new
interfaces.

Reviewers: pcc, tmsriram

Subscribers: mehdi_amini, llvm-commits, inglorion

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

llvm-svn: 327459

6 years agoDisable optimizations in debuglineinfo-path test
Eugene Zemtsov [Tue, 13 Mar 2018 22:48:39 +0000 (22:48 +0000)]
Disable optimizations in debuglineinfo-path test

llvm-svn: 327458

6 years ago[X86] Simplify the LowerAVXCONCAT_VECTORS code a little by creating a single path...
Craig Topper [Tue, 13 Mar 2018 22:36:07 +0000 (22:36 +0000)]
[X86] Simplify the LowerAVXCONCAT_VECTORS code a little by creating a single path for insert_subvector handling.

We now only create recursive concats if we have more than two non-zero values. This keeps our subvector broadcast DAG combine functioning.

llvm-svn: 327457

6 years ago[Attr] Merge two dependent tests from different directories
Joel E. Denny [Tue, 13 Mar 2018 22:18:29 +0000 (22:18 +0000)]
[Attr] Merge two dependent tests from different directories

Suggested at: https://reviews.llvm.org/D43248

llvm-svn: 327456

6 years ago[ARM] ACLE FP16 feature test macros
Sjoerd Meijer [Tue, 13 Mar 2018 22:11:06 +0000 (22:11 +0000)]
[ARM] ACLE FP16 feature test macros

This is a partial recommit of r327189 that was reverted
due to test issues. I.e., this recommits minimal functional
change, the FP16 feature test macros, and adds tests that
were missing in the original commit.

llvm-svn: 327455

6 years ago[X86] Rewrite LowerAVXCONCAT_VECTORS similar to how we handle vXi1 concats.
Craig Topper [Tue, 13 Mar 2018 22:05:25 +0000 (22:05 +0000)]
[X86] Rewrite LowerAVXCONCAT_VECTORS similar to how we handle vXi1 concats.

This better able to detect undef and zeros pieces in the concat. Or cases when only one subvector is non-zero. This allows us to avoid silly things like double inserts into progressively larger undefs.

This still builds 512 bit concats of 128 bits by building up through 256 bits first. But I don't know if that's best.

We probably want to merge this with the vXi1 concat code since they are very similar.

llvm-svn: 327454

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Tue, 13 Mar 2018 21:32:01 +0000 (21:32 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 327453

6 years ago[clang-tidy] Fixing incorrect comment
Julie Hockett [Tue, 13 Mar 2018 21:24:08 +0000 (21:24 +0000)]
[clang-tidy] Fixing incorrect comment

llvm-svn: 327452

6 years agoDisable PDB injected sources test temporarily.
Zachary Turner [Tue, 13 Mar 2018 21:18:00 +0000 (21:18 +0000)]
Disable PDB injected sources test temporarily.

llvm-svn: 327451

6 years agoSimplify more cases of logical ops of masked icmps.
Hiroshi Yamauchi [Tue, 13 Mar 2018 21:13:18 +0000 (21:13 +0000)]
Simplify more cases of logical ops of masked icmps.

Summary:
For example,

((X & 255) != 0) && ((X & 15) == 8) -> ((X & 15) == 8).
((X & 7) != 0) && ((X & 15) == 8) -> false.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

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

llvm-svn: 327450

6 years agoRemove explicit triple and data layout from the test
Eugene Zemtsov [Tue, 13 Mar 2018 21:10:15 +0000 (21:10 +0000)]
Remove explicit triple and data layout from the test

llvm-svn: 327449

6 years agoAdd a missing return in SBPlatform::IsConnected and test
Jim Ingham [Tue, 13 Mar 2018 21:06:05 +0000 (21:06 +0000)]
Add a missing return in SBPlatform::IsConnected and test
for the behavior - using the fact that the Host platform
is always present & connected.

llvm-svn: 327448

6 years agoRevert revision 327438.
Gheorghe-Teodor Bercea [Tue, 13 Mar 2018 20:50:12 +0000 (20:50 +0000)]
Revert revision 327438.

llvm-svn: 327447

6 years ago[DAGCombiner] Allow visitEXTRACT_SUBVECTOR to combine with BUILD_VECTORS between...
Craig Topper [Tue, 13 Mar 2018 20:36:28 +0000 (20:36 +0000)]
[DAGCombiner] Allow visitEXTRACT_SUBVECTOR to combine with BUILD_VECTORS between LegalizeVectorOps and LegalizeDAG.

BUILD_VECTORs aren't themselves legalized until LegalizeDAG so we should still be able to create an "illegal" one before that. This helps combine with BUILD_VECTORS that are introduced during LegalizeVectorOps due to unrolling.

llvm-svn: 327446

6 years ago[DataFormatter] Remove dead code for the NSDictionary formatter.
Davide Italiano [Tue, 13 Mar 2018 20:26:38 +0000 (20:26 +0000)]
[DataFormatter] Remove dead code for the NSDictionary formatter.

I'm going to make changes in this area soon, so I figured I
could clean things a bit while I was around.

llvm-svn: 327445

6 years agoUpdate modulemap to exclude new DIA headers.
Zachary Turner [Tue, 13 Mar 2018 20:16:37 +0000 (20:16 +0000)]
Update modulemap to exclude new DIA headers.

llvm-svn: 327444

6 years agoFix debuglineinfo-path.ll
Eugene Zemtsov [Tue, 13 Mar 2018 20:06:33 +0000 (20:06 +0000)]
Fix debuglineinfo-path.ll

This fix is based on an assumption that some build bots are missing 'echo
-n'

llvm-svn: 327443