platform/upstream/llvm.git
6 years agoSupport `#pragma comment(lib, "name")` in the frontend for ELF
Saleem Abdulrasool [Wed, 7 Feb 2018 01:46:46 +0000 (01:46 +0000)]
Support `#pragma comment(lib, "name")` in the frontend for ELF

This adds the frontend support required to support the use of the
comment pragma to enable auto linking on ELFish targets. This is a
generic ELF extension supported by LLVM. We need to change the handling
for the "dependentlib" in order to accommodate the previously discussed
encoding for the dependent library descriptor. Without the custom
handling of the PCK_Lib directive, the -l prefixed option would be
encoded into the resulting object (which is treated as a frontend
error).

llvm-svn: 324438

6 years agolldb running on an ios device is using the _dyld_get_all_image_infos()
Jason Molenda [Wed, 7 Feb 2018 01:28:29 +0000 (01:28 +0000)]
lldb running on an ios device is using the _dyld_get_all_image_infos()
SPI call to to find its own shared cache's UUID.  On newer sytems we
need to use the a new SPI which will return the UUID directly.

<rdar://problem/36625871>

llvm-svn: 324437

6 years ago[Mips][AMDGPU] Update test cases to not use vector lt/gt compares that can be simplif...
Craig Topper [Wed, 7 Feb 2018 00:51:37 +0000 (00:51 +0000)]
[Mips][AMDGPU] Update test cases to not use vector lt/gt compares that can be simplified to an equality/inequality or to always true/false.

For example 'ugt X, 0' can be simplified to 'ne X, 0'. Or 'uge X, 0' is always true.

We already simplify this for scalars in SimplifySetCC, but we don't currently for vectors in SimplifySetCC. D42948 proposes to change that.

llvm-svn: 324436

6 years agoDon't set dso_local flag in LTO resolutions for absolute symbols defined in ELF
Dmitry Mikulin [Wed, 7 Feb 2018 00:49:51 +0000 (00:49 +0000)]
Don't set dso_local flag in LTO resolutions for absolute symbols defined in ELF
objects, it confuses codegen into generating pc-rel relocations for those
symbols, which leads to linker errors.

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

llvm-svn: 324435

6 years agoMake sure that --no-check-sections doesn't print out warning messages.
Rui Ueyama [Wed, 7 Feb 2018 00:41:34 +0000 (00:41 +0000)]
Make sure that --no-check-sections doesn't print out warning messages.

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

llvm-svn: 324434

6 years ago[NFC] Change odd cast-through-unknown behavior to an Optional
Erich Keane [Wed, 7 Feb 2018 00:37:19 +0000 (00:37 +0000)]
[NFC] Change odd cast-through-unknown behavior to an Optional

This bit of code in the driver uses '~0U' as a sentinel value.
The result is an odd mishmash of casts just to work.  This replaces
it with an optional,  which is a little less crazy looking.
--ehis line, and those below, will be ignored--

M    lib/Driver/Driver.cpp

llvm-svn: 324433

6 years ago[clang-tidy] Update fuchsia-multiple-inheritance to check for templates
Julie Hockett [Wed, 7 Feb 2018 00:33:50 +0000 (00:33 +0000)]
[clang-tidy] Update fuchsia-multiple-inheritance to check for templates

Updating fuchsia-multiple-inheritance to not crash when a record
inherits a template.

Fixes PR36052.

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

llvm-svn: 324432

6 years agoAMDGPU: Select BFI patterns with 64-bit ints
Matt Arsenault [Wed, 7 Feb 2018 00:21:34 +0000 (00:21 +0000)]
AMDGPU: Select BFI patterns with 64-bit ints

llvm-svn: 324431

6 years ago[NFC] Correct a typo'ed comment and reworded, since it is awkward.
Erich Keane [Wed, 7 Feb 2018 00:19:58 +0000 (00:19 +0000)]
[NFC] Correct a typo'ed comment and reworded, since it is awkward.

llvm-svn: 324430

6 years ago[LCSSAVerification] Run verification only when asserts are enabled.
Michael Zolotukhin [Wed, 7 Feb 2018 00:13:08 +0000 (00:13 +0000)]
[LCSSAVerification] Run verification only when asserts are enabled.

llvm-svn: 324429

6 years agoSimplify libtool compatibility hack.
Rafael Espindola [Wed, 7 Feb 2018 00:13:01 +0000 (00:13 +0000)]
Simplify libtool compatibility hack.

I tested that if I remove "elf" from the message, building a program
that uses libtool prints

checking whether to build shared libraries... no

but with this patch it still prints

checking whether to build shared libraries... yes

llvm-svn: 324428

6 years ago[DAGCombiner][AMDGPU][X86] Turn cttz/ctlz into cttz_zero_undef/ctlz_zero_undef if...
Craig Topper [Tue, 6 Feb 2018 23:54:37 +0000 (23:54 +0000)]
[DAGCombiner][AMDGPU][X86] Turn cttz/ctlz into cttz_zero_undef/ctlz_zero_undef if we can prove the input is never zero

X86 currently has a late DAG combine after cttz/ctlz are turned into BSR+BSF+CMOV to detect this and remove the CMOV. But we should be able to do this much earlier and avoid creating the cmov all together.

