platform/upstream/llvm.git
6 years agoRevert 344389 "Revert r344375 "[Driver] check for exit code from SIGPIPE""
Nick Desaulniers [Mon, 15 Oct 2018 17:39:00 +0000 (17:39 +0000)]
Revert 344389 "Revert r344375 "[Driver] check for exit code from SIGPIPE""

Summary:
Add preprocessor guards for UNIX.

This reverts commit r344389.

Reviewers: rnk, majnemer, jfb

Reviewed By: rnk

Subscribers: cfe-commits, pirama, srhines

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

llvm-svn: 344536

6 years agoWrap up the new chrono literals in an #ifdef so that old versions of clang don't...
Marshall Clow [Mon, 15 Oct 2018 17:33:20 +0000 (17:33 +0000)]
Wrap up the new chrono literals in an #ifdef so that old versions of clang don't complain. I'm looking at you, clang 5.0.1

llvm-svn: 344535

6 years ago[DAGCombiner] allow undef elts in vector fmul matching
Sanjay Patel [Mon, 15 Oct 2018 16:54:07 +0000 (16:54 +0000)]
[DAGCombiner] allow undef elts in vector fmul matching

llvm-svn: 344534

6 years ago[clangd] Revert include path change in Dexp. NFC
Sam McCall [Mon, 15 Oct 2018 16:47:45 +0000 (16:47 +0000)]
[clangd] Revert include path change in Dexp. NFC

llvm-svn: 344533

6 years ago[DAGCombiner] refactor folds for fadd (fmul X, -2.0), Y; NFCI
Sanjay Patel [Mon, 15 Oct 2018 16:47:01 +0000 (16:47 +0000)]
[DAGCombiner] refactor folds for fadd (fmul X, -2.0), Y; NFCI

The transform doesn't work if the vector constant has undef elements.

llvm-svn: 344532

6 years ago[AArch64] add tests for fmul x, -2.0 with undef elts; NFC
Sanjay Patel [Mon, 15 Oct 2018 16:44:00 +0000 (16:44 +0000)]
[AArch64] add tests for fmul x, -2.0 with undef elts; NFC

Also, add tests with commuted operands. There was no coverage for that case.

llvm-svn: 344531

6 years ago[Fixed Point Arithmetic] FixedPointCast
Leonard Chan [Mon, 15 Oct 2018 16:07:02 +0000 (16:07 +0000)]
[Fixed Point Arithmetic] FixedPointCast

This patch is a part of https://reviews.llvm.org/D48456 in an attempt to
split them up. This contains the code for casting between fixed point types
and other fixed point types.

The method for converting between fixed point types is based off the convert()
method in APFixedPoint.

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

llvm-svn: 344530

6 years agoImplement the first part of the calendar support for C++20. This is still incomplete...
Marshall Clow [Mon, 15 Oct 2018 16:06:37 +0000 (16:06 +0000)]
Implement the first part of the calendar support for C++20. This is still incomplete; there will be more patches coming. Reviewed as D51762

llvm-svn: 344529

6 years ago[DAGCombiner] allow undef elts in vector fma matching
Sanjay Patel [Mon, 15 Oct 2018 15:56:39 +0000 (15:56 +0000)]
[DAGCombiner] allow undef elts in vector fma matching

llvm-svn: 344528

6 years ago[x86] add tests for fma with undef elts; NFC
Sanjay Patel [Mon, 15 Oct 2018 15:47:37 +0000 (15:47 +0000)]
[x86] add tests for fma with undef elts; NFC

llvm-svn: 344527

6 years agoRevert "[CodeGenCXX] Treat 'this' as noalias in constructors"
Sean Fertile [Mon, 15 Oct 2018 15:43:00 +0000 (15:43 +0000)]
Revert "[CodeGenCXX] Treat 'this' as noalias in constructors"

This reverts commit https://reviews.llvm.org/rL344150 which causes
MachineOutliner related failures on the ppc64le multistage buildbot.

llvm-svn: 344526

6 years ago[DAGCombiner] allow undef elts in vector fma matching
Sanjay Patel [Mon, 15 Oct 2018 15:38:38 +0000 (15:38 +0000)]
[DAGCombiner] allow undef elts in vector fma matching

llvm-svn: 344525

6 years agoRevert "[NewPM] teach -passes= to emit meaningful error messages"
Fedor Sergeev [Mon, 15 Oct 2018 15:36:08 +0000 (15:36 +0000)]
Revert "[NewPM] teach -passes= to emit meaningful error messages"

This reverts r344519 due to failures in pipeline-parsing test.

llvm-svn: 344524

6 years ago[x86] add tests for fma with undef elts; NFC
Sanjay Patel [Mon, 15 Oct 2018 15:28:44 +0000 (15:28 +0000)]
[x86] add tests for fma with undef elts; NFC

llvm-svn: 344523

6 years ago[ADT] Adds equality operators for DenseMap and DenseSet, and an initializer_list
Lang Hames [Mon, 15 Oct 2018 15:26:47 +0000 (15:26 +0000)]
[ADT] Adds equality operators for DenseMap and DenseSet, and an initializer_list
constructor for DenseMap (DenseSet already had an initializer_list constructor).

These changes make it easier to migrate existing code that uses std::map and
std::set (which support initializer_list construction and equality comparison)
to DenseMap and DenseSet.

llvm-svn: 344522

6 years ago[clangd] Add createIndex in dexp
Haojian Wu [Mon, 15 Oct 2018 15:12:40 +0000 (15:12 +0000)]
[clangd] Add createIndex in dexp

Summary:
This would allow easily injecting our internal customization.

Also updates the stale "symbol-collection-file" flag.

Reviewers: sammccall

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 344521

6 years ago[clangd] Use SyncAPI in more places in tests. NFC
Sam McCall [Mon, 15 Oct 2018 15:04:03 +0000 (15:04 +0000)]
[clangd] Use SyncAPI in more places in tests. NFC

llvm-svn: 344520

6 years ago[NewPM] teach -passes= to emit meaningful error messages
Fedor Sergeev [Mon, 15 Oct 2018 15:00:18 +0000 (15:00 +0000)]
[NewPM] teach -passes= to emit meaningful error messages

