platform/upstream/llvm.git
6 years ago[clangd] Make symbol name a required parameter for CanonicalIncludes::mapHeader
Eric Liu [Thu, 1 Mar 2018 18:30:48 +0000 (18:30 +0000)]
[clangd] Make symbol name a required parameter for CanonicalIncludes::mapHeader

llvm-svn: 326458

6 years ago[NVPTX] use pattern matching to lower int_nvvm_match_all_sync*.
Artem Belevich [Thu, 1 Mar 2018 18:28:45 +0000 (18:28 +0000)]
[NVPTX] use pattern matching to lower int_nvvm_match_all_sync*.

Now that patterns can handle intrinsics returning multiple results,
use tablegen'ed pattern matching instead of custom lowering.

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

llvm-svn: 326457

6 years ago[clangd] Support include canonicalization in symbol leve.
Eric Liu [Thu, 1 Mar 2018 18:06:40 +0000 (18:06 +0000)]
[clangd] Support include canonicalization in symbol leve.

Summary:
Symbols with different canonical includes might be defined in the same header
(e.g. symbols defined in STL <iosfwd>). This patch adds support for mapping from
qualified symbol names to canonical headers and special mapping for symbols in <iosfwd>

Reviewers: sammccall, hokein

Reviewed By: sammccall

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

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

llvm-svn: 326456

6 years ago[WebAssembly] Use uint8_t for single byte values to match the spec
Sam Clegg [Thu, 1 Mar 2018 18:06:39 +0000 (18:06 +0000)]
[WebAssembly] Use uint8_t for single byte values to match the spec

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

llvm-svn: 326455

6 years ago[WebAssembly] Use uint8_t for single byte values to match the spec
Sam Clegg [Thu, 1 Mar 2018 18:06:21 +0000 (18:06 +0000)]
[WebAssembly] Use uint8_t for single byte values to match the spec

The original BinaryEncoding.md document used to specify that
these values were `varint7`, but the official spec lists them
explicitly as single byte values and not LEB.

A similar change for wabt is in flight:
 https://github.com/WebAssembly/wabt/pull/782

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

llvm-svn: 326454

6 years ago[PDB] Defer writing the build id until the rest of the PDB is written.
Zachary Turner [Thu, 1 Mar 2018 18:00:29 +0000 (18:00 +0000)]
[PDB] Defer writing the build id until the rest of the PDB is written.

For now this is NFC, but this small refactor opens the door to
letting us embed a hash of the PDB in the build id field of the
PDB.

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

llvm-svn: 326453

6 years ago[clangd] Forward all environment variables along with CLANGD_TRACE to clangd.
Eric Liu [Thu, 1 Mar 2018 17:42:27 +0000 (17:42 +0000)]
[clangd] Forward all environment variables along with CLANGD_TRACE to clangd.

llvm-svn: 326452

6 years ago[AMDGPU] : fix for the crash in SIRegisterInfo when the regiser class not found
Alexander Timofeev [Thu, 1 Mar 2018 17:36:43 +0000 (17:36 +0000)]
[AMDGPU] : fix for the crash in SIRegisterInfo when the regiser class not found

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

llvm-svn: 326451

6 years ago[Hexagon] Add guest registers
Krzysztof Parzyszek [Thu, 1 Mar 2018 17:03:26 +0000 (17:03 +0000)]
[Hexagon] Add guest registers

llvm-svn: 326450

6 years agoMake TestDynamicValueSameBase gcc-compatible
Pavel Labath [Thu, 1 Mar 2018 16:56:28 +0000 (16:56 +0000)]
Make TestDynamicValueSameBase gcc-compatible

gcc will say that the type of "this" is "T * const", clang "T *".
Compare the unqualified type names to erase the difference between the
two, as the constness is not a part of this test.

FWIW, I think that the gcc behavior makes more sense here.

llvm-svn: 326449

6 years ago[InstCombine] remove stale comments for tests; NFC
Sanjay Patel [Thu, 1 Mar 2018 16:28:32 +0000 (16:28 +0000)]
[InstCombine] remove stale comments for tests; NFC

llvm-svn: 326448

6 years ago[Power9] Add missing instructions to the Power 9 scheduler
Stefan Pintilie [Thu, 1 Mar 2018 16:16:08 +0000 (16:16 +0000)]
[Power9] Add missing instructions to the Power 9 scheduler

Adding more instructions using InstRW so that we can move away from ItinRW
and ultimately have a complete Power 9 scheduler.

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

llvm-svn: 326447

6 years agoCorrect markup and nits in ld.lld man page
Ed Maste [Thu, 1 Mar 2018 16:02:19 +0000 (16:02 +0000)]
Correct markup and nits in ld.lld man page

Patch by Ingo Schwarze

llvm-svn: 326446

6 years ago[WebAssembly] Update pre-generated test files to match latest llc output. NFC.
Nicholas Wilson [Thu, 1 Mar 2018 15:55:59 +0000 (15:55 +0000)]
[WebAssembly] Update pre-generated test files to match latest llc output. NFC.

The ordering of llc's output was changed in rL326334.

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

llvm-svn: 326445

6 years ago[InstCombine] simplify code for (X*Y) * X => (X*X) * Y ; NFCI
Sanjay Patel [Thu, 1 Mar 2018 15:50:26 +0000 (15:50 +0000)]
[InstCombine] simplify code for (X*Y) * X => (X*X) * Y ; NFCI

llvm-svn: 326444

6 years ago[AArch64] generate vuzp instead of mov
Sebastian Pop [Thu, 1 Mar 2018 15:47:39 +0000 (15:47 +0000)]
[AArch64] generate vuzp instead of mov