For the changed AMDGPU test case it appears that previously the i8 cttz was type legalized to i16 which introduced an OR with 256 in order to limit the result to 8 on the widened type. At this point the result is known to never be zero, but nothing checked that. Then operation legalization is told to promote all i16 cttz to i32. This introduces an extend and a truncate and another OR with 65536 to limit the result to 16. With the DAG combiner change we are able to prevent the creation of the second OR since the opcode will have been changed to cttz_zero_undef after the first OR. I the lack of the OR caused the instruction to change to v_ffbl_b32_sdwa

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

llvm-svn: 324427

6 years agoAdd DWARF for discriminated unions
Adrian Prantl [Tue, 6 Feb 2018 23:45:59 +0000 (23:45 +0000)]
Add DWARF for discriminated unions

n Rust, an enum that carries data in the variants is, essentially, a
discriminated union. Furthermore, the Rust compiler will perform
space optimizations on such enums in some situations. Previously,
DWARF for these constructs was emitted using a hack (a magic field
name); but this approach stopped working when more space optimizations
were added in https://github.com/rust-lang/rust/pull/45225.

This patch changes LLVM to allow discriminated unions to be
represented in DWARF. It adds createDiscriminatedUnionType and
createDiscriminatedMemberType to DIBuilder and then arranges for this
to be emitted using DWARF's DW_TAG_variant_part and DW_TAG_variant.

Note that DWARF requires that a discriminated union be represented as
a structure with a variant part. However, as Rust only needs to emit
pure discriminated unions, this is what I chose to expose on
DIBuilder.

Patch by Tom Tromey!

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

llvm-svn: 324426

6 years ago[Sema][ObjC] Use SmallSetVector to fix a failing test on the reverse
Akira Hatanaka [Tue, 6 Feb 2018 23:44:40 +0000 (23:44 +0000)]
[Sema][ObjC] Use SmallSetVector to fix a failing test on the reverse
iteration bot.

This commit reverts r315639, which was causing clang to print
diagnostics that weren't printed before. Instead, it declares
OverrideSearch::Overridden as a SmallSetVector to fix the
non-deterministic behavior r315639 was trying to fix.

rdar://problem/36445528

llvm-svn: 324425

6 years agoPlace undefined globals in .bss instead of .data
Eli Friedman [Tue, 6 Feb 2018 23:22:14 +0000 (23:22 +0000)]
Place undefined globals in .bss instead of .data

Following up on the discussion from
http://lists.llvm.org/pipermail/llvm-dev/2017-April/112305.html, undef
values are now placed in the .bss as well as null values. This prevents
undef global values taking up potentially huge amounts of space in the
.data section.

The following two lines now both generate equivalent .bss data:

@vals1 = internal unnamed_addr global [20000000 x i32] zeroinitializer, align 4
@vals2 = internal unnamed_addr global [20000000 x i32] undef, align 4 ; previously unaccounted for