Summary:
All the PassBuilder::parse interfaces now return descriptive StringError
instead of a plain bool. It allows to make -passes/aa-pipeline parsing
errors context-specific and thus less confusing.

TODO: ideally we should also make suggestions for misspelled pass names,
but that requires some extensions to PassBuilder.

Reviewed By: philip.pfaffe, chandlerc
Differential Revision: https://reviews.llvm.org/D53246

llvm-svn: 344519

6 years ago[ELF][HEXAGON] Let input determine e_flag.
Sid Manning [Mon, 15 Oct 2018 14:44:52 +0000 (14:44 +0000)]
[ELF][HEXAGON] Let input determine e_flag.

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

llvm-svn: 344518

6 years ago[mips][micromips] Fix overlaping FDEs error
Aleksandar Beserminji [Mon, 15 Oct 2018 14:39:12 +0000 (14:39 +0000)]
[mips][micromips] Fix overlaping FDEs error

When compiling static executable for micromips, CFI symbols
are incorrectly labeled as MICROMIPS, which cause
".eh_frame_hdr refers to overlapping FDEs." error.

This patch does not label CFI symbols as MICROMIPS, and FDEs do not
overlap anymore. This patch also exposes another bug, which is fixed
here: https://reviews.llvm.org/D52985

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

llvm-svn: 344516

6 years ago[mips][micromips] Revert "Fix overlaping FDEs error"
Aleksandar Beserminji [Mon, 15 Oct 2018 14:36:48 +0000 (14:36 +0000)]
[mips][micromips] Revert "Fix overlaping FDEs error"

This reverts r344511.

llvm-svn: 344515

6 years ago[LLD][ELF] - Check options before processing the -v/-version options.
George Rimar [Mon, 15 Oct 2018 14:21:43 +0000 (14:21 +0000)]
[LLD][ELF] - Check options before processing the -v/-version options.

This is https://bugs.llvm.org/show_bug.cgi?id=39289.

Currently both gold and bfd report errors about invalid options values
even with -v/-versions. But LLD does not.

This makes complicated to check the options available when LLD is used.

Patch makes LLD behavior to be consistent with GNU linkers.

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

llvm-svn: 344514

6 years ago[clangd] Minimal implementation of automatic static index (not enabled).
Sam McCall [Mon, 15 Oct 2018 13:34:10 +0000 (13:34 +0000)]
[clangd] Minimal implementation of automatic static index (not enabled).

Summary:
See tinyurl.com/clangd-automatic-index for design and goals.

Lots of limitations to keep this patch smallish, TODOs everywhere:
 - no serialization to disk
 - no changes to dynamic index, which now has a much simpler job
 - no partitioning of symbols by file to avoid duplication of header symbols
 - no reindexing of edited files
 - only a single worker thread
 - compilation database is slurped synchronously (doesn't scale)
 - uses memindex, rebuilds after every file (should be dex, periodically)

It's not hooked up to ClangdServer/ClangdLSPServer yet: the layering
isn't clear (it should really be in ClangdServer, but ClangdLSPServer
has all the CDB interactions).

Reviewers: ioeric

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits

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

llvm-svn: 344513

6 years ago[ARM][NEON] Improve vector popcnt lowering with PADDL (PR39281)
Simon Pilgrim [Mon, 15 Oct 2018 13:20:41 +0000 (13:20 +0000)]
[ARM][NEON] Improve vector popcnt lowering with PADDL (PR39281)

As I suggested on PR39281, this patch uses PADDL pairwise addition to widen from the vXi8 CTPOP result to the target vector type.

This is a blocker for moving more x86 code to generic vector CTPOP expansion (P32655 + D53258) - ARM's vXi64 CTPOP currently expands, which would generate a vXi64 MUL but ARM's custom lowering expands the general MUL case and vectors aren't well handled in LegalizeDAG - improving the CTPOP lowering was a lot easier than fixing the MUL lowering for this one case......

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

llvm-svn: 344512

6 years ago[mips][micromips] Fix overlaping FDEs error
Aleksandar Beserminji [Mon, 15 Oct 2018 12:59:17 +0000 (12:59 +0000)]
[mips][micromips] Fix overlaping FDEs error

When compiling static executable for micromips, CFI symbols
are incorrectly labeled as MICROMIPS, which cause
".eh_frame_hdr refers to overlapping FDEs." error.

This patch does not label CFI symbols as MICROMIPS, and FDEs do not
overlap anymore. This patch also exposes another bug, which is fixed
here: https://reviews.llvm.org/D52985

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

llvm-svn: 344511

6 years ago[clangd] Remove an unused include header, NFC.
Haojian Wu [Mon, 15 Oct 2018 12:39:45 +0000 (12:39 +0000)]
[clangd] Remove an unused include header, NFC.

llvm-svn: 344510

6 years ago[CodeComplete] Make sure keyword 'template' is added even when code pattern is disabled.
Eric Liu [Mon, 15 Oct 2018 12:37:23 +0000 (12:37 +0000)]
[CodeComplete] Make sure keyword 'template' is added even when code pattern is disabled.

Reviewers: sammccall, hokein

Subscribers: arphaman, cfe-commits

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

llvm-svn: 344509

6 years ago[clangd] dump xrefs information in dexp tool.
Haojian Wu [Mon, 15 Oct 2018 12:32:49 +0000 (12:32 +0000)]
[clangd] dump xrefs information in dexp tool.

Reviewers: sammccall

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 344508

6 years ago[clangd] Fix some references missing in dynamic index.
Haojian Wu [Mon, 15 Oct 2018 11:46:26 +0000 (11:46 +0000)]
[clangd] Fix some references missing in dynamic index.

Summary:
Previously, SymbolCollector postfilters all references at the end to
find all references of interesting symbols.
It was incorrect when indxing main AST where we don't see locations
of symbol declarations and definitions in the main AST (as those are in
preamble AST).

The fix is to do earily check during collecting references.

Reviewers: sammccall

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 344507

