platform/upstream/llvm.git
5 years agoGraphWriter: Provide an API for writing a graph into a specified file
George Karpenkov [Fri, 28 Sep 2018 18:49:01 +0000 (18:49 +0000)]
GraphWriter: Provide an API for writing a graph into a specified file

Always generating a temporary file is not always suitable, especially for tests

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

llvm-svn: 343351

5 years ago[cxx2a] P0614R1: Support init-statements in range-based for loops.
Richard Smith [Fri, 28 Sep 2018 18:44:09 +0000 (18:44 +0000)]
[cxx2a] P0614R1: Support init-statements in range-based for loops.

We don't yet support this for the case where a range-based for loop is
implicitly rewritten to an ObjC for..in statement.

llvm-svn: 343350

5 years ago[DAGCombiner] [NFC] Improve X div/rem 1 fold
David Bolvansky [Fri, 28 Sep 2018 18:40:30 +0000 (18:40 +0000)]
[DAGCombiner] [NFC] Improve X div/rem 1 fold

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 343349

5 years agoClean-up usage of OptionDefinition arrays
Tatyana Krasnukha [Fri, 28 Sep 2018 17:58:16 +0000 (17:58 +0000)]
Clean-up usage of OptionDefinition arrays

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

llvm-svn: 343348

5 years agomake lit builtins a package
Chris Matthews [Fri, 28 Sep 2018 17:55:18 +0000 (17:55 +0000)]
make lit builtins a package

cat.py is not being installed when lit is installed from source. So
tests that use the internal shell fail when using cat.

llvm-svn: 343347

5 years ago[llvm-mca] Add a test for zero-idiom VPERM2F128rr. NFC
Andrea Di Biagio [Fri, 28 Sep 2018 17:47:09 +0000 (17:47 +0000)]
[llvm-mca] Add a test for zero-idiom VPERM2F128rr. NFC

We don't correctly model the latency and resource usage information for
zero-idiom VPERM2F128rr on Jaguar.

This is demonstrated by the incorrect numbers in the resource pressure view, and
the timeline view.
A follow up patch will fix this problem.

llvm-svn: 343346

5 years ago[bindings/go] Add Go bindings to the Token type
whitequark [Fri, 28 Sep 2018 17:39:59 +0000 (17:39 +0000)]
[bindings/go] Add Go bindings to the Token type

Summary: This type is necessary for implementing coroutines.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: modocache, llvm-commits

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

llvm-svn: 343345

5 years ago[OPENMP] Add the test to check that the libomptarget does not cause
Alexey Bataev [Fri, 28 Sep 2018 17:13:11 +0000 (17:13 +0000)]
[OPENMP] Add the test to check that the libomptarget does not cause
infinite loop on removing non-mapped pointer-with-object.

Added test to check that libomptarget does not cause infinite loop when
trying to unmap the pointer-with-object data that was not previously
mapped.

llvm-svn: 343344

5 years ago[X86] Add the movbe instruction intrinsics from icc.
Craig Topper [Fri, 28 Sep 2018 17:09:51 +0000 (17:09 +0000)]
[X86] Add the movbe instruction intrinsics from icc.

These intrinsics exist in icc. They can be found on the Intel Intrinsics Guide website.

All the backend support is in place to pattern match a load+bswap or a bswap+store pattern to the MOVBE instructions. So we just need to get the frontend to emit the correct IR. The pointer arguments in icc are declared as void so I had to jump through a packed struct to forcing a specific alignment on the load/store. Same trick we use in the unaligned vector load/store intrinsics

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

llvm-svn: 343343

5 years agoRevert r343318 together with llvm commit r343317
Luke Cheeseman [Fri, 28 Sep 2018 17:02:56 +0000 (17:02 +0000)]
Revert r343318 together with llvm commit r343317

llvm-svn: 343342

5 years agoRevert r343317
Luke Cheeseman [Fri, 28 Sep 2018 17:01:50 +0000 (17:01 +0000)]
Revert r343317

- asan buildbots are breaking and I need to investigate the issue

llvm-svn: 343341

5 years ago[WebAssembly] Preserve function signatures during LTO
Sam Clegg [Fri, 28 Sep 2018 16:50:14 +0000 (16:50 +0000)]
[WebAssembly] Preserve function signatures during LTO

With LTO when and undefined function (with a known signature)
in replaced by a defined bitcode function we were loosing the
signature information (since bitcode functions don't have
signatures).

With this change we preserve the original signature from the
undefined function and verify that the post LTO compiled
function has the correct signature.

This change improves the error handling in the case where
there is a signature mismatch with a function defined in
a bitcode file.

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

llvm-svn: 343340

5 years ago[bindings/go] Add Go bindings for inline assembly
whitequark [Fri, 28 Sep 2018 16:48:47 +0000 (16:48 +0000)]
[bindings/go] Add Go bindings for inline assembly

Reviewers: harlanhaskins, whitequark, pcc

Reviewed By: pcc

Subscribers: llvm-commits

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

llvm-svn: 343339

5 years agoAST: add missing ObjC extensions to MS style name decoration
Saleem Abdulrasool [Fri, 28 Sep 2018 16:47:53 +0000 (16:47 +0000)]
AST: add missing ObjC extensions to MS style name decoration

Add support for encoding type arguments for lightweight generics in
Objective-C++ mode.  Additionally, add support for the `__kindof` modifier.
This should complete the coverage of the ObjC extensions that clang currently
supports under the MS style name decoration scheme.