when a BUILD_VECTOR is created out of a sequence of EXTRACT_VECTOR_ELT with a
specific pattern sequence, either <0, 2, 4, ...> or <1, 3, 5, ...>, replace the
BUILD_VECTOR with either vuzp1 or vuzp2.

With this patch LLVM generates the following code for the first function fun1 in the testcase:
adrp x8, .LCPI0_0
ldr  q0, [x8, :lo12:.LCPI0_0]
tbl  v0.16b, { v0.16b }, v0.16b
ext  v1.16b, v0.16b, v0.16b, #8
uzp1 v0.8b, v0.8b, v1.8b
str  d0, [x8]
ret

Without this patch LLVM currently generates this code:
adrp    x8, .LCPI0_0
ldr     q0, [x8, :lo12:.LCPI0_0]
tbl     v0.16b, { v0.16b }, v0.16b
mov     v1.16b, v0.16b
mov     v1.b[1], v0.b[2]
mov     v1.b[2], v0.b[4]
mov     v1.b[3], v0.b[6]
mov     v1.b[4], v0.b[8]
mov     v1.b[5], v0.b[10]
mov     v1.b[6], v0.b[12]
mov     v1.b[7], v0.b[14]
str     d1, [x8]
ret

llvm-svn: 326443

6 years ago[InstCombine] move/add tests for fmul reassociation; NFC
Sanjay Patel [Thu, 1 Mar 2018 15:30:44 +0000 (15:30 +0000)]
[InstCombine] move/add tests for fmul reassociation; NFC

This transform may be out-of-scope for instcombine,
but this is only documenting the current behavior.

llvm-svn: 326442

6 years agoDon't allocate a header bellow address 0.
Rafael Espindola [Thu, 1 Mar 2018 15:25:46 +0000 (15:25 +0000)]
Don't allocate a header bellow address 0.

With the current code if the script has a PHDRS we always obey and try
to allocate a header. This can cause Min - HeaderSize to underflow.

It looks like bfd actually prints an error for this case. With this
patch we do the same.

Found while looking at pr36515.

llvm-svn: 326441

6 years ago[InstCombine] auto-generate full checks; NFC
Sanjay Patel [Thu, 1 Mar 2018 15:13:42 +0000 (15:13 +0000)]
[InstCombine] auto-generate full checks; NFC

llvm-svn: 326440

6 years agoResubmit [analyzer] Support for naive cross translation unit analysis
Ilya Biryukov [Thu, 1 Mar 2018 14:54:16 +0000 (14:54 +0000)]
Resubmit [analyzer] Support for naive cross translation unit analysis

Originally submitted as r326323 and r326324.
Reverted in r326432.

Reverting the commit was a mistake.
The breakage was due to invalid build files in our internal buildsystem,
CMakeLists did not have any cyclic dependencies.

llvm-svn: 326439

6 years agoUsersManual: improve the clang-cl text some more
Hans Wennborg [Thu, 1 Mar 2018 14:48:19 +0000 (14:48 +0000)]
UsersManual: improve the clang-cl text some more

llvm-svn: 326438

6 years agoMake Finalize tolerant of empty register sets.
Tatyana Krasnukha [Thu, 1 Mar 2018 14:36:42 +0000 (14:36 +0000)]
Make Finalize tolerant of empty register sets.

llvm-svn: 326437

6 years agoRevert "[DEBUGINFO] Add flag for DWARF2 or less to use sections as references."
Alexey Bataev [Thu, 1 Mar 2018 14:32:37 +0000 (14:32 +0000)]
Revert "[DEBUGINFO] Add flag for DWARF2 or less to use sections as references."

This reverts commit r326328 to remove checks for emission of certain
sections after discussion with Eric Christofer.

llvm-svn: 326436

6 years ago[OMPT] Fix interoperability test with GCC
Jonas Hahnfeld [Thu, 1 Mar 2018 14:03:18 +0000 (14:03 +0000)]
[OMPT] Fix interoperability test with GCC

We have to ensure that the runtime is initialized _before_ waiting
for the two started threads to guarantee that the master threads
post their ompt_event_thread_begin before the worker threads. This
is not guaranteed in the parallel region where one worker thread
could start before the other master thread has invoked the callback.

The problem did not happen with Clang becauses the generated code
calls __kmpc_global_thread_num() and cashes its result for functions
that contain OpenMP pragmas.

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

llvm-svn: 326435

6 years agoUsersManual: beef up the clang-cl text a little
Hans Wennborg [Thu, 1 Mar 2018 14:00:19 +0000 (14:00 +0000)]
UsersManual: beef up the clang-cl text a little

llvm-svn: 326434

6 years ago[CodeGen] fix argument attribute in lowering statepoint/patchpoint
Than McIntosh [Thu, 1 Mar 2018 13:31:57 +0000 (13:31 +0000)]
[CodeGen] fix argument attribute in lowering statepoint/patchpoint

Summary:
Use the correct loop index varaible, ArgI, to retrieve attributes.

Reviewers: thanm, sanjoy, rnk

Reviewed By: rnk

Subscribers: llvm-commits

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

llvm-svn: 326433

6 years agoRevert "[analyzer] Support for naive cross translation unit analysis"
Ilya Biryukov [Thu, 1 Mar 2018 12:43:39 +0000 (12:43 +0000)]
Revert "[analyzer] Support for naive cross translation unit analysis"

Also revert "[analyzer] Fix a compiler warning"
This reverts commits r326323 and r326324.

Reason: the commits introduced a cyclic dependency in the build graph.
This happens to work with cmake, but breaks out internal integrate.

llvm-svn: 326432

6 years ago[ELF] - Don't crash on broken MEMORY declaration.
George Rimar [Thu, 1 Mar 2018 12:36:01 +0000 (12:36 +0000)]
[ELF] - Don't crash on broken MEMORY declaration.