This is primarily motivated by the corresponding issue in the Rust
compiler (https://github.com/rust-lang/rust/issues/41315).

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

Patch by varkor!

llvm-svn: 324424

6 years agoRemove more of the std::experimental bits that are now in std::. All the _v type...
Marshall Clow [Tue, 6 Feb 2018 23:13:48 +0000 (23:13 +0000)]
Remove more of the std::experimental bits that are now in std::. All the _v type aliases, conjunction/disjunction, apply, etc. See https://libcxx.llvm.org/TS_deprecation.html

llvm-svn: 324423

6 years ago[LivePhysRegs] Fix handling of return instructions.
Eli Friedman [Tue, 6 Feb 2018 23:00:17 +0000 (23:00 +0000)]
[LivePhysRegs] Fix handling of return instructions.

See D42509 for the original version of this.

Basically, there are two significant changes to behavior here:

- addLiveOuts always adds all pristine registers (even if a block has
no successors).
- addLiveOuts and addLiveOutsNoPristines always add all callee-saved
registers for return blocks (including conditional return blocks).

I cleaned up the functions a bit to make it clear these properties hold.

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

llvm-svn: 324422

6 years agoConvert a use of Config->Static.
Rafael Espindola [Tue, 6 Feb 2018 22:59:24 +0000 (22:59 +0000)]
Convert a use of Config->Static.

In lld this was the only use of Config->Static where it meant anything
else other than "use .a instead of .so".

If a program turns out to not use any dynamic libraries, we should
produce the same result with and without -static.

llvm-svn: 324421

6 years ago[Myriad] Define __ma2x5x and __ma2x8x
Walter Lee [Tue, 6 Feb 2018 22:39:47 +0000 (22:39 +0000)]
[Myriad] Define __ma2x5x and __ma2x8x

Summary: Add architecture defines for ma2x5x and ma2x8x.

Reviewers: jyknight

Subscribers: fedor.sergeev, MartinO

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

llvm-svn: 324420

6 years ago[Lex] Fix handling numerical literals ending with ' and signed exponent.
Volodymyr Sapsai [Tue, 6 Feb 2018 22:39:25 +0000 (22:39 +0000)]
[Lex] Fix handling numerical literals ending with ' and signed exponent.

For input `0'e+1` lexer tokenized as numeric constant only `0'e`. Later
NumericLiteralParser skipped 0 and ' as digits and parsed `e+1` as valid
exponent going past the end of the token. Because it didn't mark numeric
literal as having an error, it continued parsing and tried to expandUCNs
with StringRef of length -2.

The fix is not to parse exponent when we reached the end of token.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4588

rdar://problem/36076719

Reviewers: rsmith, t.p.northover

Reviewed By: rsmith

Subscribers: cfe-commits, jkorous-apple

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

llvm-svn: 324419

6 years agoStore just argv[0] in Config.
Rafael Espindola [Tue, 6 Feb 2018 22:37:05 +0000 (22:37 +0000)]
Store just argv[0] in Config.

Having the full argv there seems in conflict with the desire to parse
all command line options in the Driver.

llvm-svn: 324418

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Tue, 6 Feb 2018 22:35:47 +0000 (22:35 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Fix the modeling of long division and SIMD conversion from integer and
horizontal minimum and maximum.

llvm-svn: 324417

6 years agoAdd SelectionDAGDumper support for strict FP nodes
Andrew Kaylor [Tue, 6 Feb 2018 22:28:15 +0000 (22:28 +0000)]
Add SelectionDAGDumper support for strict FP nodes

Patch by Kevin P. Neal

llvm-svn: 324416

6 years agoAdd OrcJIT dependency for Kaleidoscope Chapter 9.
Lang Hames [Tue, 6 Feb 2018 22:22:10 +0000 (22:22 +0000)]
Add OrcJIT dependency for Kaleidoscope Chapter 9.

This should fix the error at
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10421

llvm-svn: 324413

6 years agoFix a crash when emitting DIEs for variable-length arrays
Adrian Prantl [Tue, 6 Feb 2018 22:17:45 +0000 (22:17 +0000)]
Fix a crash when emitting DIEs for variable-length arrays

VLAs may refer to a previous DIE to express the DW_AT_count of their
type. Clang generates an artificial "vla_expr" variable for this. If
this DIE hasn't been created yet LLVM asserts. This patch fixes this
by sorting the local variables so that dependencies come before they
are needed. It also replaces the linear scan in DWARFFile with a
std::map, which can be faster.

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

llvm-svn: 324412

6 years ago[ORC] Use explicit constructor calls to fix a builder error at
Lang Hames [Tue, 6 Feb 2018 22:17:09 +0000 (22:17 +0000)]
[ORC] Use explicit constructor calls to fix a builder error at
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/17627

llvm-svn: 324411

6 years ago[ORC] Remove some unused lambda captures.
Lang Hames [Tue, 6 Feb 2018 21:52:46 +0000 (21:52 +0000)]
[ORC] Remove some unused lambda captures.

llvm-svn: 324410

6 years ago[X86] Add test cases that exercise the BSR/BSF optimization combineCMov.
Craig Topper [Tue, 6 Feb 2018 21:47:04 +0000 (21:47 +0000)]
[X86] Add test cases that exercise the BSR/BSF optimization combineCMov.

combineCmov tries to remove compares against BSR/BSF if we can prove the input to the BSR/BSF are never zero.

As far as I can tell most of the time codegenprepare despeculates ctlz/cttz and gives us a cttz_zero_undef/ctlz_zero_undef which don't use a cmov.

So the only way I found to trigger this code is to show codegenprepare an illegal type which it won't despeculate.

I think we should be turning ctlz/cttz into ctlz_zero_undef/cttz_zero_undef for these cases before we ever get to operation legalization where the cmov is created. But wanted to add these tests so we don't regress.

llvm-svn: 324409

6 years ago[x86] add tests to show demanded bits shortcoming; NFC
Sanjay Patel [Tue, 6 Feb 2018 21:43:57 +0000 (21:43 +0000)]
[x86] add tests to show demanded bits shortcoming; NFC

llvm-svn: 324408

6 years agoSupport special acronyms inside property names and allow plural forms
Yan Zhang [Tue, 6 Feb 2018 21:40:38 +0000 (21:40 +0000)]
Support special acronyms inside property names and allow plural forms

Reviewers: benhamilton, hokein

Reviewed By: benhamilton, hokein

Subscribers: klimek, cfe-commits

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

llvm-svn: 324407

6 years ago[docs] Add out-of-date warnings to the BuildingAJIT tutorial text.
Lang Hames [Tue, 6 Feb 2018 21:25:20 +0000 (21:25 +0000)]
[docs] Add out-of-date warnings to the BuildingAJIT tutorial text.

The text will be updated once the ORC API churn dies down.

llvm-svn: 324406

6 years ago[ORC] Start migrating ORC layers to use the new ORC Core.h APIs.
Lang Hames [Tue, 6 Feb 2018 21:25:11 +0000 (21:25 +0000)]
[ORC] Start migrating ORC layers to use the new ORC Core.h APIs.

In particular this patch switches RTDyldObjectLinkingLayer to use
orc::SymbolResolver and threads the requried changse (ExecutionSession
references and VModuleKeys) through the existing layer APIs.

The purpose of the new resolver interface is to improve query performance and
better support parallelism, both in JIT'd code and within the compiler itself.

The most visibile change is switch of the <Layer>::addModule signatures from:

Expected<Handle> addModule(std::shared_ptr<ModuleType> Mod,
                           std::shared_ptr<JITSymbolResolver> Resolver)

to:

Expected<Handle> addModule(VModuleKey K, std::shared_ptr<ModuleType> Mod);

Typical usage of addModule will now look like:

auto K = ES.allocateVModuleKey();
Resolvers[K] = createSymbolResolver(...);
Layer.addModule(K, std::move(Mod));

See the BuildingAJIT tutorial code for example usage.

llvm-svn: 324405

6 years ago[AArch64] add test to show sub-optimal isel; NFC
Sanjay Patel [Tue, 6 Feb 2018 21:25:02 +0000 (21:25 +0000)]
[AArch64] add test to show sub-optimal isel; NFC

llvm-svn: 324404

6 years ago[x86] add test to show missed BMI isel; NFC
Sanjay Patel [Tue, 6 Feb 2018 21:18:53 +0000 (21:18 +0000)]
[x86] add test to show missed BMI isel; NFC

llvm-svn: 324403

6 years ago[DSE] Upgrade uses of MemoryIntrinic::getAlignment() to new API. (NFC)
Daniel Neilson [Tue, 6 Feb 2018 21:18:33 +0000 (21:18 +0000)]
[DSE] Upgrade uses of MemoryIntrinic::getAlignment() to new API. (NFC)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
DeadStoreElimination pass to cease using the old getAlignment() API of MemoryIntrinsic
in favour of getting dest specific alignments through the new API.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384, rL324395 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324402

6 years ago[TargetLowering] use local variable to reduce duplication; NFCI
Sanjay Patel [Tue, 6 Feb 2018 21:09:42 +0000 (21:09 +0000)]
[TargetLowering] use local variable to reduce duplication; NFCI

llvm-svn: 324401

6 years agoRemove obsolete file
Adrian Prantl [Tue, 6 Feb 2018 21:04:06 +0000 (21:04 +0000)]
Remove obsolete file

llvm-svn: 324400

6 years agoMark P0777 as complete
Marshall Clow [Tue, 6 Feb 2018 21:00:58 +0000 (21:00 +0000)]
Mark P0777 as complete

llvm-svn: 324399

6 years agoImplement P0777: Treating unnecessay decay
Marshall Clow [Tue, 6 Feb 2018 20:56:55 +0000 (20:56 +0000)]
Implement P0777: Treating unnecessay decay

llvm-svn: 324398

6 years ago[TargetLowering] use local variables to reduce duplication; NFCI
Sanjay Patel [Tue, 6 Feb 2018 20:49:28 +0000 (20:49 +0000)]
[TargetLowering] use local variables to reduce duplication; NFCI

llvm-svn: 324397

6 years agoPass --build-dir to dotest in the Xcode project
Adrian Prantl [Tue, 6 Feb 2018 20:48:35 +0000 (20:48 +0000)]
Pass --build-dir to dotest in the Xcode project

llvm-svn: 324396

6 years ago[InferAddressSpaces] Update uses of IRBuilder memory intrinsic creation to new API
Daniel Neilson [Tue, 6 Feb 2018 20:33:36 +0000 (20:33 +0000)]
[InferAddressSpaces] Update uses of IRBuilder memory intrinsic creation to new API

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
InferAddressSpaces pass to cease using:
1) The old getAlignment() API of MemoryIntrinsic in favour of getting source & dest specific
alignments through the new API.
2) The old IRBuilder CreateMemCpy/CreateMemMove single-alignment APIs in favour of the new
API that allows setting source and destination alignments independently.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324395