This is implemented similar to the Objective-C lifetime qualifiers decoration:
a template specialization in the `__ObjC` namespace so that we can interoperate
with Microsoft's tools as well as ensure that we do not accidentally collide
with new features in the Microsoft implementation.

Since the `__kindof` appertains to the type and not the pointer, we apply the
template specialization to the underlying type instead of the pointer type.

Unfortunately, until D52581 is resolved, the generated name is not really
compatible with the MS tools as well as breaks interoperability with
Objective-C++ and C++.

This resolves PR37754!

llvm-svn: 343338

5 years agoRevert "[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints"
whitequark [Fri, 28 Sep 2018 16:45:18 +0000 (16:45 +0000)]
Revert "[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints"

This reverts commit c4baf7c2f06ff5459c4f5998ce980346e72bff97.

Broke the bots, and should really be in Transforms/Coroutines
instead.

llvm-svn: 343337

5 years ago[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints
whitequark [Fri, 28 Sep 2018 16:38:11 +0000 (16:38 +0000)]
[LLVM-C] Add bindings for addCoroutinePassesToExtensionPoints

Summary: This patch adds bindings to C and Go for addCoroutinePassesToExtensionPoints, which is used to add coroutine passes to the correct locations in PassManagerBuilder.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: mehdi_amini, modocache, llvm-commits

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

llvm-svn: 343336

5 years ago[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
Alexey Bataev [Fri, 28 Sep 2018 16:17:59 +0000 (16:17 +0000)]
[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.

clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

llvm-svn: 343335

5 years ago[LLVM-C] Fix broken build bots
Robert Widmann [Fri, 28 Sep 2018 16:02:26 +0000 (16:02 +0000)]
[LLVM-C] Fix broken build bots

Summary: Fix broken bots caused by the merge of D51522.

Reviewers: whitequark

Subscribers: llvm-commits

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

llvm-svn: 343334

5 years ago[utils] Cope with the binary having a .exe extension in update_mca_test_checks.py
Greg Bedwell [Fri, 28 Sep 2018 15:39:18 +0000 (15:39 +0000)]
[utils] Cope with the binary having a .exe extension in update_mca_test_checks.py

llvm-svn: 343333

5 years ago[utils] Stricter checking from update_mca_test_checks.py
Greg Bedwell [Fri, 28 Sep 2018 15:39:09 +0000 (15:39 +0000)]
[utils] Stricter checking from update_mca_test_checks.py

If any prefixes have been specified on the RUN lines that do not end up
ever actually getting printed, raise an Error. This is either an
indication that the run lines just need cleaning up, or that something
is more fundamentally wrong with the test.

Also raise an Error if there are any blocks which cannot be checked
because they are not uniquely covered by a prefix.

Fixed up a couple of tests where the extra checking flagged up issues.

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

llvm-svn: 343332

5 years ago[utils] Allow better identification of matching blocks in update_mca_test_checks.py
Greg Bedwell [Fri, 28 Sep 2018 15:38:56 +0000 (15:38 +0000)]
[utils] Allow better identification of matching blocks in update_mca_test_checks.py

Insert empty blocks to cause the positions of matching blocks to match
across lists where possible so that later stages of the algorithm can
actually identify them as being identical.

Regenerated all tests with this change.

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

llvm-svn: 343331

5 years ago[LLVM-C] Add more debug information accessors to GlobalObject and Instruction
Robert Widmann [Fri, 28 Sep 2018 15:35:18 +0000 (15:35 +0000)]
[LLVM-C] Add more debug information accessors to GlobalObject and Instruction

Summary: Adds missing debug information accessors to GlobalObject.  This puts the finishing touches on cloning debug info in the echo tests.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: aprantl, JDevlieghere, llvm-commits, harlanhaskins

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

llvm-svn: 343330

5 years ago[InstCombine] don't propagate wider shufflevector arguments to predecessors
Sanjay Patel [Fri, 28 Sep 2018 15:24:41 +0000 (15:24 +0000)]
[InstCombine] don't propagate wider shufflevector arguments to predecessors

InstCombine would propagate shufflevector insts that had wider output vectors onto
predecessors, which would sometimes push undef's onto the divisor of a div/rem and
result in bad codegen.

I've fixed this by just banning propagating shufflevector back if the result of
the shufflevector is wider than the input vectors.

Patch by: @sheredom (Neil Henning)

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

llvm-svn: 343329

5 years ago[InstCombine] adjust shuffle undef propagation tests; NFC
Sanjay Patel [Fri, 28 Sep 2018 15:20:06 +0000 (15:20 +0000)]
[InstCombine] adjust shuffle undef propagation tests; NFC

These are the updated baseline tests for D52548 -
I'm putting the tests next to the tests where the transform
functions as expected, so we can see the intended/unintended
consequences.

Patch by: @sheredom (Neil Henning)

llvm-svn: 343328

5 years ago[ORC] Remove some dead code.
Lang Hames [Fri, 28 Sep 2018 15:13:41 +0000 (15:13 +0000)]
[ORC] Remove some dead code.

llvm-svn: 343327

5 years ago[ORC] Fix the unit tests that were broken by r343323.
Lang Hames [Fri, 28 Sep 2018 15:09:14 +0000 (15:09 +0000)]
[ORC] Fix the unit tests that were broken by r343323.

llvm-svn: 343326

5 years ago[GISel]: Remove an incorrect assert in CallLowering
Aditya Nandakumar [Fri, 28 Sep 2018 15:08:49 +0000 (15:08 +0000)]
[GISel]: Remove an incorrect assert in CallLowering

https://reviews.llvm.org/D51147

Asserting if any extend of vectors should be up to the target's
legalizer/target specific code not in CallLowering.

reviewed by : dsanders.

llvm-svn: 343325

5 years ago[libomptarget-nvptx] Add testing infrastructure
Jonas Hahnfeld [Fri, 28 Sep 2018 15:05:43 +0000 (15:05 +0000)]
[libomptarget-nvptx] Add testing infrastructure

This patch also introduces testing for libomptarget-nvptx
which has been missing until now. I propose to add tests for
all bugs that are fixed in the future.
The target check-libomptarget-nvptx is not run by default because
 - we can't determine if there is a GPU plugged into the system.
 - it will require the latest Clang compiler. Keeping compatibility
   with older releases would prevent testing newer code generation
   developed in trunk.

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

llvm-svn: 343324

5 years ago[ORC] Improve debugging output for ORC.
Lang Hames [Fri, 28 Sep 2018 15:03:11 +0000 (15:03 +0000)]
[ORC] Improve debugging output for ORC.

(1) Print debugging output under a session lock to avoid garbled messages when
compiling on multiple threads.

(2) Name MaterializationUnits, add an ostream operator for them, and so they can
be easily referenced in debugging output, and have that ostream operator
optionally print code/data/hidden symbols provided by that materialization unit
based on command line options.

llvm-svn: 343323

5 years agoRevert r342652 "[winasan] Unpoison the stack in NtTerminateThread"
Hans Wennborg [Fri, 28 Sep 2018 14:41:25 +0000 (14:41 +0000)]
Revert r342652 "[winasan] Unpoison the stack in NtTerminateThread"

This seems to cause the thread's exit code to be clobbered, breaking
Chromium tests.

Also revert follow-up r342654.

> In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall.
>
> Differential Revision: https://reviews.llvm.org/D52091

llvm-svn: 343322

5 years ago[X86][Btver2] PSUBS/PSUBUS instructions are zero-idioms
Simon Pilgrim [Fri, 28 Sep 2018 14:20:42 +0000 (14:20 +0000)]
[X86][Btver2] PSUBS/PSUBUS instructions are zero-idioms

Noticed during llvm-exegesis tests, the PSUBS/PSUBUS instructions have the same zero-idiom behaviour to PSUB

llvm-svn: 343321

5 years ago[ELF][HEXAGON] Add support for dynamic libraries
Sid Manning [Fri, 28 Sep 2018 14:09:16 +0000 (14:09 +0000)]
[ELF][HEXAGON] Add support for dynamic libraries

Write out the PLT header and stub.
Hexagon uses RELA relocations.

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

llvm-svn: 343320

5 years ago[X86][Btver2] Add zero-idiom tests for PSUBS/PSUBUS instructions
Simon Pilgrim [Fri, 28 Sep 2018 13:53:11 +0000 (13:53 +0000)]
[X86][Btver2] Add zero-idiom tests for PSUBS/PSUBUS instructions

Noticed during llvm-exegesis tests, the PSUBS/PSUBUS instructions have the same zero-idiom behaviour to PSUB

llvm-svn: 343319

5 years agoReapply the changes reverted by r343236
Luke Cheeseman [Fri, 28 Sep 2018 13:38:16 +0000 (13:38 +0000)]
Reapply the changes reverted by r343236

llvm-svn: 343318

5 years agoReapply changes reverted by r343235
Luke Cheeseman [Fri, 28 Sep 2018 13:37:27 +0000 (13:37 +0000)]
Reapply changes reverted by r343235

- Add fix so that all code paths that create DWARFContext
  with an ObjectFile initialise the target architecture in the context
- Add an assert that the Arch is known in the Dwarf CallFrameString method

llvm-svn: 343317

5 years agoFix and modernize StringMatcher comment; NFC
Sven van Haastregt [Fri, 28 Sep 2018 13:31:55 +0000 (13:31 +0000)]
Fix and modernize StringMatcher comment; NFC

llvm-svn: 343316

5 years ago[MIPS GlobalISel] Lower i64 arguments
Petar Jovanovic [Fri, 28 Sep 2018 13:28:47 +0000 (13:28 +0000)]
[MIPS GlobalISel] Lower i64 arguments

Lower integer arguments larger then 32 bits for MIPS32.
setMostSignificantFirst is used in order for G_UNMERGE_VALUES and
G_MERGE_VALUES to always hold registers in same order, regardless of
endianness.

Patch by Petar Avramovic.

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

llvm-svn: 343315

5 years ago[X86][Btver2] CVTSS2I/CVTSD2I - add missing JFPU0 pipe
Simon Pilgrim [Fri, 28 Sep 2018 13:19:22 +0000 (13:19 +0000)]
[X86][Btver2] CVTSS2I/CVTSD2I - add missing JFPU0 pipe

We issue JFPU1->JSTC then JFPU0->JFPA then -> JALU0 (integer pipe)

Match AMD Fam16h SOG + llvm-exegesis tests

llvm-svn: 343314

5 years agoSplit invocations in CodeGen/X86/cpus.ll among multiple tests. (NFC)
Jonas Devlieghere [Fri, 28 Sep 2018 12:08:51 +0000 (12:08 +0000)]
Split invocations in CodeGen/X86/cpus.ll among multiple tests. (NFC)

On GreenDragon `CodeGen/X86/cpus.ll` is timing out on the bot with Asan
and UBSan enabled. With the same configuration on my machine, the test
passes but takes more than 3 minutes to do so. I could increase the
timeout, but I believe it makes more sense to split up the test because
it allows for more parallelism.

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

llvm-svn: 343313

5 years ago[llvm-mca] Remove redundant namespace prefixes. NFC
Andrea Di Biagio [Fri, 28 Sep 2018 10:47:24 +0000 (10:47 +0000)]
[llvm-mca] Remove redundant namespace prefixes. NFC

We are already "using" namespace llvm in all the files modified by this change.

llvm-svn: 343312

5 years ago[X86][Btver2] Fix BSF/BSR schedule
Simon Pilgrim [Fri, 28 Sep 2018 10:26:48 +0000 (10:26 +0000)]
[X86][Btver2] Fix BSF/BSR schedule

Double throughput to account for 2 pipes + fix BSF's latency/uop counts

Match AMD Fam16h SOG + llvm-exegesis tests

llvm-svn: 343311

5 years agoRevert r343308: [LoopInterchange] Turn into a loop pass.
Florian Hahn [Fri, 28 Sep 2018 10:20:07 +0000 (10:20 +0000)]
Revert r343308: [LoopInterchange] Turn into a loop pass.

llvm-svn: 343310

5 years ago[ARM] Prevent DSP and SIM32 being set for v6m
Sam Parker [Fri, 28 Sep 2018 10:18:02 +0000 (10:18 +0000)]
[ARM] Prevent DSP and SIM32 being set for v6m

My previous change (rL340911) set the two features for architectures
>= 6, which wrongly includes v6m. Now set to >= 6 and not Cortex-M.

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

llvm-svn: 343309

5 years ago[LoopInterchange] Turn into a loop pass.
Florian Hahn [Fri, 28 Sep 2018 09:45:50 +0000 (09:45 +0000)]
[LoopInterchange] Turn into a loop pass.

This patch turns LoopInterchange into a loop pass. It now only
considers top-level loops and tries to move the innermost loop to the
optimal position within the loop nest. By only looking at top-level
loops, we might miss a few opportunities the function pass would get
(e.g. if we have a loop nest of 3 loops, in the function pass
we might process loops at level 1 and 2 and move the inner most loop to
level 1, and then we process loops at levels 0, 1, 2 and interchange
again, because we now have a different inner loop). But I think it would
be better to handle such cases by picking the best inner loop from the
start and avoid re-visiting the same loops again.

The biggest advantage of it being a function pass is that it interacts
nicely with the other loop passes. Without this patch, there are some
performance regressions on AArch64 with loop interchanging enabled,
where no loops were interchanged, but we missed out on some other loop
optimizations.

It also removes the SimplifyCFG run. We are just changing branches, so
the CFG should not be more complicated, besides the additional 'unique'
preheaders this pass might create.

Reviewers: chandlerc, efriedma, mcrosier, javed.absar, xbolva00

Reviewed By: xbolva00

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

llvm-svn: 343308

5 years ago[llvm-mca] Teach how to track zero registers in class RegisterFile.
Andrea Di Biagio [Fri, 28 Sep 2018 09:42:06 +0000 (09:42 +0000)]
[llvm-mca] Teach how to track zero registers in class RegisterFile.

This change is in preparation for a future work on improving support for
optimizable register moves.  We already know if a write is from a zero-idiom, so
we can propagate that bit of information to the PRF.  We use an APInt mask to
identify registers that are set to zero.

llvm-svn: 343307

5 years ago[docs] Fix links in Clangd documentation
Kirill Bobyrev [Fri, 28 Sep 2018 09:32:47 +0000 (09:32 +0000)]
[docs] Fix links in Clangd documentation

Add missing `_` after each `external link <https://llvm.org>`_, as
required by the reStructuredText specification.

llvm-svn: 343306

5 years ago[ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping
Owen Pan [Fri, 28 Sep 2018 09:17:00 +0000 (09:17 +0000)]
[ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping

It should respond to AfterFunction, not AfterControlStatement.

Fixes PR39067

llvm-svn: 343305

5 years ago[ARM] Alter test to account for change to armv6k default CPU
Peter Smith [Fri, 28 Sep 2018 09:04:31 +0000 (09:04 +0000)]
[ARM] Alter test to account for change to armv6k default CPU

Review D52594 will change the default in llvm for armv6k from the
non-existent cpu arm1176jf-s to mpcore. The tests in arm-cortex-cpus.c
need to be updated to account for this change.

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

llvm-svn: 343304

5 years ago[ARM] Remove non-existent cpu arm1176j-s and use mpcore for v6k
Peter Smith [Fri, 28 Sep 2018 09:04:27 +0000 (09:04 +0000)]
[ARM] Remove non-existent cpu arm1176j-s and use mpcore for v6k

The ARMTargetParser.def contains an entry for arm1176j-s which is the
default for the ArmV6K architecture. This cpu does not exist, there are
only arm1176jz-s and arm1176jzf-s and they are both architecture ArmV6KZ.
The only CPUs that are actually ArmV6K are the mpcore, mpcore_nofpu and
later revisions of the arm1136 family r1px (which we don't have a table
entry for).

This patch removes the arm1176j-s and makes mpcore the default for armv6k.

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

llvm-svn: 343303

5 years ago[ARM] Allow execute only code on Cortex-m23
David Spickett [Fri, 28 Sep 2018 08:55:19 +0000 (08:55 +0000)]
[ARM] Allow execute only code on Cortex-m23

The NoMovt feature prevents the use of MOVW/MOVT
instructions on Cortex-M23 for performance reasons.
These instructions are required for execute only code
so NoMovt should be disabled when that option is enabled.

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

llvm-svn: 343302

5 years agoRemove extra whitespace. NFC. (test commit)
David Spickett [Fri, 28 Sep 2018 08:45:28 +0000 (08:45 +0000)]
Remove extra whitespace. NFC. (test commit)

llvm-svn: 343301

5 years ago[ARM][v8.5A] Add speculation barriers SSBB and PSSBB
Oliver Stannard [Fri, 28 Sep 2018 08:27:56 +0000 (08:27 +0000)]
[ARM][v8.5A] Add speculation barriers SSBB and PSSBB

This adds two new barrier instructions which can be used to restrict
speculative execution of load instructions.

Patch by Pablo Barrio!

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

llvm-svn: 343300

5 years ago[X86][BtVer2] Fix PHMINPOS schedule resources typo
Simon Pilgrim [Fri, 28 Sep 2018 08:21:39 +0000 (08:21 +0000)]
[X86][BtVer2] Fix PHMINPOS schedule resources typo

PHMINPOS can run on either JFPU pipe

llvm-svn: 343299

5 years ago[PDB] Handle `char` as a builtin type
Aleksandr Urakov [Fri, 28 Sep 2018 07:59:49 +0000 (07:59 +0000)]
[PDB] Handle `char` as a builtin type

Summary:
`char`, `signed char` and `unsigned char` are three different types,
and they are mangled differently:

```
void __declspec(dllexport) /* ?foo@@YAXD@Z */ foo(char c) { }
void __declspec(dllexport) /* ?foo@@YAXE@Z */ foo(unsigned char c) { }
void __declspec(dllexport) /* ?foo@@YAXC@Z */ foo(signed char c) { }
```

This commit separates `char` from `signed char` and `unsigned char`.

Reviewers: asmith, zturner, labath

Reviewed By: asmith, zturner

Subscribers: teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 343298

5 years ago[CodeGen] fix broken successor probability in MBB dump
Hiroshi Inoue [Fri, 28 Sep 2018 05:27:32 +0000 (05:27 +0000)]
[CodeGen] fix broken successor probability in MBB dump

When printing successor probabilities for a MBB, a human readable value is sometimes shown as 200.0%.
The human readable output is based on getProbabilityIterator, which returns 0xFFFFFFFF for getNumerator() and 0x80000000 for getDenominator() for unknown BranchProbability.
By using getSuccProbability as we do for the non-human readable part, we can avoid this problem.

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

llvm-svn: 343297

5 years agoTest commit. NFC.
Owen Rodley [Fri, 28 Sep 2018 04:51:45 +0000 (04:51 +0000)]
Test commit. NFC.

llvm-svn: 343296

5 years ago[XRay] Fix fdr-thread-order.cc when current directory contains fdr-thread-order.cc
Fangrui Song [Fri, 28 Sep 2018 04:20:08 +0000 (04:20 +0000)]
[XRay] Fix fdr-thread-order.cc when current directory contains fdr-thread-order.cc

Summary:
Currently,

    cd test/xray/TestCases/Posix
    $build/bin/llvm-lit fdr-thread-order.cc

fails because `rm fdr-thread-order.*` deletes the .cc file.

This patch uses:

* %t as temporary directory name containing log files
* %t.exe as executable name

It does not delete %t after the test finishes for debugging convenience.
This matches the behavior of tests of various other LLVM components.

Log files will not clog up because the temporary directory (unique among
test files but the same among multiple invocations of a test) is cleaned
at the beginning of the test.

Reviewers: dberris, mboerger, eizan

Reviewed By: dberris

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 343295

5 years ago[ScalarizeMaskedMemIntrin] Use MinAlign to calculate alignment for the scalar load...
Craig Topper [Fri, 28 Sep 2018 03:35:37 +0000 (03:35 +0000)]
[ScalarizeMaskedMemIntrin] Use MinAlign to calculate alignment for the scalar load/stores to handle element types that are byte-sized but not powers of 2.

This pass doesn't handle non-byte sized types correctly at all, but at least we can make byte sized types work.

llvm-svn: 343294

5 years agoHandle dependent class template names in class template argument
Richard Smith [Fri, 28 Sep 2018 03:18:53 +0000 (03:18 +0000)]
Handle dependent class template names in class template argument
deduction for new-expressions.

llvm-svn: 343293

5 years ago[lldb] Remove an assertion in RichManglingContext::GetBufferRef() hit when debugging...
Aaron Smith [Fri, 28 Sep 2018 02:33:51 +0000 (02:33 +0000)]
[lldb] Remove an assertion in RichManglingContext::GetBufferRef() hit when debugging a native x86 Windows process

Summary: A RichManglingContext constructed with an invalid demangled name or with a demangled function name without any context will have an empty context. This triggers an assertion in RichManglingContext::GetBufferRef() when debugging a native Windows process on x86 when it shouldn't. Remove the assertion.

Reviewers: aleksandr.urakov, zturner, lldb-commits

Reviewed By: zturner

Subscribers: erik.pilkington

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

llvm-svn: 343292

5 years ago[pdb] Simplify the code by replacing a few string conversions with calls to invokeBst...
Aaron Smith [Fri, 28 Sep 2018 02:32:07 +0000 (02:32 +0000)]
[pdb] Simplify the code by replacing a few string conversions with calls to invokeBstrMethod()

Reviewers: aleksandr.urakov, zturner, llvm-commits

Reviewed By: zturner

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

llvm-svn: 343291

5 years agomerge-request.sh: Add 7.0 metabug
Tom Stellard [Fri, 28 Sep 2018 02:30:42 +0000 (02:30 +0000)]
merge-request.sh: Add 7.0 metabug

llvm-svn: 343290

5 years ago[XRay] Guard local variables with `static` and struct with unnamed namespaces
Fangrui Song [Fri, 28 Sep 2018 02:05:52 +0000 (02:05 +0000)]
[XRay] Guard local variables with `static` and struct with unnamed namespaces

Summary:
This is for coding standard conformance, and for fixing an ODR violation
issue: __xray::ThreadLocalData is defined twice and differently in
xray_fdr_logging.cc and xray_basic_logging.cc

Reviewers: dberris, mboerger, eizan

Reviewed By: dberris

Subscribers: delcypher, jfb, llvm-commits, #sanitizers

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

llvm-svn: 343289

5 years ago[ORC] clang-format the ThreadSafeModule code.
Lang Hames [Fri, 28 Sep 2018 01:41:33 +0000 (01:41 +0000)]
[ORC] clang-format the ThreadSafeModule code.

Evidently I forgot to do this before committing r343055.

llvm-svn: 343288

5 years ago[ORC] Add a const version of ThreadSafeModule::getModule().
Lang Hames [Fri, 28 Sep 2018 01:41:33 +0000 (01:41 +0000)]
[ORC] Add a const version of ThreadSafeModule::getModule().

llvm-svn: 343287

5 years ago[ORC] Lock ThreadSafeContext during module destruction in ThreadSafeModule's
Lang Hames [Fri, 28 Sep 2018 01:41:29 +0000 (01:41 +0000)]
[ORC] Lock ThreadSafeContext during module destruction in ThreadSafeModule's
move constructor.

This is basically the same fix as r343261, but applied to the move constructor:
Failure to lock the context during module destruction can lead to data races if
other threads are operating on the context.

llvm-svn: 343286

5 years ago[cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
Richard Smith [Fri, 28 Sep 2018 01:16:43 +0000 (01:16 +0000)]
[cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
render the function deleted instead of rendering the program ill-formed.

This change also adds an enabled-by-default warning for the case where
an explicitly-defaulted special member function of a non-template class
is implicitly deleted by the type checking rules. (This fires either due
to this language change or due to pre-C++20 reasons for the member being
implicitly deleted). I've tested this on a large codebase and found only
bugs (where the program means something that's clearly different from
what the programmer intended), so this is enabled by default, but we
should revisit this if there are problems with this being enabled by
default.

llvm-svn: 343285

5 years ago[ScalarizeMaskedMemIntrin] Fix the alignment calculation for the scalar stores of...
Craig Topper [Fri, 28 Sep 2018 01:06:13 +0000 (01:06 +0000)]
[ScalarizeMaskedMemIntrin] Fix the alignment calculation for the scalar stores of a masked store expansion.

It should be the minimum of the original alignment and the scalar size.

llvm-svn: 343284

5 years ago[ScalarizeMaskedMemIntrin] Add test cases for masked store expansion. Increase alignm...
Craig Topper [Fri, 28 Sep 2018 01:06:09 +0000 (01:06 +0000)]
[ScalarizeMaskedMemIntrin] Add test cases for masked store expansion. Increase alignment of one of the masked load test cases.

The masked store alignment is being miscalculated, but masked load is correct.

llvm-svn: 343283

5 years ago[XRay] Fix argv0-log-file-name.cc race when tests are executed parallelly
Fangrui Song [Thu, 27 Sep 2018 23:59:57 +0000 (23:59 +0000)]
[XRay] Fix argv0-log-file-name.cc race when tests are executed parallelly

`rm xray-log.*` may delete log files of other tests and cause them to
fail, when tests are executed parallelly.

llvm-svn: 343282

5 years ago[X86] Add the test case from PR38986.
Craig Topper [Thu, 27 Sep 2018 23:25:10 +0000 (23:25 +0000)]
[X86] Add the test case from PR38986.

The assembly for this test should be optimal now after changes to the ScalarizeMaskedMemIntrin patch.

llvm-svn: 343281

5 years ago[XRay] Add LD_LIBRARY_PATH to env variables for Unit Tests
Dean Michael Berris [Thu, 27 Sep 2018 23:15:05 +0000 (23:15 +0000)]
[XRay] Add LD_LIBRARY_PATH to env variables for Unit Tests

Summary:
This change allows us to use the library path from which the LLVM
libraries are installed, in case the LLVM installation generates shared
libraries.

This should address llvm.org/PR39070.

Reviewers: mboerger, eizan

Subscribers: mgorny, jfb, llvm-commits

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

llvm-svn: 343280

5 years ago[cxx2a] P0624R2: Lambdas with no capture-default are
Richard Smith [Thu, 27 Sep 2018 22:47:04 +0000 (22:47 +0000)]
[cxx2a] P0624R2: Lambdas with no capture-default are
default-constructible and assignable.

llvm-svn: 343279

5 years ago[ScalarizeMaskedMemIntrin] Ensure the mask is a vector of ConstantInts before generat...
Craig Topper [Thu, 27 Sep 2018 22:31:42 +0000 (22:31 +0000)]
[ScalarizeMaskedMemIntrin] Ensure the mask is a vector of ConstantInts before generating the expansion without control flow.

Its possible the mask itself or one of the elements is a ConstantExpr and we shouldn't optimize in that case.

llvm-svn: 343278

5 years ago[ScalarizeMaskedMemIntrin] Use cast instead of dyn_cast checked by an assert. Consist...
Craig Topper [Thu, 27 Sep 2018 22:31:40 +0000 (22:31 +0000)]
[ScalarizeMaskedMemIntrin] Use cast instead of dyn_cast checked by an assert. Consistently make use of the element type variable we already have. NFCI

cast will take care of asserting internally.

llvm-svn: 343277

5 years ago[analyzer] Hotfix for the bug in exploded graph printing
George Karpenkov [Thu, 27 Sep 2018 22:31:13 +0000 (22:31 +0000)]
[analyzer] Hotfix for the bug in exploded graph printing

llvm-svn: 343276

5 years agoWebAssembly: Rename GetSignature to GetLibcallSignature [NFC]
Derek Schuff [Thu, 27 Sep 2018 22:20:33 +0000 (22:20 +0000)]
WebAssembly: Rename GetSignature to GetLibcallSignature [NFC]

llvm-svn: 343275

5 years ago[ScalarizeMaskedMemIntrin] When expanding masked gathers, start with the passthru...
Craig Topper [Thu, 27 Sep 2018 21:28:59 +0000 (21:28 +0000)]
[ScalarizeMaskedMemIntrin] When expanding masked gathers, start with the passthru vector and insert the new load results into it.

Previously we started with undef and did a final merge with the passthru at the end.

llvm-svn: 343273

5 years ago[ScalarizeMaskedMemIntrin] Add some IR only test cases for masked gather expansion.
Craig Topper [Thu, 27 Sep 2018 21:28:55 +0000 (21:28 +0000)]
[ScalarizeMaskedMemIntrin] Add some IR only test cases for masked gather expansion.

llvm-svn: 343272

5 years ago[ScalarizeMaskedMemIntrin] When expanding masked loads, start with the passthru value...
Craig Topper [Thu, 27 Sep 2018 21:28:52 +0000 (21:28 +0000)]
[ScalarizeMaskedMemIntrin] When expanding masked loads, start with the passthru value and insert each conditional load result over their element.

Previously we started with undef and did one final merge at the end with a select.

llvm-svn: 343271

5 years ago[ScalarizeMaskedMemIntrin] Handle the case where the mask is an all zero vector.
Craig Topper [Thu, 27 Sep 2018 21:28:46 +0000 (21:28 +0000)]
[ScalarizeMaskedMemIntrin] Handle the case where the mask is an all zero vector.

This shouldn't really happen in practice I hope, but we tried to handle other constant cases. We missed this one because we checked for ConstantVector without realizing that zero becomes ConstantAggregateZero instead.

So instead just check for Constant and use getAggregateElement which will do the dirty work for us.

llvm-svn: 343270

5 years ago[ScalarizeMaskedMemIntrin] Add dedicated IR only tests for masked load expansion...
Craig Topper [Thu, 27 Sep 2018 21:28:43 +0000 (21:28 +0000)]
[ScalarizeMaskedMemIntrin] Add dedicated IR only tests for masked load expansion so I can begin making modifications.

llvm-svn: 343269

5 years ago[ScalarizeMaskedMemIntrin] Remove some temporary variables that are only used by...
Craig Topper [Thu, 27 Sep 2018 21:28:41 +0000 (21:28 +0000)]
[ScalarizeMaskedMemIntrin] Remove some temporary variables that are only used by a single if condition.

llvm-svn: 343268

5 years ago[ScalarizeMaskedMemIntrin] Cleanup comments. NFC
Craig Topper [Thu, 27 Sep 2018 21:28:39 +0000 (21:28 +0000)]
[ScalarizeMaskedMemIntrin] Cleanup comments. NFC

llvm-svn: 343267

5 years ago[ORC] Add definition for IRLayer::setCloneToNewContextOnEmit, use it to set the
Lang Hames [Thu, 27 Sep 2018 21:13:07 +0000 (21:13 +0000)]
[ORC] Add definition for IRLayer::setCloneToNewContextOnEmit, use it to set the
flag to true in LLJIT when running in multithreaded mode.

The IRLayer::setCloneToNewContextOnEmit method sets a flag within the IRLayer
that causes modules added to that layer to be moved to a new context (by
serializing to/from a memory buffer) when they are emitted. This allows modules
that were all loaded on the same context to be compiled in parallel.

llvm-svn: 343266

5 years ago[WebAssembly] Add --[no]-export-dynamic to replace --export-default
Sam Clegg [Thu, 27 Sep 2018 21:06:25 +0000 (21:06 +0000)]
[WebAssembly] Add --[no]-export-dynamic to replace --export-default

In a very recent change I introduced a --no-export-default flag
but after conferring with others it seems that this feature already
exists in gnu GNU ld and lld in the form the --export-dynamic flag
which is off by default.

This change replaces export-default with export-dynamic and also
changes the default to match the traditional linker behaviour.

Now, by default, only the entry point is exported.  If other symbols
are required by the embedder then --export-dynamic or --export can
be used to export all visibility hidden symbols or individual
symbols respectively.

This change touches a lot of tests that were relying on symbols
being exported by default.  I imagine it will also effect many
users but do think the change is worth it match of the traditional
behaviour and flag names.

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

llvm-svn: 343265

5 years agoAMDGPU: Split HasExt into HasExtDPP/SDWA/SDWA9
Konstantin Zhuravlyov [Thu, 27 Sep 2018 20:49:00 +0000 (20:49 +0000)]
AMDGPU: Split HasExt into HasExtDPP/SDWA/SDWA9

llvm-svn: 343264

5 years agoNFC: Fix some darwin linker warnings introduced in r338385
Erik Pilkington [Thu, 27 Sep 2018 20:36:28 +0000 (20:36 +0000)]
NFC: Fix some darwin linker warnings introduced in r338385

The darwin linker was complaining about Toolchains/RISCV.cpp and
Toolchains/Arch/RISCV.cpp had the same name. Fix is to just rename
Toolchains/RISCV.cpp to Toolchains/RISCVToolchain.cpp.

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

llvm-svn: 343263

5 years ago[ORC] Make LocalIndirectStubsManager's operations thread-safe.
Lang Hames [Thu, 27 Sep 2018 20:36:10 +0000 (20:36 +0000)]
[ORC] Make LocalIndirectStubsManager's operations thread-safe.

Locks stub management operations and switches to atomic update for stub
pointers.

llvm-svn: 343262

5 years ago[ORC] Lock ThreadSafeContext during Module destructing in ThreadSafeModule.
Lang Hames [Thu, 27 Sep 2018 20:36:08 +0000 (20:36 +0000)]
[ORC] Lock ThreadSafeContext during Module destructing in ThreadSafeModule.

Failure to lock the context can lead to data races if other threads are
operating on other ThreadSafeModules that share the same context.

llvm-svn: 343261

5 years ago[OpenMP] Make default parallel for schedule in NVPTX target regions in SPMD mode...
Gheorghe-Teodor Bercea [Thu, 27 Sep 2018 20:29:00 +0000 (20:29 +0000)]
[OpenMP] Make default parallel for schedule in NVPTX target regions in SPMD mode achieve coalescing

Summary: Set default schedule for parallel for loops to schedule(static, 1) when using SPMD mode on the NVPTX device offloading toolchain to ensure coalescing.

Reviewers: ABataev, Hahnfeld, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 343260

5 years agoAMDGPU: Split VOP2Inst into VOP2Inst_e32/e64/sdwa
Konstantin Zhuravlyov [Thu, 27 Sep 2018 19:46:41 +0000 (19:46 +0000)]
AMDGPU: Split VOP2Inst into VOP2Inst_e32/e64/sdwa

llvm-svn: 343259

5 years agoTest commit. NFC
Patrick Lyster [Thu, 27 Sep 2018 19:30:32 +0000 (19:30 +0000)]
Test commit. NFC

llvm-svn: 343258

5 years ago[ORC] Coalesce all of ORC's symbol renaming / linkage-promotion utilities into
Lang Hames [Thu, 27 Sep 2018 19:27:20 +0000 (19:27 +0000)]
[ORC] Coalesce all of ORC's symbol renaming / linkage-promotion utilities into
one SymbolLinkagePromoter utility.

SymbolLinkagePromoter renames anonymous and private symbols, and bumps all
linkages to at least global/hidden-visibility. Modules whose symbols have been
promoted by this utility can be decomposed into sub-modules without introducing
link errors. This is used by the CompileOnDemandLayer to extract single-function
modules for lazy compilation.

llvm-svn: 343257

5 years ago[ORC] LastKey needs to be protected to prevent data races.
Lang Hames [Thu, 27 Sep 2018 19:27:20 +0000 (19:27 +0000)]
[ORC] LastKey needs to be protected to prevent data races.

llvm-svn: 343256

5 years ago[lli] Fix ArgV setup bug when running in -jit-kind=orc-lazy mode.
Lang Hames [Thu, 27 Sep 2018 19:27:19 +0000 (19:27 +0000)]
[lli] Fix ArgV setup bug when running in -jit-kind=orc-lazy mode.

ArgV[ArgC] should be null.

llvm-svn: 343255

5 years agoAMDGPU/NFC: Simplify VOP_MAC_F16/F32
Konstantin Zhuravlyov [Thu, 27 Sep 2018 19:24:05 +0000 (19:24 +0000)]
AMDGPU/NFC: Simplify VOP_MAC_F16/F32

llvm-svn: 343254

5 years ago[OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achie...
Gheorghe-Teodor Bercea [Thu, 27 Sep 2018 19:22:56 +0000 (19:22 +0000)]
[OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

Summary: For the OpenMP NVPTX toolchain choose a default distribute schedule that ensures coalescing on the GPU when in SPMD mode. This significantly increases the performance of offloaded target code and reduces the number of registers used on the GPU side.

Reviewers: ABataev, caomhin, Hahnfeld

Reviewed By: ABataev, Hahnfeld

Subscribers: Hahnfeld, jholewinski, guansong, cfe-commits

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

llvm-svn: 343253

5 years ago[sanitizer] Disable failing Android test after D52371
Kostya Kortchinsky [Thu, 27 Sep 2018 19:15:40 +0000 (19:15 +0000)]
[sanitizer] Disable failing Android test after D52371

Summary:
The default values used for Space/Size for the new SizeClassMap do not work
with Android. The Compact map appears to be in the same boat.
Disable the test on Android for now to turn the bots green, but there is no
reason Compact & Dense should not have an Android test.
Added a FIXME, I will revisit this soon.

Reviewers: eugenis

Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 343252

5 years ago[clang][ubsan][NFC] Slight test cleanup in preparation for D50901
Roman Lebedev [Thu, 27 Sep 2018 19:07:48 +0000 (19:07 +0000)]
[clang][ubsan][NFC] Slight test cleanup in preparation for D50901

Reviewers: vsk, vitalybuka, filcab

Reviewed By: vitalybuka

Subscribers: cfe-commits

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

llvm-svn: 343251