LLD crashes with broken scripts shown in testcase,
because fails to read memory regon name and accesses
MemoryRegions's element which is nullptr.
Patch fixes it.

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

llvm-svn: 326431

6 years ago[ELF] - Do not remove empty sections that use symbols in expressions.
George Rimar [Thu, 1 Mar 2018 12:27:04 +0000 (12:27 +0000)]
[ELF] - Do not remove empty sections that use symbols in expressions.

This is PR36515.

Currenly if we have a script like .debug_info 0 : { *(.debug_info) },
we would not remove this section and keep it in the output.
That does not work, because it is common case for
debug sections to have a zero address expression.
Patch changes behavior so that we remove only sections
that do not use symbols in its expressions.

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

llvm-svn: 326430

6 years ago[SCCP] Fix unused variable warning in release builds.
Benjamin Kramer [Thu, 1 Mar 2018 11:31:44 +0000 (11:31 +0000)]
[SCCP] Fix unused variable warning in release builds.

llvm-svn: 326429

6 years ago[OMPT] Fix task-type test with GCC
Joachim Protze [Thu, 1 Mar 2018 11:26:15 +0000 (11:26 +0000)]
[OMPT] Fix task-type test with GCC

This is similar to D43882. The runtime needs to be initialized before calling print_ids(0)

http://lab.llvm.org:8011/builders/openmp-gcc-x86_64-linux-debian/builds/60

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

llvm-svn: 326428

6 years ago[ELF] - Fix eh-frame-reloc-out-of-range.test.
George Rimar [Thu, 1 Mar 2018 10:38:51 +0000 (10:38 +0000)]
[ELF] - Fix eh-frame-reloc-out-of-range.test.

Was broken after recent testcases changes.

llvm-svn: 326427

6 years ago[clang-format] Add SpaceBeforeColon option
Francois Ferrand [Thu, 1 Mar 2018 10:09:13 +0000 (10:09 +0000)]
[clang-format] Add SpaceBeforeColon option

Summary:
When disabled, this option allows removing the space before colon,
making it act more like the semi-colon. When enabled (default), the
current behavior is not affected.

This mostly affects C++11 loop, initializer list, inheritance list and
container literals:

  class Foo: Bar {}
  Foo::Foo(): a(a) {}
  for (auto i: myList) {}
  f({a: 1, b: 2, c: 3});

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: xvallspl, teemperor, karies, cfe-commits, klimek

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

llvm-svn: 326426

6 years ago[dsymutil] Move string pool into its own implementatino file. NFC.
Jonas Devlieghere [Thu, 1 Mar 2018 10:05:54 +0000 (10:05 +0000)]
[dsymutil] Move string pool into its own implementatino file. NFC.

The DwarfLinker implementation is already relatively large with over 4k
LOC. This commit moves the implementation of NonRelocatableStringpool
into a separate cpp file.

llvm-svn: 326425

6 years ago[WebAssembly] Reorder exports to match symbol table order
Nicholas Wilson [Thu, 1 Mar 2018 09:38:02 +0000 (09:38 +0000)]
[WebAssembly] Reorder exports to match symbol table order

This fixes a TODO introduced in rLLD325861.

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

llvm-svn: 326424

6 years ago[PATCH] [compiler-rt, RISCV] Support builtins for RISC-V
Shiva Chen [Thu, 1 Mar 2018 07:47:27 +0000 (07:47 +0000)]
[PATCH] [compiler-rt, RISCV] Support builtins for RISC-V

Summary:
Support builtins for RISC-V, RV32 and RV64.

Reviewers: asb, apazos, mgrang

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

llvm-svn: 326420

6 years agoFunction definition may have uninstantiated body
Serge Pavlov [Thu, 1 Mar 2018 07:04:11 +0000 (07:04 +0000)]
Function definition may have uninstantiated body

Current implementation of `FunctionDecl::isDefined` does not take into
account redeclarations that do not have bodies, but the bodies can be
instantiated from corresponding templated definition. This behavior does
not allow to detect function redefinition in the cases where friend
functions is defined in class templates. For instance, the code:
```
    template<typename T> struct X { friend void f() {} };
    X<int> xi;
    void f() {}
```
compiles successfully but must fail due to redefinition of `f`. The
declaration of the friend `f` is created when the containing template
`X` is instantiated, but it does not have a body as per 14.5.4p4
because `f` is not odr-used.

With this change the function `Sema::CheckForFunctionRedefinition`
considers functions with uninstantiated bodies as definitions.

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

llvm-svn: 326419

6 years ago[SCEV] Smart range calculation for SCEVUnknown Phis
Max Kazantsev [Thu, 1 Mar 2018 06:56:48 +0000 (06:56 +0000)]
[SCEV] Smart range calculation for SCEVUnknown Phis

The range of SCEVUnknown Phi which merges values `X1, X2, ..., XN`
can be evaluated as `U(Range(X1), Range(X2), ..., Range(XN))`.

Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D43810

llvm-svn: 326418

6 years ago[X86] Stop passing two arguments by reference. NFC
Craig Topper [Thu, 1 Mar 2018 06:25:13 +0000 (06:25 +0000)]
[X86] Stop passing two arguments by reference. NFC

I think these used to be out parameters, but they haven't been for a while.

llvm-svn: 326417

6 years agoRemove redundant casts. NFC
George Burgess IV [Thu, 1 Mar 2018 05:43:23 +0000 (05:43 +0000)]
Remove redundant casts. NFC

So I wrote a clang-tidy check to lint out redundant `isa`, `cast`, and
`dyn_cast`s for fun. This is a portion of what it found for clang; I
plan to do similar cleanups in LLVM and other subprojects when I find
time.