6 years agoAMDGPU: Test showing a scalar buffer load deficiency
Nicolai Haehnle [Mon, 15 Oct 2018 11:37:04 +0000 (11:37 +0000)]
AMDGPU: Test showing a scalar buffer load deficiency

Change-Id: I5b64a565f22a8482aa0712488d85e45163ac3d12
llvm-svn: 344506

6 years ago[NewPM] implement SCC printing for -print-before-all/-print-after-all
Fedor Sergeev [Mon, 15 Oct 2018 10:46:35 +0000 (10:46 +0000)]
[NewPM] implement SCC printing for -print-before-all/-print-after-all

Removing deficiency of initial implementation of -print-before-all/-after-all
- it was effectively skipping IR printing for all the SCC passes.

Now LazyCallGraph:SCC gets its IR printed.

Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D53270

llvm-svn: 344505

6 years ago[TI removal] Make `getTerminator()` return a generic `Instruction`.
Chandler Carruth [Mon, 15 Oct 2018 10:42:50 +0000 (10:42 +0000)]
[TI removal] Make `getTerminator()` return a generic `Instruction`.

This removes the primary remaining API producing `TerminatorInst` which
will reduce the rate at which code is introduced trying to use it and
generally make it much easier to remove the remaining APIs across the
codebase.

Also clean up some of the stragglers that the previous mechanical update
of variables missed.

Users of LLVM and out-of-tree code generally will need to update any
explicit variable types to handle this. Replacing `TerminatorInst` with
`Instruction` (or `auto`) almost always works. Most of these edits were
made in prior commits using the perl one-liner:
```
perl -i -ple 's/TerminatorInst(\b.* = .*getTerminator\(\))/Instruction\1/g'
```

This also my break some rare use cases where people overload for both
`Instruction` and `TerminatorInst`, but these should be easily fixed by
removing the `TerminatorInst` overload.

llvm-svn: 344504

6 years ago[TI removal] Rework `InstVisitor` to support visiting instructions that
Chandler Carruth [Mon, 15 Oct 2018 10:10:54 +0000 (10:10 +0000)]
[TI removal] Rework `InstVisitor` to support visiting instructions that
are terminators without relying on the specific `TerminatorInst` type.

This required cleaning up two users of `InstVisitor`s usage of
`TerminatorInst` as well.

llvm-svn: 344503

6 years ago[TI removal] Make variables declared as `TerminatorInst` and initialized
Chandler Carruth [Mon, 15 Oct 2018 10:04:59 +0000 (10:04 +0000)]
[TI removal] Make variables declared as `TerminatorInst` and initialized
by `getTerminator()` calls instead be declared as `Instruction`.

This is the biggest remaining chunk of the usage of `getTerminator()`
that insists on the narrow type and so is an easy batch of updates.
Several files saw more extensive updates where this would cascade to
requiring API updates within the file to use `Instruction` instead of
`TerminatorInst`. All of these were trivial in nature (pervasively using
`Instruction` instead just worked).

llvm-svn: 344502

6 years ago[TI removal] Remove `TerminatorInst` from GVN.h and GVN.cpp.
Chandler Carruth [Mon, 15 Oct 2018 10:00:15 +0000 (10:00 +0000)]
[TI removal] Remove `TerminatorInst` from GVN.h and GVN.cpp.

This is the last interesting usage in all of LLVM's headers. The
remaining usages in headers are the core typesystem bits (Core.h,
instruction types, and InstVisitor) and as the return of
`BasicBlock::getTerminator`. The latter is the big remaining API point
that I'll remove after mass updates to user code.

llvm-svn: 344501

6 years ago[TI removal] Remove `TerminatorInst` from SparsePropagation.h and
Chandler Carruth [Mon, 15 Oct 2018 09:47:26 +0000 (09:47 +0000)]
[TI removal] Remove `TerminatorInst` from SparsePropagation.h and
related code.

This is simple as we just need to replace the type and move to the
concept of visiting a "terminator" rather than a specific instruction
subclass.

llvm-svn: 344500

6 years ago[TI removal] Remove a dead forward declaration of TerminatorInst. NFC.
Chandler Carruth [Mon, 15 Oct 2018 09:34:31 +0000 (09:34 +0000)]
[TI removal] Remove a dead forward declaration of TerminatorInst. NFC.

llvm-svn: 344499

6 years ago[TI removal] Remove `TerminatorInst` from BasicBlockUtils.h
Chandler Carruth [Mon, 15 Oct 2018 09:34:05 +0000 (09:34 +0000)]
[TI removal] Remove `TerminatorInst` from BasicBlockUtils.h

This requires updating a number of .cpp files to adapt to the new API.
I've just systematically updated all uses of `TerminatorInst` within
these files te `Instruction` so thta I won't have to touch them again in
the future.

llvm-svn: 344498

6 years ago[TI removal] Just use Instruction in the CFG printer code. NFC.
Chandler Carruth [Mon, 15 Oct 2018 09:33:40 +0000 (09:33 +0000)]
[TI removal] Just use Instruction in the CFG printer code. NFC.

llvm-svn: 344497

6 years ago[llvm-exegesis] Fix missing std::move.
Guillaume Chatelet [Mon, 15 Oct 2018 09:21:21 +0000 (09:21 +0000)]
[llvm-exegesis] Fix missing std::move.

llvm-svn: 344496

6 years ago[TI removal] Remove a unnecessary use of `TerminatorInst` from an IR
Chandler Carruth [Mon, 15 Oct 2018 09:17:38 +0000 (09:17 +0000)]
[TI removal] Remove a unnecessary use of `TerminatorInst` from an IR
header. NFC.

Part of the removal of `TerminatorInst` from the type hierarchy.

llvm-svn: 344495

6 years ago[TI removal] Remove TerminatorInst as an input parameter from all public
Chandler Carruth [Mon, 15 Oct 2018 09:17:09 +0000 (09:17 +0000)]
[TI removal] Remove TerminatorInst as an input parameter from all public
LLVM APIs. There weren't very many.

We still have the instruction visitor, and APIs with TerminatorInst as
a return type or an output parameter.

llvm-svn: 344494