6 years ago[DWARFv5] Emit .debug_line_str (in a non-DWO file).
Paul Robinson [Tue, 6 Feb 2018 20:29:21 +0000 (20:29 +0000)]
[DWARFv5] Emit .debug_line_str (in a non-DWO file).

This should enable the linker to do string-pooling of path names.

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

llvm-svn: 324393

6 years ago[Hexagon] Extract HVX lowering and selection into HVX-specific files, NFC
Krzysztof Parzyszek [Tue, 6 Feb 2018 20:22:20 +0000 (20:22 +0000)]
[Hexagon] Extract HVX lowering and selection into HVX-specific files, NFC

llvm-svn: 324392

6 years ago[Hexagon] Lower concat of more than 2 vectors into build_vector
Krzysztof Parzyszek [Tue, 6 Feb 2018 20:18:58 +0000 (20:18 +0000)]
[Hexagon] Lower concat of more than 2 vectors into build_vector

llvm-svn: 324391

6 years ago[clangd] Make the premble tremble.
Benjamin Kramer [Tue, 6 Feb 2018 20:08:23 +0000 (20:08 +0000)]
[clangd] Make the premble tremble.

No functionality change.

llvm-svn: 324389

6 years ago[SLP] Update test checks, NFC.
Alexey Bataev [Tue, 6 Feb 2018 20:00:05 +0000 (20:00 +0000)]
[SLP] Update test checks, NFC.

llvm-svn: 324387

6 years agoRevert "[clangd] The new threading implementation" (r324356)
Ilya Biryukov [Tue, 6 Feb 2018 19:22:40 +0000 (19:22 +0000)]
Revert "[clangd] The new threading implementation" (r324356)