Because of the volume of changes, I explicitly avoided making any change
that wasn't highly local and obviously correct to me (e.g. we still have
a number of foo(cast<Bar>(baz)) that I didn't touch, since overloading
is a thing and the cast<Bar> did actually change the type -- just up the
class hierarchy).

I also tried to leave the types we were cast<>ing to somewhere nearby,
in cases where it wasn't locally obvious what we were dealing with
before.

llvm-svn: 326416

6 years agoConvert more tests as linker scripts instead of assembly.
Rui Ueyama [Thu, 1 Mar 2018 04:21:42 +0000 (04:21 +0000)]
Convert more tests as linker scripts instead of assembly.

llvm-svn: 326415

6 years ago[test] Restore cleanup behavior in TestQuoting.py
Vedant Kumar [Thu, 1 Mar 2018 03:03:38 +0000 (03:03 +0000)]
[test] Restore cleanup behavior in TestQuoting.py

Before the change to compile tests out-of-tree, the cleanup classmethod
in TestQuoting.py would remove a temp file. After the change it threw an
exception due to a malformed call to getBuildArtifact().

Bring back the old behavior.

llvm-svn: 326414

6 years ago[Support] Fix comments for handleAllErrors: it calls llvm_unreachable if the
Lang Hames [Thu, 1 Mar 2018 02:52:17 +0000 (02:52 +0000)]
[Support] Fix comments for handleAllErrors: it calls llvm_unreachable if the
contract is violated, not report_fatal_error.

llvm-svn: 326413

6 years agoWe were getting the wrong dynamic type if there were two classes with the same basename.
Jim Ingham [Thu, 1 Mar 2018 02:44:34 +0000 (02:44 +0000)]
We were getting the wrong dynamic type if there were two classes with the same basename.

There's a bug in FindTypes, it ignores the exact flag if you pass a name that doesn't begin with
:: and pass eTypeClassAny for the type.

In this case we always know that the name we get from the vtable name is absolute so we can
work around the bug by prepending the "::".  This doesn't fix the FindTypes bug.

<rdar://problem/38010986>

llvm-svn: 326412

6 years ago[WebAssembly] Remove unused forward declaration.
Rui Ueyama [Thu, 1 Mar 2018 02:37:26 +0000 (02:37 +0000)]
[WebAssembly] Remove unused forward declaration.

llvm-svn: 326411

6 years agoDo not create multiple NOTE segments.
Rui Ueyama [Thu, 1 Mar 2018 02:31:29 +0000 (02:31 +0000)]
Do not create multiple NOTE segments.

Previously, we didn't try to make effort to put .note sections next
to each other in the output file, so two .note sections were likely
to be stored to two separate NOTE segments. That's undesirable because
we should create as few segments as possible in general.

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

llvm-svn: 326410

6 years agoExpand test a bit.
Rafael Espindola [Thu, 1 Mar 2018 02:25:40 +0000 (02:25 +0000)]
Expand test a bit.

It now includes both linkerscript and non linkerscript variants.

Extracted from a patch by Rui while I was trying to figure out what
exactly was changing.

llvm-svn: 326409

6 years ago[analyzer] [tests] Create a directory for the log file
George Karpenkov [Thu, 1 Mar 2018 02:18:54 +0000 (02:18 +0000)]
[analyzer] [tests] Create a directory for the log file

llvm-svn: 326408

6 years ago[XRay] cache symbolized function names for a repeatedly queried function ID
Martin Pelikan [Thu, 1 Mar 2018 01:59:24 +0000 (01:59 +0000)]
[XRay] cache symbolized function names for a repeatedly queried function ID

Summary:
Processing 2 GB XRay traces with "llvm-xray convert -symbolize" needs to
go over each trace record and symbolize the function name refered to by
its ID.  Currently this happens by asking the LLVM symbolizer code every
single time.  A simple cache can save around 30 minutes of processing of
that trace.

llvm-xray's resident memory usage increased negligibly with this cache.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 326407

6 years ago[RuntimeDyld][MachO] Fix assertion in encodeAddend, add missing directive to
Lang Hames [Thu, 1 Mar 2018 01:44:33 +0000 (01:44 +0000)]
[RuntimeDyld][MachO] Fix assertion in encodeAddend, add missing directive to
test case.

r326290 fixed the assertion for decodeAddend, but not encodeAddend. The
regression test failed to catch this because it was missing the
subsections_via_symbols flag, so the desired relocation was not applied.

This patch also fixes the formatting of the assertion from r326290.

llvm-svn: 326406

6 years ago[analyzer] Add a checker for mmap()s which are both writable and executable.
Artem Dergachev [Thu, 1 Mar 2018 01:27:46 +0000 (01:27 +0000)]
[analyzer] Add a checker for mmap()s which are both writable and executable.

This is a security check that warns when both PROT_WRITE and PROT_EXEC are
set during mmap(). If mmap()ed memory is both writable and executable, it makes
it easier for the attacker to execute arbitrary code when contents of this
memory are compromised. Some applications require such mmap()s though, such as
different sorts of JIT.

Re-applied after a revert in r324167.

Temporarily stays in the alpha package because it needs a better way of
determining macro values that are not immediately available in the AST.

Patch by David Carlier!

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

llvm-svn: 326405

6 years ago[IPSCCP] do not break musttail invariant (PR36485)
Reid Kleckner [Thu, 1 Mar 2018 01:19:18 +0000 (01:19 +0000)]
[IPSCCP] do not break musttail invariant (PR36485)

Do not replace results of `musttail` calls with a constant if the
call itself can't be removed.

Do not zap returns of `musttail` callees, if the call site can't be
removed and replaced with a constant.

Do not zap returns of `musttail`-calling blocks, this breaks
invariant too.

Patch by Fedor Indutny

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

llvm-svn: 326404