6 years ago[llvm-exegesis][NFC] Return many CodeTemplates instead of one.
Guillaume Chatelet [Mon, 15 Oct 2018 09:09:19 +0000 (09:09 +0000)]
[llvm-exegesis][NFC] Return many CodeTemplates instead of one.

Summary: This is part one of the change where I simply changed the signature of the functions. More work need to be done to actually produce more than one CodeTemplate per instruction.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 344493

6 years ago[TwoAddressInstructionPass] Replace subregister uses when processing tied operands
Bjorn Pettersson [Mon, 15 Oct 2018 08:36:03 +0000 (08:36 +0000)]
[TwoAddressInstructionPass] Replace subregister uses when processing tied operands

Summary:
TwoAddressInstruction pass typically rewrites
  %1:short = foo %0.sub_lo:long
as
  %1:short = COPY %0.sub_lo:long
  %1:short = foo %1:short
when having tied operands.

If there are extra un-tied operands that uses the same reg and
subreg, such as the second and third inputs to fie here:
  %1:short = fie %0.sub_lo:long, %0.sub_hi:long, %0.sub_lo:long
then there was a bug which replaced the register %0 also for
the un-tied operand, but without changing the subregister indices.
So we used to get:
  %1:short = COPY %0.sub_lo:long
  %1:short = fie %1, %1.sub_hi:short, %1.sub_lo:short
With this fix we instead get:
  %1:short = COPY %0.sub_lo:long
  %1:short = fie %1, %0.sub_hi:long, %1

Reviewers: arsenm, JesperAntonsson, kparzysz, MatzeB

Reviewed By: MatzeB

Subscribers: bjope, kparzysz, wdng, llvm-commits

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

llvm-svn: 344492

6 years ago[X86] Autogenerate checks. NFC
Craig Topper [Mon, 15 Oct 2018 05:31:24 +0000 (05:31 +0000)]
[X86] Autogenerate checks. NFC

llvm-svn: 344490

6 years ago[ORC] Simplify naming for JITDylib definition generators.
Lang Hames [Mon, 15 Oct 2018 05:07:54 +0000 (05:07 +0000)]
[ORC] Simplify naming for JITDylib definition generators.

Renames:
  JITDylib's setFallbackDefinitionGenerator method to setGenerator.
  DynamicLibraryFallbackGenerator class to DynamicLibrarySearchGenerator.
  ReexportsFallbackDefinitionGenerator to ReexportsGenerator.

llvm-svn: 344489

6 years ago[XRay][compiler-rt] FDR Mode Controller
Dean Michael Berris [Mon, 15 Oct 2018 02:57:06 +0000 (02:57 +0000)]
[XRay][compiler-rt] FDR Mode Controller

Summary:
This change implements a controller for abstracting away the details of
what happens when tracing with FDR mode. This controller type allows us
to test in isolation the various cases where we're encountering function
entry, exit, and other kinds of events we are handling when FDR mode is
enabled.

This change introduces a number of testing facilities we've needed to
better support expressing the conditions we need for the unit tests. We
leave some TODOs for moving those utilities into the LLVM project,
sitting in the `Testing` library, to make matching conditions on XRay
`Trace` instances through googlemock more manageable and declarative.

We don't wire in the controller right away, to allow us to incrementally
update the implementation(s) as we increase testing coverage of the
controller type. There's a need to re-think the way we're managing
buffers in a multi-threaded environment, which is more invasive than
this implementation.

This step in the process allows us to encode our assumptions in the
implementation of the controller, and then evolve the buffer queue
implementation to support generational buffer management to ensure we
can continue to support the cases we're already supporting with the
controller.

Reviewers: mboerger, eizan

Subscribers: mgorny, llvm-commits, jfb

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

llvm-svn: 344488

6 years ago[X86] Move promotion of vector and/or/xor from legalization to DAG combine
Craig Topper [Mon, 15 Oct 2018 01:51:58 +0000 (01:51 +0000)]
[X86] Move promotion of vector and/or/xor from legalization to DAG combine

Summary:
I've noticed that the bitcasts we introduce for these make computeKnownBits and computeNumSignBits not work well in LegalizeVectorOps. LegalizeVectorOps legalizes bottom up while LegalizeDAG legalizes top down. The bottom up strategy for LegalizeVectorOps means operands are legalized before their uses. So we promote and/or/xor before we legalize the operands that use them making computeKnownBits/computeNumSignBits in places like LowerTruncate suboptimal. I looked at changing LegalizeVectorOps to be top down as well, but that was more disruptive and caused some regressions. I also looked at just moving promotion of binops to LegalizeDAG, but that had a few issues one around matching AND,ANDN,OR into VSELECT because I had to create ANDN as vXi64, but the other nodes hadn't legalized yet, I didn't look too hard at fixing that.

This patch seems to produce better results overall than my other attempts. We now form broadcasts of constants better in some cases. For at least some of them the AND was being introduced in LegalizeDAG, promoted to vXi64, and the BUILD_VECTOR was also legalized there. I think we got bad ordering of that. Now the promotion is out of the legalizer so we handle this better.

In the longer term I think we really should evaluate whether we should be doing this promotion at all. It's really there to reduce isel pattern count, but I'm wondering if we'd be better served just eating the pattern cost or doing C++ based isel for vector and/or/xor in X86ISelDAGToDAG. The masked and/or/xor will definitely be difficult in patterns if a bitcast gets between the vselect and the and/or/xor node. That becomes a lot of permutations to cover.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 344487

6 years ago[X86] Add 128 MOVDDUP to the constant pool printing in X86AsmPrinter::EmitInstruction.
Craig Topper [Mon, 15 Oct 2018 01:51:53 +0000 (01:51 +0000)]
[X86] Add 128 MOVDDUP to the constant pool printing in X86AsmPrinter::EmitInstruction.

We use this instruction to broadcast a single 64-bit value to a v2i64/v2f64 vector.