And the follow-up changes r324361 and r324363.
These changes seem to break two buildbots:
  - http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14091
  - http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/16001

We will need to investigate what went wrong and resubmit the changes
afterwards.

llvm-svn: 324386

6 years agoFix building libc++ with the macOS 10.13 SDK with -mmacosx-version-min=10.12 or lower.
Nico Weber [Tue, 6 Feb 2018 19:17:41 +0000 (19:17 +0000)]
Fix building libc++ with the macOS 10.13 SDK with -mmacosx-version-min=10.12 or lower.

The 10.13 SDK always defines utimensat() (with an availability(macosx=10.13) annotation)
and unconditionally defines UTIME_OMIT, so use the compile-time availability macros
on Apple platforms instead.

For people statically linking libc++, it might make sense to also provide an opt-in
option for using __builtin_available() to dynamically check for the OS version,
but for now let's do the smallest thing needed to unbreak the build.

Based on a patch by Eric Fiselier <eric@efcs.ca>: https://reviews.llvm.org/D34249
Fixes PR33469.

llvm-svn: 324385

6 years ago[InlineFunction] Update deprecated use of IRBuilder CreateMemCpy (NFC)
Daniel Neilson [Tue, 6 Feb 2018 19:14:31 +0000 (19:14 +0000)]
[InlineFunction] Update deprecated use of IRBuilder CreateMemCpy (NFC)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
InlineFunction pass to ceause using the old IRBuilder CreateMemCpy single-alignment API
in favour of the new API that allows setting source and destination alignments independently.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324384

6 years ago[AMDGPU] removed dead code handling rmw in memory legalizer
Stanislav Mekhanoshin [Tue, 6 Feb 2018 19:11:56 +0000 (19:11 +0000)]
[AMDGPU] removed dead code handling rmw in memory legalizer

It was always using cmpxchg path and in rmw and cmpxchg instructions
are not distinguishable in the BE.

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

llvm-svn: 324383

6 years ago[clangd] Attempt to unbreak windows buildbots.
Ilya Biryukov [Tue, 6 Feb 2018 19:09:44 +0000 (19:09 +0000)]
[clangd] Attempt to unbreak windows buildbots.

Some buildbots are breaking on trace.test due to using Linux's path
separators. This commit should unbreak them.

llvm-svn: 324382

6 years ago[Hexagon] Don't form new-value jumps from floating-point instructions
Krzysztof Parzyszek [Tue, 6 Feb 2018 19:08:41 +0000 (19:08 +0000)]
[Hexagon] Don't form new-value jumps from floating-point instructions

Additionally, verify that the register defined by the producer is a
32-bit register.

llvm-svn: 324381

6 years agoMore correct handling of error cases C++ name parser
Eugene Zemtsov [Tue, 6 Feb 2018 19:04:12 +0000 (19:04 +0000)]
More correct handling of error cases C++ name parser

Now incorrect type argument that looks like T<A><B> doesn't
cause an assert, but just a parsing error.

Bug: 36224
Differential Revision: https://reviews.llvm.org/D42939

llvm-svn: 324380

6 years agoFix misleading indentation; replace a couple of NULLs with nullptr. Resolves https...
Marshall Clow [Tue, 6 Feb 2018 18:58:05 +0000 (18:58 +0000)]
Fix misleading indentation; replace a couple of NULLs with nullptr. Resolves https://reviews.llvm.org/D42945 ; thanks to Bruce Mitchener for the patch.

llvm-svn: 324378

6 years agoPass around function pointers as CGCallees, not bare llvm::Value*s.
John McCall [Tue, 6 Feb 2018 18:52:44 +0000 (18:52 +0000)]
Pass around function pointers as CGCallees, not bare llvm::Value*s.

The intention here is to make it easy to write frontend-assisted CFI
systems by propagating extra information in the CGCallee.

llvm-svn: 324377

6 years agoAdd vstore_half_rte implementation
Jan Vesely [Tue, 6 Feb 2018 18:44:50 +0000 (18:44 +0000)]
Add vstore_half_rte implementation

Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324376

6 years agoAdd vstore_half_rtp implementation
Jan Vesely [Tue, 6 Feb 2018 18:44:47 +0000 (18:44 +0000)]
Add vstore_half_rtp implementation

Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324375

6 years agoAdd vstore_half_rtn implementation
Jan Vesely [Tue, 6 Feb 2018 18:44:45 +0000 (18:44 +0000)]
Add vstore_half_rtn implementation

Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324374

6 years agoAdd vstore_half_rtz implementation
Jan Vesely [Tue, 6 Feb 2018 18:44:43 +0000 (18:44 +0000)]
Add vstore_half_rtz implementation

Passes CTS on carrizo

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324373

6 years agovstore_half: Consolidate declarations
Jan Vesely [Tue, 6 Feb 2018 18:44:41 +0000 (18:44 +0000)]
vstore_half: Consolidate declarations

Add support for rounding suffix

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324372

6 years agovstore_half: Add support for custom rounding functions
Jan Vesely [Tue, 6 Feb 2018 18:44:39 +0000 (18:44 +0000)]
vstore_half: Add support for custom rounding functions

Add another layer of indirection
This will be used for specific rounding modes

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324371