6 years agoConvert more .s files to linker script files.
Rui Ueyama [Thu, 1 Mar 2018 01:19:12 +0000 (01:19 +0000)]
Convert more .s files to linker script files.

Summary:
This change removes large "echo" commands from the test by writing
tests themselves as linker scripts.

Reviewers: rafael

Subscribers: emaste, javed.absar, llvm-commits, arichardson

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

llvm-svn: 326403

6 years ago[CFG] [analyzer] Recall that we only skip NoOp casts in construction contexts.
Artem Dergachev [Thu, 1 Mar 2018 01:09:24 +0000 (01:09 +0000)]
[CFG] [analyzer] Recall that we only skip NoOp casts in construction contexts.

For now. We should also add support for ConstructorConversion casts as presented
in the attached test case, but this requires more changes because AST around
them seems different.

The check was originally present but was accidentally lost during r326021.

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

llvm-svn: 326402

6 years agoSimplify removing empty output sections.
Rafael Espindola [Thu, 1 Mar 2018 01:08:00 +0000 (01:08 +0000)]
Simplify removing empty output sections.

With this the meaning of the Live bit in output sections is clear: we
have at some point added a input section into it.

llvm-svn: 326401

6 years ago[ELF] Fix a test comment. NFC
Fangrui Song [Thu, 1 Mar 2018 01:05:04 +0000 (01:05 +0000)]
[ELF] Fix a test comment. NFC

llvm-svn: 326400

6 years agoAdd another entitlement that we need for debugserver.
Jason Molenda [Thu, 1 Mar 2018 01:04:07 +0000 (01:04 +0000)]
Add another entitlement that we need for debugserver.
<rdar://problem/29855293>

llvm-svn: 326399

6 years ago[WebAssembly] Use Twine rather than StringRef for logging messages
Sam Clegg [Thu, 1 Mar 2018 00:42:57 +0000 (00:42 +0000)]
[WebAssembly] Use Twine rather than StringRef for logging messages

Also add missing tracing to writeU8.

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

llvm-svn: 326398

6 years agoStart setting dllimport/dllexport in setGVProperties.
Rafael Espindola [Thu, 1 Mar 2018 00:35:47 +0000 (00:35 +0000)]
Start setting dllimport/dllexport in setGVProperties.

This is the next step in setting dso_local for COFF.

The patches changes setGVProperties to first set dllimport/dllexport
and changes a few cases that were setting dllimport/dllexport
manually. With this a few more GVs are marked dso_local.

llvm-svn: 326397

6 years ago[GlobalISel][AArch64] Adding -disable-gisel-legality-check CL option
Roman Tereshin [Thu, 1 Mar 2018 00:27:48 +0000 (00:27 +0000)]
[GlobalISel][AArch64] Adding -disable-gisel-legality-check CL option

Currently it's impossible to test InstructionSelect pass with MIR which
is considered illegal by the Legalizer in Assert builds. In early stages
of porting an existing backend from SelectionDAG ISel to GlobalISel,
however, we would have very basic CallLowering, Legalizer, and
RegBankSelect implementations, but rather functional Instruction Select
with quite a few patterns selectable due to the semi-automatic porting
process borrowing them from SelectionDAG ISel.

As we are trying to define legality as a property of being selectable by
the instruction selector, it would be nice to be able to easily check
what the selector can do in its current state w/o the legality check
provided by the Legalizer getting in the way.

It also seems beneficial to have a regression testing set up that would
not allow the selector to silently regress in its support of the MIR not
supported yet by the previous passes in the GlobalISel pipeline.

This commit adds -disable-gisel-legality-check command line option to
llc that disables those legality checks in RegBankSelect and
InstructionSelect passes.

It also adds quite a few MIR test cases for AArch64's Instruction
Selector. Every one of them would fail on the legality check at the
moment, but will select just fine if the check is disabled. Every test
MachineFunction is intended to exercise a specific selection rule and
that rule only, encoded in the MachineFunction's name by the rule's
number, ID, and index of its GIM_Try opcode in TableGen'erated
MatchTable (-optimize-match-table=false).

Reviewers: ab, dsanders, qcolombet, rovka

Reviewed By: bogner

Subscribers: kristof.beyls, volkan, aditya_nandakumar, aemerson,
rengolin, t.p.northover, javed.absar, llvm-commits

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

llvm-svn: 326396

6 years ago[DWARF] Emit a split line table only if there are split type units.
Paul Robinson [Thu, 1 Mar 2018 00:12:35 +0000 (00:12 +0000)]
[DWARF] Emit a split line table only if there are split type units.

A .debug_info.dwo section doesn't use the .debug_line.dwo section.

llvm-svn: 326395

6 years ago[DAE] don't remove args of musttail target/caller
Reid Kleckner [Thu, 1 Mar 2018 00:09:35 +0000 (00:09 +0000)]
[DAE] don't remove args of musttail target/caller

`musttail` requires identical signatures of caller and callee. Removing
arguments breaks `musttail` semantics.

PR36441

Patch by Fedor Indutny

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

llvm-svn: 326394

6 years ago[X86] Make sure we don't combine (fneg (fma X, Y, Z)) to a target specific node when...
Craig Topper [Thu, 1 Mar 2018 00:08:38 +0000 (00:08 +0000)]
[X86] Make sure we don't combine (fneg (fma X, Y, Z)) to a target specific node when there are no FMA instructions.

This would cause a 'cannot select' error at isel when we should have emitted a lib call and an xor.

Fixes PR36553.

llvm-svn: 326393

6 years agoPass a GlobalDecl to SetCommonAttributes. NFC.
Rafael Espindola [Thu, 1 Mar 2018 00:06:55 +0000 (00:06 +0000)]
Pass a GlobalDecl to SetCommonAttributes. NFC.