llvm-svn: 344486

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Mon, 15 Oct 2018 01:51:50 +0000 (01:51 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 344485

6 years ago[InstCombine] Add PR27343 test cases
Simon Pilgrim [Sun, 14 Oct 2018 20:14:33 +0000 (20:14 +0000)]
[InstCombine] Add PR27343 test cases

llvm-svn: 344484

6 years ago[LV] Fix comments reported when not vectorizing single iteration loops; NFC
Ayal Zaks [Sun, 14 Oct 2018 17:53:02 +0000 (17:53 +0000)]
[LV] Fix comments reported when not vectorizing single iteration loops; NFC

Landing this as a separate part of https://reviews.llvm.org/D50480, being a
seemingly unrelated change ([LV] Vectorizing loops of arbitrary trip count
without remainder under opt for size).

llvm-svn: 344483

6 years ago[Hexagon] Update tests account for non-hardcoded linker name.
Sid Manning [Sun, 14 Oct 2018 17:51:36 +0000 (17:51 +0000)]
[Hexagon] Update tests account for non-hardcoded linker name.

Tests should not assume the linker's name, CLANG_DEFAULT_LINKER could
change it.

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

llvm-svn: 344482

6 years ago[X86][AVX] Enable lowerVectorShuffleAsLanePermuteAndPermute v16i16/v32i8 shuffle...
Simon Pilgrim [Sun, 14 Oct 2018 17:34:20 +0000 (17:34 +0000)]
[X86][AVX] Enable lowerVectorShuffleAsLanePermuteAndPermute v16i16/v32i8 shuffle lowering

Extends D53148 from v4f64 now that we have test coverage for v16i16/v32i8 shuffles.

llvm-svn: 344481

6 years ago[libfuzzer][Windows] Silence linker warning in unittest
Jonathan Metzman [Sun, 14 Oct 2018 17:07:40 +0000 (17:07 +0000)]
[libfuzzer][Windows] Silence linker warning in unittest

Summary:
Silence warning when linking unittest binary by not passing
-lstdc++ to the linker since it is ignored.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: mgorny

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

llvm-svn: 344480

6 years ago[ARM] Regenerate cttz tests
Simon Pilgrim [Sun, 14 Oct 2018 16:49:04 +0000 (16:49 +0000)]
[ARM] Regenerate cttz tests

Improve codegen view as part of PR32655

llvm-svn: 344479

6 years ago[ORC] Remove XXLayer::add methods that default to using the main JITDylib.
Lang Hames [Sun, 14 Oct 2018 16:09:59 +0000 (16:09 +0000)]
[ORC] Remove XXLayer::add methods that default to using the main JITDylib.

They're not currently used and may complicate upcoming changes to add's
signature and behavior.

llvm-svn: 344478

6 years ago[LegalizeDAG] Don't bother with final MUL+SRL stage for byte CTPOP.
Simon Pilgrim [Sun, 14 Oct 2018 15:56:28 +0000 (15:56 +0000)]
[LegalizeDAG] Don't bother with final MUL+SRL stage for byte CTPOP.

The final stage of CTPOP expansion (v = (v * 0x01010101...) >> (Len - 8)) is completely pointless for the byte (Len = 8) case as it reduces to (v = (v * 0x01...) >> 0), but annoyingly this doesn't always get optimized away.

Found while investigating generic vector CTPOP expansion (PR32655).

llvm-svn: 344477

6 years ago[InstCombine] combine a shuffle and an extract subvector shuffle
Sanjay Patel [Sun, 14 Oct 2018 15:25:06 +0000 (15:25 +0000)]
[InstCombine] combine a shuffle and an extract subvector shuffle

This is part of the missing IR-level folding noted in D52912.
This should be ok as a canonicalization because the new shuffle mask can't
be any more complicated than the existing shuffle mask. If there's some
target where the shorter vector shuffle is not legal, it should just end up
expanding to something like the pair of shuffles that we're starting with here.

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

llvm-svn: 344476

6 years agorecommit 344472 after fixing build failure on ARM and PPC.
Dorit Nuzman [Sun, 14 Oct 2018 08:50:06 +0000 (08:50 +0000)]
recommit 344472 after fixing build failure on ARM and PPC.

llvm-svn: 344475

6 years agoFix double import of _lldb module.
Vadim Chugunov [Sun, 14 Oct 2018 07:24:56 +0000 (07:24 +0000)]
Fix double import of _lldb module.

Fix llvm.org/pr39054:
- Register _lldb as a built-in module during initialization of script interpreter,
- Reverse the order of imports in __init__.py: first try to import by absolute name, which will find the built-in module in the context of lldb (and other hosts that embed liblldb), then try relative import, in case the module is being imported from Python interpreter.

This works for SWIG>=3.0.11; before that, SWIG did not support custom module import code.

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

llvm-svn: 344474

6 years agorevert 344472 due to failures.
Dorit Nuzman [Sun, 14 Oct 2018 07:21:20 +0000 (07:21 +0000)]
revert  344472 due to failures.

llvm-svn: 344473

6 years ago[IAI,LV] Add support for vectorizing predicated strided accesses using masked
Dorit Nuzman [Sun, 14 Oct 2018 07:06:16 +0000 (07:06 +0000)]
[IAI,LV] Add support for vectorizing predicated strided accesses using masked
interleave-group

The vectorizer currently does not attempt to create interleave-groups that
contain predicated loads/stores; predicated strided accesses can currently be
vectorized only using masked gather/scatter or scalarization. This patch makes
predicated loads/stores candidates for forming interleave-groups during the
Loop-Vectorizer's analysis, and adds the proper support for masked-interleave-
groups to the Loop-Vectorizer's planning and transformation stages. The patch
also extends the TTI API to allow querying the cost of masked interleave groups
(which each target can control); Targets that support masked vector loads/
stores may choose to enable this feature and allow vectorizing predicated
strided loads/stores using masked wide loads/stores and shuffles.

Reviewers: Ayal, hsaito, dcaballe, fhahn, javed.absar

Reviewed By: Ayal

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

llvm-svn: 344472

6 years ago[X86] Fix bad indentation. NFC
Craig Topper [Sun, 14 Oct 2018 04:01:40 +0000 (04:01 +0000)]
[X86] Fix bad indentation. NFC

llvm-svn: 344471

6 years ago[X86] Type legalize v2f32 stores by widening to v4f32, casting to v2f64, extracting...
Craig Topper [Sun, 14 Oct 2018 03:36:27 +0000 (03:36 +0000)]
[X86] Type legalize v2f32 stores by widening to v4f32, casting to v2f64, extracting f64 and storing.

Summary: This is similar to what D52528 did for loads. It should match what generic type legalization does in 64-bit mode where it uses a v2i64 cast and an i64 store.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 344470

6 years agoTry harder to fix test/Driver/cl-showfilenames.c
Hans Wennborg [Sat, 13 Oct 2018 22:22:03 +0000 (22:22 +0000)]
Try harder to fix test/Driver/cl-showfilenames.c

Follow-up to r344462.

llvm-svn: 344469

6 years agoMove some helpers from the global namespace into anonymous ones.
Benjamin Kramer [Sat, 13 Oct 2018 22:18:22 +0000 (22:18 +0000)]
Move some helpers from the global namespace into anonymous ones.

llvm-svn: 344468

6 years ago[ORC] During lookup, do not match against hidden symbols in other JITDylibs.
Lang Hames [Sat, 13 Oct 2018 21:53:40 +0000 (21:53 +0000)]
[ORC] During lookup, do not match against hidden symbols in other JITDylibs.

This adds two arguments to the main ExecutionSession::lookup method:
MatchNonExportedInJD, and MatchNonExported. These control whether and where
hidden symbols should be matched when searching a list of JITDylibs.

A similar effect could have been achieved by filtering search results, but
this would have involved materializing symbol definitions (since materialization
is triggered on lookup) only to throw the results away, among other issues.

llvm-svn: 344467

6 years ago[AARCH64] Regenerate popcnt tests
Simon Pilgrim [Sat, 13 Oct 2018 21:50:15 +0000 (21:50 +0000)]
[AARCH64] Regenerate popcnt tests

Improve codegen view as part of PR32655

llvm-svn: 344466

6 years ago[ARM] Regenerate popcnt tests
Simon Pilgrim [Sat, 13 Oct 2018 21:32:49 +0000 (21:32 +0000)]
[ARM] Regenerate popcnt tests

Improve codegen view as part of PR32655

llvm-svn: 344465

6 years ago[analyzer] Improved cmake configuration for Z3
Enrico Steffinlongo [Sat, 13 Oct 2018 19:45:48 +0000 (19:45 +0000)]
[analyzer] Improved cmake configuration for Z3

Summary:
Enhanced support for Z3 in the cmake configuration of clang; now it is possible to specify any arbitrary Z3 install prefix (CLANG_ANALYZER_Z3_PREFIX) to cmake with lib (or bin) and include folders. Before the patch only in cmake default locations
were searched (https://cmake.org/cmake/help/v3.4/command/find_path.html).

Specifying any CLANG_ANALYZER_Z3_PREFIX will force also CLANG_ANALYZER_BUILD_Z3 to ON.

Removed also Z3 4.5 version requirement since it was not checked, and now Clang works with Z3 4.7

Reviewers: NoQ, george.karpenkov, mikhail.ramalho

Reviewed By: george.karpenkov

Subscribers: rnkovacs, NoQ, esteffin, george.karpenkov, delcypher, ddcc, mgorny, xazax.hun, szepet, a.sidorin, Szelethus

Tags: #clang

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

llvm-svn: 344464

6 years ago[analyzer] Small SMT API improvement
Enrico Steffinlongo [Sat, 13 Oct 2018 19:42:10 +0000 (19:42 +0000)]
[analyzer] Small SMT API improvement

Summary: Removed const qualifier from reset method of SMTSolver and Z3Solver objects.

Reviewers: mikhail.ramalho, george.karpenkov, NoQ, ddcc

Reviewed By: NoQ

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus

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

llvm-svn: 344463

6 years agoRe-commit r344234 "clang-cl: Add /showFilenames option (PR31957)"
Hans Wennborg [Sat, 13 Oct 2018 19:13:14 +0000 (19:13 +0000)]
Re-commit r344234 "clang-cl: Add /showFilenames option (PR31957)"

The test was failing on e.g. PPC which can't target Windows. Fix by
requiring X86 target in the test. Also, make sure the output goes to a
temporary directory, since CWD may not be writable.

llvm-svn: 344462

6 years agoPull out repeated variables from SelectionDAGLegalize::ExpandBitCount.
Simon Pilgrim [Sat, 13 Oct 2018 18:40:48 +0000 (18:40 +0000)]
Pull out repeated variables from SelectionDAGLegalize::ExpandBitCount.

The CTPOP case has been changed from VT.getSizeInBits to VT.getScalarSizeInBits - but this fits in with future work for vector support (PR32655) and doesn't affect any current (scalar) uses.

llvm-svn: 344461

6 years ago[LegalizeTypes] Prevent an assertion from PromoteIntRes_BSWAP and PromoteIntRes_BITRE...
Craig Topper [Sat, 13 Oct 2018 17:47:20 +0000 (17:47 +0000)]
[LegalizeTypes] Prevent an assertion from PromoteIntRes_BSWAP and PromoteIntRes_BITREVERSE if the shift amount is too large for the VT returned by getShiftAmountTy

Summary:
getShiftAmountTy for X86 returns MVT::i8. If a BSWAP or BITREVERSE is created that requires promotion and the difference between the original VT and the promoted VT is more than 255 then we won't able to create the constant.

This patch adds a check to replace the result from getShiftAmountTy to MVT::i32 if the difference won't fit. This should get legalized later when the shift is ultimately expanded since its clearly an illegal type that we're only promoting to make it a power of 2 bit width. Alternatively we could base the decision completely on the largest shift amount the promoted VT could use.

Vectors should be immune here because getShiftAmountTy always returns the incoming VT for vectors. Only the scalar shift amount can be changed by the targets.

Reviewers: eli.friedman, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 344460

6 years ago[WebAssembly][NFC] Fix signed/unsigned comparison warning
Thomas Lively [Sat, 13 Oct 2018 16:58:03 +0000 (16:58 +0000)]
[WebAssembly][NFC] Fix signed/unsigned comparison warning

llvm-svn: 344459

6 years ago[InstCombine] fix complexity canonicalization with fake unary vector ops
Sanjay Patel [Sat, 13 Oct 2018 16:15:37 +0000 (16:15 +0000)]
[InstCombine] fix complexity canonicalization with fake unary vector ops

This is a preliminary step to avoid regressions when we add
an actual 'fneg' instruction to IR. See D52934 and D53205.

llvm-svn: 344458

6 years ago[X86][SSE] Remove most of vector CTTZ custom lowering and use LegalizeDAG instead.
Simon Pilgrim [Sat, 13 Oct 2018 16:11:15 +0000 (16:11 +0000)]
[X86][SSE] Remove most of vector CTTZ custom lowering and use LegalizeDAG instead.

There is one remnant - AVX1 custom splitting of 256-bit vectors - which is due to a regression where the X86ISD::ANDNP is still performed as a YMM.

I've also tightened the CTLZ or CTPOP lowering in SelectionDAGLegalize::ExpandBitCount to require a legal CTLZ - it doesn't affect existing users and fixes an issue with AVX512 codegen.

llvm-svn: 344457

6 years ago[InstCombine] add tests for operand complexity canonicalization; NFC
Sanjay Patel [Sat, 13 Oct 2018 16:02:47 +0000 (16:02 +0000)]
[InstCombine] add tests for operand complexity canonicalization; NFC

The tests with undef vector elements demonstrate a hole in
the current pattern matching.

llvm-svn: 344456

6 years ago[NFC] Fixed duplicated test file
David Bolvansky [Sat, 13 Oct 2018 15:26:13 +0000 (15:26 +0000)]
[NFC] Fixed duplicated test file

llvm-svn: 344455

6 years ago[InstCombine] Fixed crash with aliased functions
David Bolvansky [Sat, 13 Oct 2018 15:21:55 +0000 (15:21 +0000)]
[InstCombine] Fixed crash with aliased functions

Summary: Fixes PR39177

Reviewers: spatel, jbuening

Reviewed By: jbuening

Subscribers: jbuening, llvm-commits

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

llvm-svn: 344454

6 years ago[X86][SSE] Begin removing vector CTTZ custom lowering and use LegalizeDAG instead.
Simon Pilgrim [Sat, 13 Oct 2018 15:16:55 +0000 (15:16 +0000)]
[X86][SSE] Begin removing vector CTTZ custom lowering and use LegalizeDAG instead.

Adds CTTZ vector legalization support and begins the removal of the X86/SSE custom lowering.

llvm-svn: 344453

6 years ago[X86][SSE] combineIncDecVector - use isConstantSplat
Simon Pilgrim [Sat, 13 Oct 2018 14:45:44 +0000 (14:45 +0000)]
[X86][SSE] combineIncDecVector - use isConstantSplat

Use isConstantSplat instead of ISD::isConstantSplatVector to let us us peek through to illegal types (in this case for i686 targets to recognise i64 constants)

llvm-svn: 344452

6 years ago[X86] Pull out target constant splat helper function. NFCI.
Simon Pilgrim [Sat, 13 Oct 2018 14:28:40 +0000 (14:28 +0000)]
[X86] Pull out target constant splat helper function. NFCI.

The code in LowerScalarImmediateShift is just a more powerful version of ISD::isConstantSplatVector.

llvm-svn: 344451

6 years agoPull out repeated getOperand(). NFCI.
Simon Pilgrim [Sat, 13 Oct 2018 13:33:32 +0000 (13:33 +0000)]
Pull out repeated getOperand(). NFCI.

llvm-svn: 344450

6 years agoRemove unused variable. NFCI.
Simon Pilgrim [Sat, 13 Oct 2018 13:30:10 +0000 (13:30 +0000)]
Remove unused variable. NFCI.

llvm-svn: 344449

6 years ago[X86][SSE] Improve CTTZ lowering when CTLZ is legal
Simon Pilgrim [Sat, 13 Oct 2018 13:05:19 +0000 (13:05 +0000)]
[X86][SSE] Improve CTTZ lowering when CTLZ is legal

If we have better CTLZ support than CTPOP, then use cttz(x) = width - ctlz(~x & (x - 1)) - and remove the CTTZ_ZERO_UNDEF handling as it no longer gives better codegen.

Similar to rL344447, this is also closer to LegalizeDAG's approach

llvm-svn: 344448

6 years ago[X86][SSE] Change CTTZ vector lowering to cttz(x) = ctpop(~x & (x - 1))
Simon Pilgrim [Sat, 13 Oct 2018 12:12:06 +0000 (12:12 +0000)]
[X86][SSE] Change CTTZ vector lowering to cttz(x) = ctpop(~x & (x - 1))

This patch changes the vector CTTZ lowering from:

cttz(x) = ctpop((x & -x) - 1)

to:

cttz(x) = ctpop(~x & (x - 1))

Not only does this make better use of the PANDN instruction, but it also matches the LegalizeDAG method which should allow us to remove the x86 specific code at some point in the future (we need to fix some issues with the bitcasted logic ops and CTPOP lowering first).

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

llvm-svn: 344447

6 years ago[X86][AVX] Add lowerVectorShuffleAsLanePermuteAndPermute for v4f64 shuffles (PR39161)
Simon Pilgrim [Sat, 13 Oct 2018 11:38:10 +0000 (11:38 +0000)]
[X86][AVX] Add lowerVectorShuffleAsLanePermuteAndPermute for v4f64 shuffles (PR39161)

Add shuffle lowering for the case where we can shuffle the lanes into place followed by an in-lane permute.

This is mainly for cases where we can have non-repeating permutes in each lane, but for now I've just enabled it for v4f64 unary shuffles to fix PR39161 - there is no test coverage for other shuffles that might benefit yet.

We now have several cross-lane shuffle lowering methods that all do something similar - I've looked at merging some of these (notably by making the repeated mask mechanism in lowerVectorShuffleByMerging128BitLanes optional), but there is a lot of assertions/assumptions in the way that makes this tricky - I ended up going for adding yet another relatively simple method instead.

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

llvm-svn: 344446

6 years ago[clang-tidy] Fix for typos in the tests for `bugprone-exception-escape`
Adam Balogh [Sat, 13 Oct 2018 11:17:59 +0000 (11:17 +0000)]
[clang-tidy] Fix for typos in the tests for `bugprone-exception-escape`

llvm-svn: 344445

6 years ago[clang-tidy] Optimize query in bugprone-exception-escape
Adam Balogh [Sat, 13 Oct 2018 10:34:52 +0000 (10:34 +0000)]
[clang-tidy] Optimize query in bugprone-exception-escape

Checking whether a functions throws indirectly may be very expensive because it
needs to visit its whole call graph. Therefore we should first check whether the
function is forbidden to throw and only check whether it throws afterward. This
also seems to solve bug https://bugs.llvm.org/show_bug.cgi?id=39167 where the
execution time is so long that it seems to hang.

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

llvm-svn: 344444

6 years ago[Analyzer] Iterator Checker - Part 10: Tests for iterators passed as parameter
Adam Balogh [Sat, 13 Oct 2018 10:24:48 +0000 (10:24 +0000)]
[Analyzer] Iterator Checker - Part 10: Tests for iterators passed as parameter

In earlier Clang Static Analyzer versions `check::Bind() was not invoked for
parameter passing, so we needed a trick which is not needed anymore. However
add the tests to ensure its working.

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

llvm-svn: 344443

6 years agoRevert "[clang-tidy] New checker for not null-terminated result caused by strlen...
Jonas Toth [Sat, 13 Oct 2018 09:30:58 +0000 (09:30 +0000)]
Revert "[clang-tidy] New checker for not null-terminated result caused by strlen(), size() or equal length"

This reverts commit r344374.

llvm-svn: 344442

6 years agoRevert "[doc] fix markup in clang-tidy bugprone-not-null-terminated-result"
Jonas Toth [Sat, 13 Oct 2018 09:30:46 +0000 (09:30 +0000)]
Revert "[doc] fix markup in clang-tidy bugprone-not-null-terminated-result"

This reverts commit r344379.

llvm-svn: 344441

6 years ago[clang-tidy] add IgnoreMacros option to modernize-use-equals-delete
Miklos Vajna [Sat, 13 Oct 2018 07:58:05 +0000 (07:58 +0000)]
[clang-tidy] add IgnoreMacros option to modernize-use-equals-delete

And also enable it by default to be consistent with e.g. modernize-use-using.
This improves consistency inside the check itself as well: both checks are now
disabled in macros by default.

This helps e.g. when running this check on client code where the macro is
provided by the system, so there is no easy way to modify it.

Reviewed By: alexfh

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

llvm-svn: 344440

6 years ago[AArch64] Swap comparison operands if that enables some folding.
Arnaud A. de Grandmaison [Sat, 13 Oct 2018 07:43:56 +0000 (07:43 +0000)]
[AArch64] Swap comparison operands if that enables some folding.

Summary:
AArch64 can fold some shift+extend operations on the RHS operand of
comparisons, so swap the operands if that makes sense.

This provides a fix for https://bugs.llvm.org/show_bug.cgi?id=38751

Reviewers: efriedma, t.p.northover, javed.absar

Subscribers: mcrosier, kristof.beyls, llvm-commits

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

llvm-svn: 344439

6 years ago[WebAssembly] SIMD min and max
Thomas Lively [Sat, 13 Oct 2018 07:26:10 +0000 (07:26 +0000)]
[WebAssembly] SIMD min and max

Summary: Depends on D52324 and D52764.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 344438

6 years ago[Intrinsic] Add llvm.minimum and llvm.maximum instrinsic functions
Thomas Lively [Sat, 13 Oct 2018 07:21:44 +0000 (07:21 +0000)]
[Intrinsic] Add llvm.minimum and llvm.maximum instrinsic functions

Summary:
These new intrinsics have the semantics of the `minimum` and `maximum`
operations specified by the latest draft of IEEE 754-2018. Unlike
llvm.minnum and llvm.maxnum, these new intrinsics propagate NaNs and
always treat -0.0 as less than 0.0. `minimum` and `maximum` lower
directly to the existing `fminnan` and `fmaxnan` ISel DAG nodes. It is
safe to reuse these DAG nodes because before this patch were only
emitted in situations where there were known to be no NaN arguments or
where NaN propagation was correct and there were known to be no zero
arguments. I know of only four backends that lower fminnan and
fmaxnan: WebAssembly, ARM, AArch64, and SystemZ, and each of these
lowers fminnan and fmaxnan to instructions that are compatible with
the IEEE 754-2018 semantics.

Reviewers: aheejin, dschuff, sunfish, javed.absar

Subscribers: kristof.beyls, dexonsmith, kristina, llvm-commits

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

llvm-svn: 344437

6 years ago[WebAssembly][NFC] Unify ARGUMENT classes
Thomas Lively [Sat, 13 Oct 2018 07:09:10 +0000 (07:09 +0000)]
[WebAssembly][NFC] Unify ARGUMENT classes

Reviewers: aheejin, dschuff

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

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

llvm-svn: 344436

6 years ago[lit] Support the `%shared_libasan` lit substitution on Apple platforms.
Dan Liew [Fri, 12 Oct 2018 23:36:23 +0000 (23:36 +0000)]
[lit] Support the `%shared_libasan` lit substitution on Apple platforms.

Summary:
The previous value looks Linux specific so that has been guarded with
the host OS being Linux.

On Apple platforms `%shared_libasan` expands to the absolute path of the
ASan dylib.

Previously on Linux `%shared_libasan` expanded to just the file name
of the shared library rather than the absolute path to the library.
This is likely a bug because it would rely on the OS's dynamic linker
to find the shared library which could accidentally pick up a system copy
rather than the shared library that was just built.

For other platforms we emit a warning if `config.asan_dynamic` is true.

This patch also only defines the substitution when `config.asan_dynamic`
is true because using this substitution only makes sense when the
dynamic library is available.

Reviewers: kubamracek, george.karpenkov, mgorny, phosek, etienneb, samsonov, kcc

Subscribers: #sanitizers, llvm-commits

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

llvm-svn: 344434