6 years agovstore_half: Make sure the helper function is always inline
Jan Vesely [Tue, 6 Feb 2018 18:44:35 +0000 (18:44 +0000)]
vstore_half: Make sure the helper function is always inline

Reviewer: Jeroen Ketema <j.ketema@xs4all.nl>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 324370

6 years ago[InstCombine][ValueTracking] Match non-uniform constant power-of-two vectors
Simon Pilgrim [Tue, 6 Feb 2018 18:39:23 +0000 (18:39 +0000)]
[InstCombine][ValueTracking] Match non-uniform constant power-of-two vectors

Generalize existing constant matching to work with non-uniform constant vectors as well.

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

llvm-svn: 324369

6 years agoBuild each testcase variant in its own subdirectory and remove the srcdir lock file
Adrian Prantl [Tue, 6 Feb 2018 18:22:51 +0000 (18:22 +0000)]
Build each testcase variant in its own subdirectory and remove the srcdir lock file
This patch creates a <test>.dwarf, <test>.dwo, etc., build directory for each testcase variant.
Most importantly, this eliminates the need for the per-test lock file in the source directory.

Tests that are marked as NO_DEBUG_INFO_TESTCASE and build with
buildDefault() are built in a <test>.default build directory.

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

llvm-svn: 324368

6 years ago[X86] Auto-generate checks. NFC
Craig Topper [Tue, 6 Feb 2018 18:18:49 +0000 (18:18 +0000)]
[X86] Auto-generate checks. NFC

llvm-svn: 324367

6 years agoHide the --full-shutdown option.
Rafael Espindola [Tue, 6 Feb 2018 18:12:41 +0000 (18:12 +0000)]
Hide the --full-shutdown option.

llvm-svn: 324365

6 years ago[clang-format] Add more tests for Objective-C 2.0 generic alignment
Ben Hamilton [Tue, 6 Feb 2018 18:01:47 +0000 (18:01 +0000)]
[clang-format] Add more tests for Objective-C 2.0 generic alignment

Summary:
In r236412, @djasper added a comment:

    // FIXME: We likely want to do this for more combinations of brackets.
    // Verify that it is wanted for ObjC, too.

In D42650, @stephanemoore asked me to confirm this.

This followup to D42650 adds more tests to verify the relative
alignment behavior for Objective-C 2.0 generics passed to functions
and removes the second half of the FIXME comment.

Test Plan:
  make -j12 FormatTests && \
  ./tools/clang/unittests/Format/FormatTests --gtest_filter=FormatTestObjC.\*

Reviewers: stephanemoore, jolesiak, djasper

Reviewed By: jolesiak

Subscribers: klimek, cfe-commits, djasper, stephanemoore, krasimir

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

llvm-svn: 324364

6 years ago[clangd] Fixed a bug in the new threading implementation.
Ilya Biryukov [Tue, 6 Feb 2018 17:22:58 +0000 (17:22 +0000)]
[clangd] Fixed a bug in the new threading implementation.

This should fix the buildbots.

llvm-svn: 324363

6 years ago[analyzer] [tests] Show function name in CmpRuns output
George Karpenkov [Tue, 6 Feb 2018 17:22:09 +0000 (17:22 +0000)]
[analyzer] [tests] Show function name in CmpRuns output

Combined with enabled flag for stable filenames, this greatly simplifies
finding the offending report.

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

llvm-svn: 324362

6 years ago[clangd] Fixed compilation on Windows buildbot.
Ilya Biryukov [Tue, 6 Feb 2018 16:32:36 +0000 (16:32 +0000)]
[clangd] Fixed compilation on Windows buildbot.

llvm-svn: 324361

6 years ago[ARM] f16 conversions
Sjoerd Meijer [Tue, 6 Feb 2018 16:28:43 +0000 (16:28 +0000)]
[ARM] f16 conversions

This is a follow up of r324321, adding f16 <-> f32 and f16 <-> f64 conversion
match patterns.

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

llvm-svn: 324360

6 years ago[DAG, X86] Improve Dependency analysis when doing multi-node
Nirav Dave [Tue, 6 Feb 2018 16:14:29 +0000 (16:14 +0000)]
[DAG, X86] Improve Dependency analysis when doing multi-node
Instruction Selection

Cleanup cycle/validity checks in ISel (IsLegalToFold,
HandleMergeInputChains) and X86 (isFusableLoadOpStore). Now do a full
search for cycles / dependencies pruning the search when topological
property of NodeId allows.

As part of this propogate the NodeId-based cutoffs to narrow
hasPreprocessorHelper searches.

Reviewers: craig.topper, bogner

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 324359

6 years ago[clangd] Use URIs in index symbols.
Eric Liu [Tue, 6 Feb 2018 16:10:35 +0000 (16:10 +0000)]
[clangd] Use URIs in index symbols.

Reviewers: hokein, sammccall

Reviewed By: sammccall

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

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

llvm-svn: 324358

6 years agoRegenerate vector-urem test. NFCI.
Simon Pilgrim [Tue, 6 Feb 2018 16:10:12 +0000 (16:10 +0000)]
Regenerate vector-urem test. NFCI.

llvm-svn: 324357