Part of D43900.

llvm-svn: 326392

6 years agoInline a trivial function. NFC.
Rafael Espindola [Thu, 1 Mar 2018 00:00:02 +0000 (00:00 +0000)]
Inline a trivial function. NFC.

llvm-svn: 326391

6 years ago[NVPTX] Lower loads from global constants using ld.global.nc (aka LDG).
Justin Lebar [Wed, 28 Feb 2018 23:58:05 +0000 (23:58 +0000)]
[NVPTX] Lower loads from global constants using ld.global.nc (aka LDG).

Summary:
After D43914, loads from global variables in addrspace(1) happen with
ld.global.  But since they're constants, even better would be to use
ld.global.nc, aka ldg.

Reviewers: tra

Subscribers: jholewinski, sanjoy, hiraditya, llvm-commits

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

llvm-svn: 326390

6 years ago[NVPTX] Use addrspacecast instead of target-specific intrinsics in NVPTXGenericToNVVM.
Justin Lebar [Wed, 28 Feb 2018 23:57:48 +0000 (23:57 +0000)]
[NVPTX] Use addrspacecast instead of target-specific intrinsics in NVPTXGenericToNVVM.

Summary:
NVPTXGenericToNVVM was using target-specific intrinsics to do address
space casts.  Using the addrspacecast instruction is (a lot) simpler.
But it also has the advantage of being understandable to other passes.
In particular, InferAddrSpaces is able to understand these address space
casts and remove them in most cases.

Reviewers: tra

Subscribers: jholewinski, sanjoy, hiraditya, llvm-commits

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

llvm-svn: 326389

6 years agoPass a GlobalDecl to setNonAliasAttributes. NFC.
Rafael Espindola [Wed, 28 Feb 2018 23:54:23 +0000 (23:54 +0000)]
Pass a GlobalDecl to setNonAliasAttributes. NFC.

Also part of D43900.

llvm-svn: 326388

6 years ago[MIRParser] Accept overloaded intrinsic names w/o type suffixes
Roman Tereshin [Wed, 28 Feb 2018 23:51:49 +0000 (23:51 +0000)]
[MIRParser] Accept overloaded intrinsic names w/o type suffixes

Function::lookupIntrinsicID is somewhat forgiving as it comes to
overloaded intrinsics' names: it returns an ID as soon as the name
provided has a prefix that matches a registered intrinsic's name w/o
actually checking that the rest of the name encodes all the concrete arg
types, let alone that those types are compatible with the intrinsic's
definition.

That's probably fine and comes in handy in MIR serialization: we don't
care about IR types at MIR level and every intrinsic should be
selectable based on its ID and low-level types (LLTs) of its operands,
including the overloaded ones, so there is no point in serializing
mangled IR types as part of the intrinsic's name.

However, lookupIntrinsicID is somewhat inconsistent in its forgiveness:
if the name provided is actually an exact match, it will refuse to
return the ID if the intrinsic is overloaded. There is probably no
real reason for that and it renders MIRParser incapable to deserialize
MIR MIRPrinter serialized.

This commit fixes it.

Reviewers: rnk, aditya_nandakumar, qcolombet, thegameg, dsanders,
marcello.maggioni

Reviewed By: bogner

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 326387

6 years ago[clang-tidy] Another batch of checks to rename from misc- to bugprone-.
Alexander Kornienko [Wed, 28 Feb 2018 23:47:15 +0000 (23:47 +0000)]
[clang-tidy] Another batch of checks to rename from misc- to bugprone-.

Summary:
clang-tidy/rename_check.py {misc,bugprone}-suspicious-semicolon
clang-tidy/rename_check.py {misc,bugprone}-suspicious-string-compare
clang-tidy/rename_check.py {misc,bugprone}-swapped-arguments
clang-tidy/rename_check.py {misc,bugprone}-undelegated-constructor --check_class_name UndelegatedConstructor

Reviewers: hokein, sammccall, aaron.ballman

Subscribers: klimek, mgorny, xazax.hun, cfe-commits

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

llvm-svn: 326386

6 years agoPass a GlobalDecl to SetInternalFunctionAttributes. NFC.
Rafael Espindola [Wed, 28 Feb 2018 23:46:35 +0000 (23:46 +0000)]
Pass a GlobalDecl to SetInternalFunctionAttributes. NFC.

This just reduces the noise in a followup patch.

Part of D43900.

llvm-svn: 326385

6 years agoRename more checks from misc- to bugprone-.
Alexander Kornienko [Wed, 28 Feb 2018 23:30:29 +0000 (23:30 +0000)]
Rename more checks from misc- to bugprone-.

Summary:
clang-tidy/rename_check.py {misc,bugprone}-string-integer-assignment
clang-tidy/rename_check.py {misc,bugprone}-string-literal-with-embedded-nul
clang-tidy/rename_check.py {misc,bugprone}-suspicious-enum-usage
clang-tidy/rename_check.py {misc,bugprone}-suspicious-missing-comma

Reviewers: hokein, sammccall, aaron.ballman

Subscribers: klimek, cfe-commits, mgorny

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

llvm-svn: 326384

6 years ago[libcxx] Fix last_write_time test for filesystems that don't support very small times.
Volodymyr Sapsai [Wed, 28 Feb 2018 23:27:40 +0000 (23:27 +0000)]
[libcxx] Fix last_write_time test for filesystems that don't support very small times.

APFS minimum supported file write time is -2^63 nanoseconds, which doesn't go
as far as `file_time_type::min()` that is equal to -2^63 microseconds on macOS.

This change doesn't affect filesystems that support `file_time_type` range only
for in-memory file time representation but not for on-disk representation. Such
filesystems are considered as `SupportsMinTime`.

rdar://problem/35865151

Reviewers: EricWF, Hahnfeld

Subscribers: jkorous-apple, mclow.lists, cfe-commits, christof

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

llvm-svn: 326383

6 years agoUse DenseMap::lookup() instead of find() and a hand-written null check.
Rui Ueyama [Wed, 28 Feb 2018 23:03:06 +0000 (23:03 +0000)]
Use DenseMap::lookup() instead of find() and a hand-written null check.

llvm-svn: 326382

6 years agobuild: add the ability to create a symlink for dsymutil
Saleem Abdulrasool [Wed, 28 Feb 2018 23:00:50 +0000 (23:00 +0000)]
build: add the ability to create a symlink for dsymutil

Add a `LLVM_INSTALL_CCTOOLS_SYMLINKS` to mirror
`LLVM_INSTALL_BINUTILS_SYMLINKS`.  For now, this allows us to create
symlinks for `dsymutil` to `llvm-dsymutil`.  This option is off by
default, but the user can enable it.

llvm-svn: 326381

6 years ago[X86] Regenerate cmpxchg tests
Simon Pilgrim [Wed, 28 Feb 2018 22:57:23 +0000 (22:57 +0000)]
[X86] Regenerate cmpxchg tests

Add 64-bit cmpxchg8b tests

llvm-svn: 326380

6 years ago[WebAssembly] Reduce code repetition. NFC.
Rui Ueyama [Wed, 28 Feb 2018 22:51:51 +0000 (22:51 +0000)]
[WebAssembly] Reduce code repetition. NFC.

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

llvm-svn: 326379

6 years agoFix up the gtest targets for changes in the UnwindAssembly tests.
Jim Ingham [Wed, 28 Feb 2018 22:41:11 +0000 (22:41 +0000)]
Fix up the gtest targets for changes in the UnwindAssembly tests.

llvm-svn: 326378

6 years ago[InstCombine] simplify code for X * -1.0 --> -X; NFC
Sanjay Patel [Wed, 28 Feb 2018 22:30:04 +0000 (22:30 +0000)]
[InstCombine] simplify code for X * -1.0 --> -X; NFC

I've added random FMF to one of the tests to show those are propagated.

llvm-svn: 326377

6 years ago[GlobalOpt] don't change CC of musttail calle(e|r)
Jonas Devlieghere [Wed, 28 Feb 2018 22:28:44 +0000 (22:28 +0000)]
[GlobalOpt] don't change CC of musttail calle(e|r)

When the function has musttail call - its cc is fixed to be equal to the
cc of the musttail callee. In such case (and in the case of the musttail
callee), GlobalOpt should not change the cc to fastcc as it will break
the invariant.

This fixes PR36546

Patch by: Fedor Indutny (indutny)

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

llvm-svn: 326376

6 years ago[X86] Lower extract_element from k-registers by bitcasting from v16i1 to i16 and...
Craig Topper [Wed, 28 Feb 2018 22:23:55 +0000 (22:23 +0000)]
[X86] Lower extract_element from k-registers by bitcasting from v16i1 to i16 and extending/truncating.

This is equivalent to what isel was doing anyway but by canonicalizing earlier we can remove some patterns.

llvm-svn: 326375

6 years agoAdd ability to collect memory limit.
Han Ming Ong [Wed, 28 Feb 2018 22:18:45 +0000 (22:18 +0000)]
Add ability to collect memory limit.

Reviewer: Jason Molenda

<rdar://problem/37686560>

llvm-svn: 326374

6 years ago[hwasan] update the asm snippet in the docs to match the current default behaviour
Kostya Serebryany [Wed, 28 Feb 2018 21:58:19 +0000 (21:58 +0000)]
[hwasan] update the asm snippet in the docs to match the current default behaviour

llvm-svn: 326373

6 years ago[X86][AVX512] Improve support for signed saturation truncation stores
Simon Pilgrim [Wed, 28 Feb 2018 21:42:19 +0000 (21:42 +0000)]
[X86][AVX512] Improve support for signed saturation truncation stores

Matches what we already manage for unsigned saturation truncation stores

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

llvm-svn: 326372

6 years agoMake sure that clang-format doesn't reorder include files.
Rui Ueyama [Wed, 28 Feb 2018 21:32:24 +0000 (21:32 +0000)]
Make sure that clang-format doesn't reorder include files.

clang-format won't reorder include files if there is a blank line.
Thanks to Nico for the tips.

llvm-svn: 326371

6 years agoAttempt to fix cl-include.c on Windows.
Nico Weber [Wed, 28 Feb 2018 20:58:06 +0000 (20:58 +0000)]
Attempt to fix cl-include.c on Windows.

llvm-svn: 326370

6 years agoAdapt some tests to work with PPC64le architecture
Pavel Labath [Wed, 28 Feb 2018 20:57:26 +0000 (20:57 +0000)]
Adapt some tests to work with PPC64le architecture

Summary: Merge branch 'master' into adaptPPC64tests

Reviewers: clayborg, alexandreyy, labath

Reviewed By: clayborg, alexandreyy

Subscribers: luporl, lbianc, alexandreyy, lldb-commits

Differential Revision: https://reviews.llvm.org/D42917
Patch by Ana Julia Caetano <ana.caetano@eldorado.org.br>.

llvm-svn: 326369

6 years ago[OpenMP] Extend NVPTX SPMD implementation of combined constructs
Carlo Bertolli [Wed, 28 Feb 2018 20:48:35 +0000 (20:48 +0000)]
[OpenMP] Extend NVPTX SPMD implementation of combined constructs

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

This patch extends the SPMD implementation to all target constructs and guards this implementation under a new flag.

llvm-svn: 326368