6 years ago[clangd] The new threading implementation
Ilya Biryukov [Tue, 6 Feb 2018 15:53:42 +0000 (15:53 +0000)]
[clangd] The new threading implementation

Summary:
In the new threading model clangd creates one thread per file to manage
the AST and one thread to process each of the incoming requests.
The number of actively running threads is bounded by the semaphore to
avoid overloading the system.

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 324356

6 years ago[COFF] LTO does not require a disassembler.
Benjamin Kramer [Tue, 6 Feb 2018 15:42:41 +0000 (15:42 +0000)]
[COFF] LTO does not require a disassembler.

llvm-svn: 324355

6 years ago[clangd] Remove unused variable. NFC
Eric Liu [Tue, 6 Feb 2018 15:27:43 +0000 (15:27 +0000)]
[clangd] Remove unused variable. NFC

llvm-svn: 324354

6 years agoAMDGPU: Fix S_BUFFER_LOAD_DWORD_SGPR moveToVALU
Marek Olsak [Tue, 6 Feb 2018 15:17:55 +0000 (15:17 +0000)]
AMDGPU: Fix S_BUFFER_LOAD_DWORD_SGPR moveToVALU

Author: Bas Nieuwenhuizen

https://reviews.llvm.org/D42881

llvm-svn: 324353

6 years ago[Hexagon] Remove leftover assert
Krzysztof Parzyszek [Tue, 6 Feb 2018 15:15:13 +0000 (15:15 +0000)]
[Hexagon] Remove leftover assert

llvm-svn: 324352

6 years ago[clangd] Don't try pthread, just use thread_local. Reverts r323949.
Sam McCall [Tue, 6 Feb 2018 14:25:02 +0000 (14:25 +0000)]
[clangd] Don't try pthread, just use thread_local. Reverts r323949.

The pthread solution here breaks standalone builds, which don't have the
relevant cmake magic for feature-detection.

The original reason for trying pthread was fear of libgcc without
support for thread_local (e.g. on the clang-x86_64-linux-selfhost-modules bot).
However the earliest supported GCC is 4.8, and this has __cxa_thread_atexit.

This will probably break that bot, it's not running a supported GCC and needs
to be upgraded. I'll try to find out how to do this.

llvm-svn: 324351

6 years ago[Hexagon] Split HVX operations on vector pairs
Krzysztof Parzyszek [Tue, 6 Feb 2018 14:24:57 +0000 (14:24 +0000)]
[Hexagon] Split HVX operations on vector pairs

Vector pairs are legal types, but not every operation can work on pairs.
For those operations that are legal for single vectors, generate a concat
of their results on pair halves.

llvm-svn: 324350

6 years ago[Hexagon] Add helper functions to identify single/pair vector types, NFC
Krzysztof Parzyszek [Tue, 6 Feb 2018 14:21:31 +0000 (14:21 +0000)]
[Hexagon] Add helper functions to identify single/pair vector types, NFC

llvm-svn: 324349

6 years ago[Hexagon] Handle lowering of SETCC via setCondCodeAction
Krzysztof Parzyszek [Tue, 6 Feb 2018 14:16:52 +0000 (14:16 +0000)]
[Hexagon] Handle lowering of SETCC via setCondCodeAction

It was expanded directly into instructions earlier. That was to avoid
loads from a constant pool for a vector negation: "xor x, splat(i1 -1)".
Implement ISD opcodes QTRUE and QFALSE to denote logical vectors of
all true and all false values, and handle setcc with negations through
selection patterns.

llvm-svn: 324348

6 years ago[X86][SSE] Add PACKUS support for truncation of clamped values
Simon Pilgrim [Tue, 6 Feb 2018 14:07:46 +0000 (14:07 +0000)]
[X86][SSE] Add PACKUS support for truncation of clamped values

Followup to D42544 that matches PACKUSWB cases for non-AVX512, SSE and PACKUSDW cases will have to wait until we can add support for general SMIN/SMAX matching.

llvm-svn: 324347

6 years ago[AMDGPU] do not generate .AMDGPU.config for amdpal os type
Tim Renouf [Tue, 6 Feb 2018 13:39:38 +0000 (13:39 +0000)]
[AMDGPU] do not generate .AMDGPU.config for amdpal os type

Summary:
Now we generate PAL metadata for the amdpal os type, there is no need to
generate the .AMDGPU.config section.

Reviewers: arsenm, nhaehnle, dstuttard

Subscribers: kzhuravl, wdng, yaxunl, t-tye, llvm-commits

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

Change-Id: I303c5fad66656ce97293da60621afac6595b4c18
llvm-svn: 324346

6 years ago[Solaris] Silence -pthread warning on Solaris
Fedor Sergeev [Tue, 6 Feb 2018 13:21:12 +0000 (13:21 +0000)]
[Solaris] Silence -pthread warning on Solaris

Summary:
During make check-all on Solaris, I see several instances of this warning:

clang-6.0: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]

Since Solaris 10, libpthread has been folded into libc, so there's nothing to do.  gcc
just ignores -pthread here.  Darwin claims the option to silence the warning, and
this patch follows that lead.

Reviewers: rsmith, fedor.sergeev

Reviewed By: fedor.sergeev

Subscribers: cfe-commits, fedor.sergeev

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

llvm-svn: 324344