6 years agoRevert "[lldb] Use vFlash commands when writing to target's flash memory regions"
Pavel Labath [Wed, 28 Feb 2018 20:42:29 +0000 (20:42 +0000)]
Revert "[lldb] Use vFlash commands when writing to target's flash memory regions"

This reverts commit r326261 as it introduces inconsistencies in the
handling of load addresses for ObjectFileELF -- some parts of the class
use physical addresses, and some use virtual. This has manifested itself
as us not being able to set the load address of the vdso "module" on
android.

llvm-svn: 326367

6 years ago[Hexagon] Add -ffixed-r19 driver option and translate it to +reserved-r19
Krzysztof Parzyszek [Wed, 28 Feb 2018 20:31:55 +0000 (20:31 +0000)]
[Hexagon] Add -ffixed-r19 driver option and translate it to +reserved-r19

llvm-svn: 326366

6 years ago[clangd] Try to fix failures on clang-x64-ninja-win7 build bot.
Eric Liu [Wed, 28 Feb 2018 20:31:00 +0000 (20:31 +0000)]
[clangd] Try to fix failures on clang-x64-ninja-win7 build bot.

llvm-svn: 326365

6 years ago[Hexagon] Implement target feature +reserved-r19
Krzysztof Parzyszek [Wed, 28 Feb 2018 20:29:36 +0000 (20:29 +0000)]
[Hexagon] Implement target feature +reserved-r19

llvm-svn: 326364

6 years agoWrite some tests as linker scripts instead of assembly files.
Rui Ueyama [Wed, 28 Feb 2018 20:22:42 +0000 (20:22 +0000)]
Write some tests as linker scripts instead of assembly files.

Some linker script test cases contain only a few lines of assembly
and a long linker script. Such tests are easier to maintain if we
write the main test file as a linkier script instead of assembly.

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

llvm-svn: 326363

6 years agoCodeGenObjCXX: handle inalloca appropriately for msgSend variant
Saleem Abdulrasool [Wed, 28 Feb 2018 20:16:12 +0000 (20:16 +0000)]
CodeGenObjCXX: handle inalloca appropriately for msgSend variant

objc_msgSend_stret takes a hidden parameter for the returned structure's
address for the construction.  When the function signature is rewritten
for the inalloca passing, the return type is no longer marked as
indirect but rather inalloca stret.  This enhances the test for the
indirect return to check for that case as well.  This fixes the
incorrect return classification for Windows x86.

llvm-svn: 326362

6 years ago[InstCombine] Split the FP constant code out of lookThroughFPExtensions and use nullp...
Craig Topper [Wed, 28 Feb 2018 20:14:34 +0000 (20:14 +0000)]
[InstCombine] Split the FP constant code out of lookThroughFPExtensions and use nullptr as a sentinel

Currently this code's control flow very much assumes that there are no meaningful checks after determining that it's a ConstantFP. So whenever it wants to stop it just does "return V". But V is also the variable name it uses when it wants to return a new value. So 'return V' appears multiple times with different meanings.

This patch just moves all the code into a helper function and returns nullptr when it wants to stop.

I've split this from D43774 while I try to figure out how to best handle the vector case there. But this change by itself at least seemed like a readability improvement.

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

llvm-svn: 326361

6 years agoAttempt to build breakage caused by r326339.
Rui Ueyama [Wed, 28 Feb 2018 20:11:33 +0000 (20:11 +0000)]
Attempt to build breakage caused by r326339.

clang-format automatically sorted the #include lines, but I believe
Windows.h needs to be included before Dbghelp.h.

llvm-svn: 326360

6 years agoLosen time contraint to accommodate system loads
Lei Huang [Wed, 28 Feb 2018 20:05:24 +0000 (20:05 +0000)]
Losen time contraint to accommodate system loads

llvm-svn: 326359

6 years agoFix llvm-config --system-libs output on FreeBSD and NetBSD
Dimitry Andric [Wed, 28 Feb 2018 20:04:21 +0000 (20:04 +0000)]
Fix llvm-config --system-libs output on FreeBSD and NetBSD

Summary:
For various reasons, CMake's detection mechanism for `backtrace()`
returns an absolute path `/usr/lib/libexecinfo.so` on FreeBSD and
NetBSD.

Since `tools/llvm-config/CMakeLists.txt` only checks if system
libraries start with `-`, this causes `llvm-config --system-libs` to
produce the following incorrect output:

```
-lrt -l/usr/lib/libexecinfo.so -ltinfo -lpthread -lz -lm
```

Fix it by removing the path and the `lib` prefix, to make it look like a
regular short library name, suitable for appending to a `-l` link flag.

This also fixes the `Bindings/Go/go.test` test case, since that always
died with "unable to find library -l/usr/lib/libexecinfo.so".

Reviewers: chandlerc, emaste, joerg, krytarowski

Reviewed By: krytarowski

Subscribers: hans, bdrewery, mgorny, hintonda, llvm-commits

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

llvm-svn: 326358

6 years ago[clang-cl] Implement /X
Nico Weber [Wed, 28 Feb 2018 19:49:07 +0000 (19:49 +0000)]
[clang-cl] Implement /X

/X makes cl stop looking in %INCLUDE%. Implement this for clang-cl.

As it turns out, the return in ToolChains/MSVC.cpp, AddClangSystemIncludeArgs()
for -nostdlibinc is already in the right place (but -nostdlibinc isn't exposed
by clang-cl), so just alias /X to that.

https://reviews.llvm.org/D43888

llvm-svn: 326357

6 years ago[WebAssembly] Remove unneeded --no-gc-sections flag from tests. NFC.
Sam Clegg [Wed, 28 Feb 2018 19:40:03 +0000 (19:40 +0000)]
[WebAssembly] Remove unneeded --no-gc-sections flag from tests. NFC.

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

llvm-svn: 326356