6 years ago[AArch64][SVE] Asm: Add AND_ZI instructions and aliases
Sander de Smalen [Tue, 6 Feb 2018 13:13:21 +0000 (13:13 +0000)]
[AArch64][SVE] Asm: Add AND_ZI instructions and aliases

Summary: Adds support for the SVE AND instruction with vector and logical-immediate operands, and their corresponding aliases.

Reviewers: fhahn, rengolin, samparker, echristo, aadg, kristof.beyls

Reviewed By: fhahn

Subscribers: aemerson, javed.absar, tschuett, llvm-commits

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

llvm-svn: 324343

6 years agoUnittests misc. typos
Sylvestre Ledru [Tue, 6 Feb 2018 13:12:29 +0000 (13:12 +0000)]
Unittests misc. typos

By luz.paz

llvm-svn: 324342

6 years ago[MergeICmps] Handle chains with several complex BCE basic blocks.
Clement Courbet [Tue, 6 Feb 2018 12:25:33 +0000 (12:25 +0000)]
[MergeICmps] Handle chains with several complex BCE basic blocks.

 - Fix condition for detecting that a complex basic block was the first in
   the chain.
 - Add tests.

This was caught by buildbots when submitting rL324319.

llvm-svn: 324341

6 years ago[ELF] - Re-commit r324322 "Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOpti...
George Rimar [Tue, 6 Feb 2018 12:20:05 +0000 (12:20 +0000)]
[ELF] - Re-commit r324322 "Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.".

With fix:
Keep logic that ignores -plugin-opt=mcpu=x86-64 -plugin-opt=thinlto,
add checks for those to testcases.

Original commit message:

[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.

gold plugin uses InitTargetOptionsFromCodeGenFlags +
ParseCommandLineOptions for parsing LTO options.
Patch do the same change for LLD.

Such change helps to avoid parsing/whitelisting LTO
plugin options again on linker side, what can help LLD
to automatically support new -plugin-opt=xxx options
passed.

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

llvm-svn: 324340

6 years ago[X86][SSE] Add PACKSS support for truncation of clamped values
Simon Pilgrim [Tue, 6 Feb 2018 12:16:10 +0000 (12:16 +0000)]
[X86][SSE] Add PACKSS support for truncation of clamped values

Followup to D42544 that matches PACKSSWB cases for non-AVX512, SSE and PACKSSDW cases will have to wait until we can add support for general SMIN/SMAX matching.

llvm-svn: 324339

6 years agoTest commit - fixing a comment.
Jacek Olesiak [Tue, 6 Feb 2018 12:12:00 +0000 (12:12 +0000)]
Test commit - fixing a comment.

Summary: A test commit.

Reviewers: krasimir, benhamilton

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 324338

6 years ago[clang-format] Adds space around angle brackets in text protos
Krasimir Georgiev [Tue, 6 Feb 2018 11:34:34 +0000 (11:34 +0000)]
[clang-format] Adds space around angle brackets in text protos

Summary:
This patch adds spaces around angle brackets in text proto Google style.
Previously these were detected as template openers and closers, which happened
to have the expected effect. Now we detect them as scope openers and closers
similarly to the way braces are handled in this context.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 324337

6 years ago[PowerPC] fix up in rL324229, NFC
Hiroshi Inoue [Tue, 6 Feb 2018 11:34:16 +0000 (11:34 +0000)]
[PowerPC] fix up in rL324229, NFC

This patch fixes up my previous commit (add initialization of local variables).

llvm-svn: 324336

6 years ago[DeadArgumentElim] Set pointer to DISubprogram before calling RAUW. NFC
Petar Jovanovic [Tue, 6 Feb 2018 11:11:28 +0000 (11:11 +0000)]
[DeadArgumentElim] Set pointer to DISubprogram before calling RAUW. NFC

It is better to update pointer of the DISuprogram before we call RAUW for
still live arguments of the function, because with the change reviewed in
D42541 in RAUW we compare DISubprograms rather than functions itself.

Patch by Djordje Todorovic.

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

llvm-svn: 324335

6 years ago[clangd] Cut input-mirror.test down to size. NFC
Sam McCall [Tue, 6 Feb 2018 10:51:22 +0000 (10:51 +0000)]
[clangd] Cut input-mirror.test down to size. NFC

llvm-svn: 324334

6 years ago[clangd] Support simpler JSON-RPC stream parsing for lit tests.
Sam McCall [Tue, 6 Feb 2018 10:47:30 +0000 (10:47 +0000)]
[clangd] Support simpler JSON-RPC stream parsing for lit tests.

Summary:
Instead of content-length, we delimit messages with ---.
This also removes the need for (most) dos-formatted test files.

Reviewers: ioeric

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

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

llvm-svn: 324333

6 years agoRevert r324322 "[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions...
George Rimar [Tue, 6 Feb 2018 10:31:01 +0000 (10:31 +0000)]
Revert r324322 "[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options."

It broke BB:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/8162

llvm-svn: 324332

6 years agoFix unused variable warning in release mode. NFC.
Alexander Ivchenko [Tue, 6 Feb 2018 09:53:02 +0000 (09:53 +0000)]
Fix unused variable warning in release mode. NFC.

llvm-svn: 324330