platform/upstream/llvm.git
6 years agoFix signed/unsigned comparison warning. NFCI.
Simon Pilgrim [Fri, 16 Feb 2018 17:26:59 +0000 (17:26 +0000)]
Fix signed/unsigned comparison warning. NFCI.

llvm-svn: 325363

6 years ago[ThinLTO] Fix data race in test #2
Eugene Leviant [Fri, 16 Feb 2018 17:25:03 +0000 (17:25 +0000)]
[ThinLTO] Fix data race in test #2

Switched to the right option (-thinlto-threads)

llvm-svn: 325362

6 years ago[ThinLTO] Fix data race in test
Eugene Leviant [Fri, 16 Feb 2018 16:56:33 +0000 (16:56 +0000)]
[ThinLTO] Fix data race in test

llvm-svn: 325361

6 years agoSimplify RelocationBaseSection::addReloc.
Rafael Espindola [Fri, 16 Feb 2018 16:53:04 +0000 (16:53 +0000)]
Simplify RelocationBaseSection::addReloc.

Now that we have R_ADDEND, UseSymVA was redundant. We only want to
write the symbol virtual address when using an expression other than
R_ADDEND.

llvm-svn: 325360

6 years agoFix signed/unsigned comparison warning. NFCI.
Simon Pilgrim [Fri, 16 Feb 2018 16:52:50 +0000 (16:52 +0000)]
Fix signed/unsigned comparison warning. NFCI.

llvm-svn: 325359

6 years ago[InstCombine] remove redundant debug info setting; NFC
Sanjay Patel [Fri, 16 Feb 2018 16:42:04 +0000 (16:42 +0000)]
[InstCombine] remove redundant debug info setting; NFC

The IRBuilder sets debuginfo in Insert(), so this was duplicating what already happened.

llvm-svn: 325358

6 years ago[clangd] Include timestamps in log messages.
Sam McCall [Fri, 16 Feb 2018 16:41:42 +0000 (16:41 +0000)]
[clangd] Include timestamps in log messages.

llvm-svn: 325357

6 years ago[JumpThreading] PR36133 enable/disable DominatorTree for LVI analysis
Brian M. Rzycki [Fri, 16 Feb 2018 16:35:17 +0000 (16:35 +0000)]
[JumpThreading] PR36133 enable/disable DominatorTree for LVI analysis

Summary:
The LazyValueInfo pass caches a copy of the DominatorTree when available.
Whenever there are pending DominatorTree updates within JumpThreading's
DeferredDominance object we cannot use the cached DT for LVI analysis.
This commit adds the new methods enableDT() and disableDT() to LVI.
JumpThreading also sets the appropriate usage model before calling LVI
analysis methods.

Fixes https://bugs.llvm.org/show_bug.cgi?id=36133

Reviewers: sebpop, dberlin, kuhar

Reviewed by: sebpop, kuhar

Subscribers: uabelho, llvm-commits, aprantl, hiraditya, a.elovikov

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

llvm-svn: 325356

6 years agoAMDGPU/SI: Turn off GPR Indexing Mode immediately after the interested instruction.
Changpeng Fang [Fri, 16 Feb 2018 16:31:30 +0000 (16:31 +0000)]
AMDGPU/SI: Turn off GPR Indexing Mode immediately after the interested instruction.

Summary:
  In the current implementation of GPR Indexing Mode when the index is of non-uniform, the s_set_gpr_idx_off instruction
is incorrectly inserted after the loop. This will lead the instructions with vgpr operands (v_readfirstlane for example) to read incorrect
vgpr.
 In this patch, we fix the issue by inserting s_set_gpr_idx_on/off immediately around the interested instruction.

Reviewers:
  rampitec

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

llvm-svn: 325355

6 years ago[SelectionDAG] Enable SimplifyDemandedVectorElts support for simplifying shuffle...
Simon Pilgrim [Fri, 16 Feb 2018 16:22:14 +0000 (16:22 +0000)]
[SelectionDAG] Enable SimplifyDemandedVectorElts support for simplifying shuffle masks

Based off the DemandedElts mask the and UNDEF elements returned from the SimplifyDemandedVectorElts calls to the shuffle operands, we can attempt to simplify the shuffle mask.

I had to be very conservative here as accepting post-legalized shuffle masks could cause problems for targets that legalize UNDEF mask elements back to inrange values (PowerPC), similarly combining to identity shuffle masks could cause too much UNDEF information to disappear for later combines.

llvm-svn: 325354

6 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Fri, 16 Feb 2018 16:13:20 +0000 (16:13 +0000)]
[InstCombine] reduce code duplication; NFC

llvm-svn: 325353

6 years agoUse Token::isOneOf method in Parser.
Frederich Munch [Fri, 16 Feb 2018 16:07:33 +0000 (16:07 +0000)]
Use Token::isOneOf method in Parser.

Summary: Easier to read and possibly optimize.

Reviewers: rsmith, sepavloff

Reviewed By: sepavloff

Subscribers: sepavloff, cfe-commits

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

llvm-svn: 325352

6 years ago[ARM] Add tests for the vcvtr builtins
Sjoerd Meijer [Fri, 16 Feb 2018 16:01:08 +0000 (16:01 +0000)]
[ARM] Add tests for the vcvtr builtins

This adds Sema and Codegen tests for the vcvtr builtins
(because they were missing).

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

llvm-svn: 325351

6 years ago[X86][SSE] Allow float domain crossing if we are merging 2 or more shuffles and the...
Simon Pilgrim [Fri, 16 Feb 2018 14:57:25 +0000 (14:57 +0000)]
[X86][SSE] Allow float domain crossing if we are merging 2 or more shuffles and the root started as a float domain shuffle

llvm-svn: 325349

6 years ago[PowerPC] Fix transform in table gen file causing UB
Nemanja Ivanovic [Fri, 16 Feb 2018 14:49:01 +0000 (14:49 +0000)]
[PowerPC] Fix transform in table gen file causing UB

Running a bootstrap build with UBSan produces a number of instances where
we have signed integer overflow due to this transform. Change the type to
long to prevent this UB on 64-bit build machines.

llvm-svn: 325347

6 years ago[clangd] remove redundant ';' introduced in r325343
Eric Liu [Fri, 16 Feb 2018 14:47:08 +0000 (14:47 +0000)]
[clangd] remove redundant ';' introduced in r325343

llvm-svn: 325346

6 years agoAdd initial XRay support for NetBSD
Kamil Rytarowski [Fri, 16 Feb 2018 14:45:20 +0000 (14:45 +0000)]
Add initial XRay support for NetBSD

Summary:
Reuse the existing FreeBSD code as it is.

Sponsored by <The NetBSD Foundation>

Reviewers: dberris, rnk, vitalybuka

Reviewed By: dberris

Subscribers: mclow.lists, emaste, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 325345

6 years ago[clangd] collect symbol #include & insert #include in global code completion.
Eric Liu [Fri, 16 Feb 2018 14:15:55 +0000 (14:15 +0000)]
[clangd] collect symbol #include & insert #include in global code completion.

Summary:
o Collect suitable #include paths for index symbols. This also does smart mapping
for STL symbols and IWYU pragma (code borrowed from include-fixer).
o For global code completion, add a command for inserting new #include in each code
completion item.

Reviewers: sammccall

Reviewed By: sammccall

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

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

llvm-svn: 325343

6 years ago[Coroutines] Use target-agnostic size_t in test
Brian Gesiak [Fri, 16 Feb 2018 14:11:27 +0000 (14:11 +0000)]
[Coroutines] Use target-agnostic size_t in test

Summary:
Fix a test failure on ARM hosts that was caused by a difference in the type of
size_t, by using a target-agnostic definiton.

Test Plan:
```
clang -cc1 -internal-isystem build/lib/clang/7.0.0/include -nostdsysteminc \
      -std=c++14 -fcoroutines-ts -verify clang/test/SemaCXX/coroutines.cpp \
      -fcxx-exceptions -fexceptions \
      -triple armeb-none-eabi
```

llvm-svn: 325342

6 years ago[mips] Remove codegen support from some 16 bit instructions
Simon Dardis [Fri, 16 Feb 2018 13:34:23 +0000 (13:34 +0000)]
[mips] Remove codegen support from some 16 bit instructions

These instructions conflict with their full length variants
for the purposes of FastISel as they cannot be distingushed
based on the number and type of operands and predicates.

Reviewers: atanasyan

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

llvm-svn: 325341

6 years agoShorten socket names in TestPlatformProcessConnect
Pavel Labath [Fri, 16 Feb 2018 12:57:35 +0000 (12:57 +0000)]
Shorten socket names in TestPlatformProcessConnect

The test was generating long unix socket names, and the addition of a
new folder in the previous patch pushed it over the limit (although
linux has a fairly generous limit for path names, this does not apply to
unix sockets).

Modify the test to use a shorter name instead.

llvm-svn: 325340

6 years agoRe-enable lang/objc/modules/TestObjCModules
Jonas Devlieghere [Fri, 16 Feb 2018 12:33:10 +0000 (12:33 +0000)]
Re-enable lang/objc/modules/TestObjCModules

The reason this test was disabled is no longer relevant. However, it
didn't turn into an unexpected success because of a syntax error in the
test itself. This commit fixes that and re-enables the test.

llvm-svn: 325339

6 years ago[SelectionDAG] Add initial SimplifyDemandedVectorElts support for simplifying VSELECT...
Simon Pilgrim [Fri, 16 Feb 2018 12:21:08 +0000 (12:21 +0000)]
[SelectionDAG] Add initial SimplifyDemandedVectorElts support for simplifying VSELECT operands

This just adds a basic pass through - we can add constant selection mask handling in a future patch to fully match InstCombine.

llvm-svn: 325338

6 years ago[clangd] Assert path is absolute when assigning to URIForFile.
Ilya Biryukov [Fri, 16 Feb 2018 12:20:47 +0000 (12:20 +0000)]
[clangd] Assert path is absolute when assigning to URIForFile.

Summary:
The assertion will point directly to misbehaving code, so that
debugging related problems (like the one fixed by r325029) is easier.

Reviewers: hokein, ioeric, sammccall

Reviewed By: sammccall

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 325337

6 years ago[clang-format] Enable google text proto formatting in R"proto('s
Krasimir Georgiev [Fri, 16 Feb 2018 12:10:06 +0000 (12:10 +0000)]
[clang-format] Enable google text proto formatting in R"proto('s

llvm-svn: 325336

6 years agoRevert r325321 "[Sema] Take into account the current context when checking the"
Hans Wennborg [Fri, 16 Feb 2018 12:06:32 +0000 (12:06 +0000)]
Revert r325321 "[Sema] Take into account the current context when checking the"

This broke the Chromium build, see https://crbug.com/813017

> accessibility of a class member.
>
> This fixes PR32898.
>
> rdar://problem/33737747
>
> Differential revision: https://reviews.llvm.org/D36918

llvm-svn: 325335

6 years agoFix paralelization of remote tests
Pavel Labath [Fri, 16 Feb 2018 11:39:38 +0000 (11:39 +0000)]
Fix paralelization of remote tests

Since we now can run multiple tests from the same directory at once, we
need to include the test name in the remote test directory instead.

I'm not sure if the test_number in the remote path is necessary anymore
(or even if it was ever necessary), but I choose to leave it in for now.

llvm-svn: 325334

6 years ago[ELF] Extend symbol-order-warnings test case for ICF
James Henderson [Fri, 16 Feb 2018 10:49:57 +0000 (10:49 +0000)]
[ELF] Extend symbol-order-warnings test case for ICF

Reviewed by: rafael

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

There is some discussion as to the exact behaviour of combining ICF and
--symbol-ordering-file, but it seems beneficial to warn when attempting
to order the removed symbol regardless of the preferred approach.

llvm-svn: 325333

6 years ago[ELF] - Fix comment. NFC.
George Rimar [Fri, 16 Feb 2018 10:46:50 +0000 (10:46 +0000)]
[ELF] - Fix comment. NFC.

Addresses forgotten comment for D43071.

llvm-svn: 325332

6 years ago[ELF] - Support COPY, INFO, OVERLAY output sections attributes.
George Rimar [Fri, 16 Feb 2018 10:42:58 +0000 (10:42 +0000)]
[ELF] - Support COPY, INFO, OVERLAY output sections attributes.

This is PR36298.

(COPY), (INFO), (OVERLAY) all have the same effect:
section should be marked as non-allocatable.

(https://www.eecs.umich.edu/courses/eecs373/readings/Linker.pdf,
3.6.8.1 Output Section Type)

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

llvm-svn: 325331

6 years ago[Transforms] Propagate TBAA info in SROA
Ivan A. Kosarev [Fri, 16 Feb 2018 10:10:29 +0000 (10:10 +0000)]
[Transforms] Propagate TBAA info in SROA

Now that we have the new TBAA metadata format that is capable of
representing accesses to aggregates, we can propagate TBAA access
tags from memory setting and transferring intrinsics to load and
store instructions and vice versa.

Since SROA produces lots of new loads and stores on optimized
builds, this change significantly decreases the share of
undecorated memory accesses on such builds.

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

llvm-svn: 325329

6 years agoEnsure that Elf_Rel addends are always written for dynamic relocations
Alexander Richardson [Fri, 16 Feb 2018 10:01:17 +0000 (10:01 +0000)]
Ensure that Elf_Rel addends are always written for dynamic relocations

Summary:
This follows up on r321889 where writing of Elf_Rel addends was partially
moved to RelocationBaseSection. This patch ensures that the addends are
always written to the output section when a input section uses RELA but the
output is REL.

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

llvm-svn: 325328

6 years ago[ARM] Return true in enableMultipleCopyHints().
Jonas Paulsson [Fri, 16 Feb 2018 09:51:01 +0000 (09:51 +0000)]
[ARM]  Return true in enableMultipleCopyHints().

Enable multiple COPY hints to eliminate more COPYs during register allocation.

Note that this is something all targets should do, see
https://reviews.llvm.org/D38128.

Review: Eli Friedman
llvm-svn: 325327

6 years ago[clangd] TestFS cleanup: getVirtualBlahBlah -> testPath/testRoot. Remove SmallString...
Sam McCall [Fri, 16 Feb 2018 09:41:43 +0000 (09:41 +0000)]
[clangd] TestFS cleanup: getVirtualBlahBlah -> testPath/testRoot. Remove SmallString micro-opt for more ergonomic tests. NFC

llvm-svn: 325326

6 years ago[LegalizeDAG] Fix legalization of SETCC
Mikhail Maltsev [Fri, 16 Feb 2018 09:35:16 +0000 (09:35 +0000)]
[LegalizeDAG] Fix legalization of SETCC

Summary:
Currently when expanding a SETCC node into a SELECT_CC, LLVM uses
an incorrect type for determining BooleanContent of the result. This
patch fixes the issue.

Fixes PR36079.

Reviewers: rogfer01, javed.absar, efriedma

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 325325

6 years ago[lldb][PPC64] Fixed vector and struct return value
Pavel Labath [Fri, 16 Feb 2018 09:29:41 +0000 (09:29 +0000)]
[lldb][PPC64] Fixed vector and struct return value

Summary:
The PowerPC64 ABI plugin was modified to:

- properly handle vector type return values
- implement support for struct/class return values

A refactoring in the code that handles return values was also performed, to make it possible to handle structs without repeating (when possible) code that handles its fields.

There was also an issue with CreateInstance(), that only created an instance in the first time it was called and then cached it in a static var. When restarting a process under LLDB's control, the ABI's process weak pointer would become null, and using it would result in a segmentation fault. This issue became more evident after the latest changes to PPC64 plugin, that now uses the process pointer to get the target byte order, making LLDB to seg fault when restarting a program. This was fixed by making CreateInstance() to always create a new ABI instance.

All of LLDB's ReturnValue tests are passing for PPC64le now. It should work for PPC64be too, although this was not tested.

Reviewers: labath, clayborg

Reviewed By: labath

Subscribers: lbianc, anajuliapc, llvm-commits, alexandreyy, nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D42468
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 325324

6 years ago[ARM] Materialise some boolean values to avoid a branch
Roger Ferrer Ibanez [Fri, 16 Feb 2018 09:23:59 +0000 (09:23 +0000)]
[ARM] Materialise some boolean values to avoid a branch

This patch combines some cases of ARMISD::CMOV for integers that arise in comparisons of the form

  a != b ? x : 0
  a == b ? 0 : x

and that currently (e.g. in Thumb1) are emitted as branches.

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

llvm-svn: 325323

6 years ago[dosep] Run tests in a more parallel fashion
Pavel Labath [Fri, 16 Feb 2018 09:21:11 +0000 (09:21 +0000)]
[dosep] Run tests in a more parallel fashion

Summary:
Due to in-tree builds, we were parallelizing the tests at the directory
level. Now that the tests are built out-of-tree, we can remove this
limitation and paralelize at file level instead.

This decreases test suite time by about 10% for me, which is not
world-shattering, but it makes the code slightly simpler and will also
allow us to merge tests which were artificially spread over multiple
folders (TestConcurrentEvents...) to work-around this limitation.

To make this work, I've also needed to include the test file name in the
build directory name, as just the test method name is not unique enough
(plenty of tests have a test method called "test" or similar).

While doing this, I've found a couple of tests that are taking waaay longer then
they ought to (TestBreakpointCaseSensitivity -- 90 seconds), which I plan to
look into in the future.

Reviewers: aprantl

Subscribers: lldb-commits

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

llvm-svn: 325322

6 years ago[Sema] Take into account the current context when checking the
Akira Hatanaka [Fri, 16 Feb 2018 08:47:37 +0000 (08:47 +0000)]
[Sema] Take into account the current context when checking the
accessibility of a class member.

This fixes PR32898.

rdar://problem/33737747

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

llvm-svn: 325321

6 years ago[ThinLTO] Import global variables
Eugene Leviant [Fri, 16 Feb 2018 08:11:04 +0000 (08:11 +0000)]
[ThinLTO] Import global variables

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

llvm-svn: 325320

6 years ago[Coverage] Handle break/continue outside of loop bodies
Vedant Kumar [Fri, 16 Feb 2018 07:59:43 +0000 (07:59 +0000)]
[Coverage] Handle break/continue outside of loop bodies

Teach the coverage mapping logic to handle break or continue statements
within for loop increments.

Fixes llvm.org/PR36406.

llvm-svn: 325319

6 years ago[X86] Allow CMOVs of constants to be sign extended from i32.
Craig Topper [Fri, 16 Feb 2018 07:16:15 +0000 (07:16 +0000)]
[X86] Allow CMOVs of constants to be sign extended from i32.

Sign extending i32 constants only requires a REX prefix as does widening the CMOV. This is cheaper than the explicit sign extend op.

llvm-svn: 325318

6 years ago[X86] Don't zero_extend cmov up to i64, stop at i32.
Craig Topper [Fri, 16 Feb 2018 06:52:43 +0000 (06:52 +0000)]
[X86] Don't zero_extend cmov up to i64, stop at i32.

Zero extend from i32 to i64 is free. So extend from i16 to i32, and then use a free zero extend to finish.

llvm-svn: 325317

6 years agoFix an issue that weak bit is dropped when there's a lazy object symbol.
Rui Ueyama [Fri, 16 Feb 2018 04:27:46 +0000 (04:27 +0000)]
Fix an issue that weak bit is dropped when there's a lazy object symbol.

Previously, we accidentally dropped STB_WEAK bit from an undefined symbol
if there is a lazy object symbol with the same name. That caused a
compatibility issue with GNU gold.

llvm-svn: 325316

6 years agoReintroduce FreeBSD support in test/xray
Kamil Rytarowski [Fri, 16 Feb 2018 04:20:33 +0000 (04:20 +0000)]
Reintroduce FreeBSD support in test/xray

Tested by Douglas Yung.

The original patch from D43278 has been reverted.

New patch by myself.

llvm-svn: 325315

6 years ago[ELF] Fix use after free in case of using --whole-archive.
Igor Kudrin [Fri, 16 Feb 2018 03:26:53 +0000 (03:26 +0000)]
[ELF] Fix use after free in case of using --whole-archive.

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

llvm-svn: 325313

6 years ago[DOXYGEN] There was a request in the review D41507 to change the notation for hex...
Ekaterina Romanova [Fri, 16 Feb 2018 03:11:35 +0000 (03:11 +0000)]
[DOXYGEN] There was a request in the review D41507 to change the notation for hex numbers in doxygen documentation from <...>h to 0x<...>. Both of these notations were used in x86 intrinsics documentation. I promised to change them to 0x<...> for consistency.

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

llvm-svn: 325312

6 years ago[APInt] Fix extractBits to correctly handle Result.isSingleWord() case.
Tim Shen [Fri, 16 Feb 2018 01:44:36 +0000 (01:44 +0000)]
[APInt] Fix extractBits to correctly handle Result.isSingleWord() case.

Summary: extractBits assumes that `!this->isSingleWord() implies !Result.isSingleWord()`, which may not necessarily be true. Handle both cases.

Reviewers: RKSimon

Subscribers: sanjoy, llvm-commits, hiraditya

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

llvm-svn: 325311

6 years agoRemove brittle check lines from a test, NFC
Vedant Kumar [Fri, 16 Feb 2018 01:21:01 +0000 (01:21 +0000)]
Remove brittle check lines from a test, NFC

llvm-svn: 325310

6 years agoRevert part of SVN r. 325240 in lit.cfg
Kamil Rytarowski [Fri, 16 Feb 2018 01:16:06 +0000 (01:16 +0000)]
Revert part of SVN r. 325240 in lit.cfg

The original change broke a llvm-clang-lld-x86_64-debian setup.

This change will be investigated and reintroduced in future.

Original commit:

  "Add Xray instrumentation support to FreeBSD"
  https://reviews.llvm.org/D43278

llvm-svn: 325309

6 years ago[GVN] Partially revert debug info salvage change (r325063)
Vedant Kumar [Fri, 16 Feb 2018 01:15:20 +0000 (01:15 +0000)]
[GVN] Partially revert debug info salvage change (r325063)

In r325063, we salvaged debug values from dying instructions in
GVN::processBlock() and GVN::performScalarPRE().

The change in performScalarPRE(), while correct, is unhelpful. It
introduced a call to salvageDebugInfo() which was immediately followed
by a RAUW, meaning it prevented the RAUW from efficiently updating
dbg.value intrinsics.  This commit reverts the mistake and tightens up
the affected test case.

llvm-svn: 325308

6 years agoRelax relocation type checking in a non-ALLOC section.
Rui Ueyama [Fri, 16 Feb 2018 01:10:51 +0000 (01:10 +0000)]
Relax relocation type checking in a non-ALLOC section.

Even though it doesn't make sense, there seems to be multiple programs
in the wild that create PC-relative relocations in non-ALLOC sections.
I believe this is caused by the negligence of GNU linkers to not report
any errors for such relocations.

Currently, lld emits warnings against such relocations and exits.
So, you cannot link any program that contains wrong relocations until
you fix an issue in a program that generates wrong ELF files. It's often
impractical to fix a program because it's not always easy.

This patch relaxes the error checking and emit a warning instead.

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

llvm-svn: 325307

6 years ago[X86] Add the test cases that were supposed to go with r325287.
Craig Topper [Fri, 16 Feb 2018 00:39:05 +0000 (00:39 +0000)]
[X86] Add the test cases that were supposed to go with r325287.

llvm-svn: 325306

6 years ago[Modules] Extend -fmodule-name semantic for frameworks with private modules
Bruno Cardoso Lopes [Fri, 16 Feb 2018 00:12:57 +0000 (00:12 +0000)]
[Modules] Extend -fmodule-name semantic for frameworks with private modules

Assume Foo.framework with two module maps and two modules Foo and
Foo_Private.

Framework authors need to skip building both Foo and Foo_Private when
using -fmodule-name=Foo, since both are part of the framework and used
interchangeably during compilation.

rdar://problem/37500098

llvm-svn: 325305

6 years ago[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.
Alexey Bataev [Thu, 15 Feb 2018 23:39:43 +0000 (23:39 +0000)]
[OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.

Codegen for ordered with doacross construct might produce incorrect code
because of missing cleanup scope for the construct. Without this scope
the final runtime function call could be emitted in the wrong order that
leads to incorrect codegen.

llvm-svn: 325304

6 years agoAllow 0 to be a valid value pruning interval in C LTO API. Value 0 will cause garbage...
Ekaterina Romanova [Thu, 15 Feb 2018 23:29:21 +0000 (23:29 +0000)]
Allow 0 to be a valid value pruning interval in C LTO API. Value 0 will cause garbage collector to run. This matches the behavior in C++ LTO API.

llvm-svn: 325303

6 years ago[OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with depend sink...
Alexey Bataev [Thu, 15 Feb 2018 22:42:57 +0000 (22:42 +0000)]
[OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with depend sink|source clause.

Patch fixes compiler crash on standalone #pragmas ordered with
depend(sink|source) clauses.

llvm-svn: 325302

6 years ago[DCE] Salvage debug info from dead insts
Vedant Kumar [Thu, 15 Feb 2018 22:26:18 +0000 (22:26 +0000)]
[DCE] Salvage debug info from dead insts

This results in small increases in the size of the .debug_loc section
and the number of unique source variables in a stage2 build of opt.

llvm-svn: 325301

6 years ago[asan] Add "arm64" into the list of 64-bit architectures
Kuba Mracek [Thu, 15 Feb 2018 22:14:36 +0000 (22:14 +0000)]
[asan] Add "arm64" into the list of 64-bit architectures

It looks like get_bits_for_arch doesn't recognize "arm64" as a 64-bit architecture, and it actually matches the "arm" regexp, which marks it as 32-bit. Let's fix that by matching the 64-bit list first and addin "arm64" into the list.

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

llvm-svn: 325300

6 years ago[AMDGPU] Combine adjacent waitcounts in a single strongest wait
Stanislav Mekhanoshin [Thu, 15 Feb 2018 22:03:55 +0000 (22:03 +0000)]
[AMDGPU] Combine adjacent waitcounts in a single strongest wait

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

llvm-svn: 325299

6 years ago[include-fixer] Add more debug headers to the STL header list
Benjamin Kramer [Thu, 15 Feb 2018 21:37:29 +0000 (21:37 +0000)]
[include-fixer] Add more debug headers to the STL header list

These are used for std::map/std::set in STL debug mode.

llvm-svn: 325298

6 years ago[Debugify] Don't check functions which were skipped
Vedant Kumar [Thu, 15 Feb 2018 21:28:38 +0000 (21:28 +0000)]
[Debugify] Don't check functions which were skipped

If no debug info was applied to a function, its debug info shouldn't be
checked (it doesn't have any :).

llvm-svn: 325297

6 years agoDon't make PDBs by default in Release mode
Reid Kleckner [Thu, 15 Feb 2018 21:25:23 +0000 (21:25 +0000)]
Don't make PDBs by default in Release mode

Introduce the LLVM_ENABLE_PDB option so that users can request them
explicitly instead.

Add /OPT:REF and /OPT:ICF back, which /DEBUG disables by default.

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

llvm-svn: 325296

6 years ago[X86][3DNOW] Teach decoder about AMD 3DNow! instrs
Rafael Auler [Thu, 15 Feb 2018 21:20:31 +0000 (21:20 +0000)]
[X86][3DNOW] Teach decoder about AMD 3DNow! instrs

Summary:
This patch makes the decoder understand old AMD 3DNow!
instructions that have never been properly supported in the X86
disassembler, despite being supported in other subsystems. Hopefully
this should make the X86 decoder more complete with respect to binaries
containing legacy code.

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits, maksfb, bruno

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

llvm-svn: 325295

6 years ago[opt] Port the debugify passes to the new pass manager
Vedant Kumar [Thu, 15 Feb 2018 21:14:36 +0000 (21:14 +0000)]
[opt] Port the debugify passes to the new pass manager

llvm-svn: 325294

6 years agoSilence a -Wparentheses warning; NFC.
Aaron Ballman [Thu, 15 Feb 2018 21:03:39 +0000 (21:03 +0000)]
Silence a -Wparentheses warning; NFC.

llvm-svn: 325293

6 years agoSilence some -Wunused-variable warnings; NFC.
Aaron Ballman [Thu, 15 Feb 2018 20:56:19 +0000 (20:56 +0000)]
Silence some -Wunused-variable warnings; NFC.

llvm-svn: 325292

6 years ago[Coroutines] Use allocator overload when available
Brian Gesiak [Thu, 15 Feb 2018 20:37:22 +0000 (20:37 +0000)]
[Coroutines] Use allocator overload when available

Summary:
Depends on https://reviews.llvm.org/D42605.

An implementation of the behavior described in `[dcl.fct.def.coroutine]/7`:
when a promise type overloads `operator new` using a "placement new"
that takes the same argument types as the coroutine function, that
overload is used when allocating the coroutine frame.

Simply passing references to the coroutine function parameters directly
to `operator new` results in invariant violations in LLVM's coroutine
splitting pass, so this implementation modifies Clang codegen to
produce allocator-specific alloc/store/loads for each parameter being
forwarded to the allocator.

Test Plan: `check-clang`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: lewissbaker, EricWF, cfe-commits

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

llvm-svn: 325291

6 years ago[X86] Enable BT to be used in place of TEST for single bit checks under optsize
Craig Topper [Thu, 15 Feb 2018 20:27:30 +0000 (20:27 +0000)]
[X86] Enable BT to be used in place of TEST for single bit checks under optsize

We already do this for 64-bit when it won't fit into a 64-bit AND/TEST's immediate field. This adds an additional qualifier to do it for any single bit constant larger than 8-bits under optsize

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

llvm-svn: 325290

6 years ago[DAGCombiner] Call ExtendUsesToFormExtLoad in (zext (and (load)))->(and (zextload...
Craig Topper [Thu, 15 Feb 2018 20:20:32 +0000 (20:20 +0000)]
[DAGCombiner] Call ExtendUsesToFormExtLoad in (zext (and (load)))->(and (zextload)) even when the and does not have multiple uses

Same for the sign extend case.

Currently we check for multiple uses on the binop. Then we call ExtendUsesToFormExtLoad to capture SetCCs that use the load. So we only end up finding any setccs when the and has additional uses and the load is used by a setcc. I don't think the and having multiple uses is relevant here. I think we should only be checking for the load having multiple uses.

This changes an NVPTX test because we now find that the load has a second use by a truncate, but ExtendUsesToFormExtLoad only looks at setccs it can extend. All other operations just check isTruncateFree. Maybe we should allow widening of an existing truncate even if its not free?

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

llvm-svn: 325289

6 years ago[Sema] Toggle diags when finding allocators (NFCI)
Brian Gesiak [Thu, 15 Feb 2018 20:09:25 +0000 (20:09 +0000)]
[Sema] Toggle diags when finding allocators (NFCI)

Summary:
Many methods in Sema take a `bool Diagnose` parameter. Examples of such
methods include `Sema::FindDeallocationFunction` and
`Sema::SpecialMemberIsTrivial`. Calling these methods with
`Diagnose = false` allows callers to, for instance, check for the
existence of a deallocation function, without that check resulting in
error diagnostics being emitted if no matching deallocation function exists.

Add a similar `bool Diagnose` to the `Sema::FindAllocationFunctions`
method, so that checks for the existence of allocation functions can be
made without triggering error diagnostics.

This allows `SemaCoroutine.cpp`, in its implementation of the
Coroutines TS, to check for the existence of a particular `operator new`
overload, but then without error fall back to a default `operator new`
if no matching overload exists.

Test Plan: `check-clang`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 325288

6 years ago[X86] Use btc/btr/bts to implement xor/and/or that affects a single bit in the upper...
Craig Topper [Thu, 15 Feb 2018 19:57:35 +0000 (19:57 +0000)]
[X86] Use btc/btr/bts to implement xor/and/or that affects a single bit in the upper 32-bits of a 64-bit operation.

We can't fold a large immediate into a 64-bit operation. But if we know we're only operating on a single bit we can use the bit instructions.

For now only do this for optsize.

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

llvm-svn: 325287

6 years ago[analyzer] Suppress temporary destructors for temporary arrays.
Artem Dergachev [Thu, 15 Feb 2018 19:34:19 +0000 (19:34 +0000)]
[analyzer] Suppress temporary destructors for temporary arrays.

Array destructors, like constructors, need to be called for each element of the
array separately. We do not have any mechanisms to do this in the analyzer,
so for now all we do is evaluate a single constructor or destructor
conservatively and give up. It automatically causes the necessary invalidation
and pointer escape for the whole array, because this is how RegionStore works.

Implement this conservative behavior for temporary destructors. This fixes the
crash on the provided test.

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

llvm-svn: 325286

6 years ago[Coroutines] Don't move stores for allocator args
Brian Gesiak [Thu, 15 Feb 2018 19:31:45 +0000 (19:31 +0000)]
[Coroutines] Don't move stores for allocator args

Summary:
The behavior described in Coroutines TS `[dcl.fct.def.coroutine]/7`
allows coroutine parameters to be passed into allocator functions.
The instructions to store values into the alloca'd parameters must not
be moved past the frame allocation, otherwise uninitialized values are
passed to the allocator.

Test Plan: `check-llvm`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: compnerd, EricWF, llvm-commits

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

llvm-svn: 325285

6 years ago[analyzer] Implement path notes for temporary destructors.
Artem Dergachev [Thu, 15 Feb 2018 19:28:21 +0000 (19:28 +0000)]
[analyzer] Implement path notes for temporary destructors.

Temporary destructors fire at the end of the full-expression. It is reasonable
to attach the path note for entering/leaving the temporary destructor to its
CXXBindTemporaryExpr. This would not affect lifetime-extended temporaries with
their automatic destructors which aren't temporary destructors.

The path note may be confusing in the case of destructors after elidable copy
constructors.

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

llvm-svn: 325284

6 years ago[ARM] Fix redirect in inline assembly test
Pablo Barrio [Thu, 15 Feb 2018 19:17:55 +0000 (19:17 +0000)]
[ARM] Fix redirect in inline assembly test

Summary: Fix silly mistake in a test

Reviewers: gkistanova, apilipenko

Subscribers: javed.absar, eraman, kristof.beyls, llvm-commits

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

llvm-svn: 325283

6 years ago[analyzer] Compute the correct this-region for temporary destructors.
Artem Dergachev [Thu, 15 Feb 2018 19:17:44 +0000 (19:17 +0000)]
[analyzer] Compute the correct this-region for temporary destructors.

Inline them if possible - a separate flag is added to control this.
The whole thing is under the cfg-temporary-dtors flag, off by default so far.

Temporary destructors are called at the end of full-expression. If the
temporary is lifetime-extended, automatic destructors kick in instead,
which are not addressed in this patch, and normally already work well
modulo the overally broken support for lifetime extension.

The patch operates by attaching the this-region to the CXXBindTemporaryExpr in
the program state, and then recalling it during destruction that was triggered
by that CXXBindTemporaryExpr. It has become possible because
CXXBindTemporaryExpr is part of the construction context since r325210.

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

llvm-svn: 325282

6 years ago[SCCP] Test that constant propagation updates debug info, NFC
Vedant Kumar [Thu, 15 Feb 2018 19:13:04 +0000 (19:13 +0000)]
[SCCP] Test that constant propagation updates debug info, NFC

This extends an existing test to check that SCCP updates the operands of
relevant dbg.value instructions as it does its work.

llvm-svn: 325281

6 years ago[Utils] salvageDI: Add a comment and move a call earlier, NFC
Vedant Kumar [Thu, 15 Feb 2018 19:13:03 +0000 (19:13 +0000)]
[Utils] salvageDI: Add a comment and move a call earlier, NFC

llvm-svn: 325280

6 years agoClean up AMDGCN tests
Yaxun Liu [Thu, 15 Feb 2018 19:12:41 +0000 (19:12 +0000)]
Clean up AMDGCN tests

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

llvm-svn: 325279

6 years ago[analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().
Artem Dergachev [Thu, 15 Feb 2018 19:01:55 +0000 (19:01 +0000)]
[analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().

Don't look at the parent statement to figure out if the cxx-allocator-inlining
flag should kick in and prevent us from inlining the constructor within
a new-expression. We now have construction contexts for that purpose.

llvm-svn: 325278

6 years ago[X86] Add test cases for opportunities for using BT instead of TEST under optsize.
Craig Topper [Thu, 15 Feb 2018 19:00:11 +0000 (19:00 +0000)]
[X86] Add test cases for opportunities for using BT instead of TEST under optsize.

llvm-svn: 325277

6 years ago[TSan] Fix static TLS boundaries calculations in __tls_get_addr interceptor.
Alex Shlyapnikov [Thu, 15 Feb 2018 18:58:31 +0000 (18:58 +0000)]
[TSan] Fix static TLS boundaries calculations in __tls_get_addr interceptor.

Summary:
DTLS_on_tls_get_addr expects (tls_addr + tls_size) as the last
parameter, static_tls_end.

Reviewers: dvyukov

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

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

llvm-svn: 325276

6 years agoSilence warning about unused private variable.
Zachary Turner [Thu, 15 Feb 2018 18:46:59 +0000 (18:46 +0000)]
Silence warning about unused private variable.

llvm-svn: 325275

6 years agoCall FlushFileBuffers on output files.
Zachary Turner [Thu, 15 Feb 2018 18:36:10 +0000 (18:36 +0000)]
Call FlushFileBuffers on output files.

There is a latent Windows kernel bug, the exact trigger
conditions are not well understood, which can cause a file
to be correctly written, but unable to be correctly read.

The workaround appears to be simply calling FlushFileBuffers.

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

llvm-svn: 325274

6 years ago[WebAssembly] Restore "*-wasm" tests.
Dan Gohman [Thu, 15 Feb 2018 18:05:16 +0000 (18:05 +0000)]
[WebAssembly] Restore "*-wasm" tests.

Even though "...-wasm" is now the default for wasm, it's still
desirable to test this form.

llvm-svn: 325273

6 years ago[clang-tidy] Add `readability-simd-intrinsics` check.
Fangrui Song [Thu, 15 Feb 2018 17:56:43 +0000 (17:56 +0000)]
[clang-tidy] Add `readability-simd-intrinsics` check.

Summary:
Many architectures provide SIMD operations (e.g. x86 SSE/AVX, Power AltiVec/VSX,
ARM NEON). It is common that SIMD code implementing the same algorithm, is
written in multiple target-dispatching pieces to optimize for different
architectures or micro-architectures.

The C++ standard proposal P0214 and its extensions cover many common SIMD
operations. By migrating from target-dependent intrinsics to P0214 operations,
the SIMD code can be simplified and pieces for different targets can be unified.

Refer to http://wg21.link/p0214 for introduction and motivation for the
data-parallel standard library.

Subscribers: klimek, aemerson, mgorny, xazax.hun, kristof.beyls, hintonda, cfe-commits

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

llvm-svn: 325272

6 years ago[Test] Remove mangled name from test.
Matt Davis [Thu, 15 Feb 2018 17:55:52 +0000 (17:55 +0000)]
[Test] Remove mangled name from test.

This line is not needed in the test, and breaks Windows testing.
Fixes the test added in r325175.

llvm-svn: 325271

6 years ago[X86][SSE] Add saturated truncation tests for storing illegal v8i8 types
Simon Pilgrim [Thu, 15 Feb 2018 17:48:34 +0000 (17:48 +0000)]
[X86][SSE] Add saturated truncation tests for storing illegal v8i8 types

Tests showing missing opportunities to use PACK instructions in cases where we need to truncate to illegal types for stores

llvm-svn: 325270

6 years agoRecommit [Hexagon] Make the vararg handling a bit more robust
Krzysztof Parzyszek [Thu, 15 Feb 2018 17:20:07 +0000 (17:20 +0000)]
Recommit [Hexagon] Make the vararg handling a bit more robust

Use the FunctionType of the callee when it's available. It may not be
available for synthetic calls to functions specified by external symbols.

llvm-svn: 325269

6 years ago[SLP] Fix the test for the reversed stores, NFC.
Alexey Bataev [Thu, 15 Feb 2018 17:11:50 +0000 (17:11 +0000)]
[SLP] Fix the test for the reversed stores, NFC.

llvm-svn: 325268

6 years agobpf: fix a bug in dag2dag optimization for loads from readonly section
Yonghong Song [Thu, 15 Feb 2018 17:06:45 +0000 (17:06 +0000)]
bpf: fix a bug in dag2dag optimization for loads from readonly section

The reference '&' is missing in the function parameter. If there are
back-to-back optimizations in terms of dag node list like below:
  t29: i64,ch = load<LD4[bitcast (%struct.test_t* @test.t to i8*)+12](dereferenceable), zext from i32> t3, t43, undef:i64
  t34: i64,ch = load<LD4[bitcast (%struct.test_t* @test.t to i8*)](dereferenceable), zext from i32> t3, t41, undef:i64
The bug will trigger a segfault for the added test case remove_truncate_5.ll:
  LLVMSymbolizer: error reading file: No such file or directory
  #0 0x000000000241c4d9 (llc+0x241c4d9)
  #1 0x000000000241c56a (llc+0x241c56a)
  #2 0x000000000241aa50 (llc+0x241aa50)
  ...
  #22 0x0000000000fd5edf (llc+0xfd5edf)
  #23 0x00007f0fe03bec05 __libc_start_main (/lib64/libc.so.6+0x21c05)
  #24 0x0000000000fd3e69 (llc+0xfd3e69)
  ...
  Segmentation fault

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 325267

6 years agoRevert "[Hexagon] Make the vararg handling a bit more robust"
Krzysztof Parzyszek [Thu, 15 Feb 2018 16:57:44 +0000 (16:57 +0000)]
Revert "[Hexagon] Make the vararg handling a bit more robust"

This is breaking lit tests.

llvm-svn: 325266

6 years ago[SLP] Added test for reversed stores, NFC.
Alexey Bataev [Thu, 15 Feb 2018 16:56:49 +0000 (16:56 +0000)]
[SLP] Added test for reversed stores, NFC.

llvm-svn: 325265

6 years ago[OpenCL] Fix __enqueue_block for block with captures
Yaxun Liu [Thu, 15 Feb 2018 16:39:19 +0000 (16:39 +0000)]
[OpenCL] Fix __enqueue_block for block with captures

The following test case causes issue with codegen of __enqueue_block

void (^block)(void) = ^{ callee(id, out); };

enqueue_kernel(queue, 0, ndrange, block);
Clang first does codegen for block expression in the first line and deletes its block info.
Clang then tries to do codegen for the same block expression again for the second line,
and fails because the block info is gone.

The fix is to do normal codegen for both lines. Introduce an API to OpenCL runtime to
record llvm block invoke function and llvm block literal emitted for each AST block
expression, and use the recorded information for generating the wrapper kernel.

The EmitBlockLiteral APIs are cleaned up to minimize changes to the normal codegen
of blocks.

Another minor issue is that some clean up AST expression is generated for block
with captures, which can be stripped by IgnoreImplicit.

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

llvm-svn: 325264

6 years ago[InstCombine] use m_OneUse to reduce code; NFC
Sanjay Patel [Thu, 15 Feb 2018 16:30:10 +0000 (16:30 +0000)]
[InstCombine] use m_OneUse to reduce code; NFC

llvm-svn: 325263

6 years ago[InstCombine] test fdiv folds better; NFC
Sanjay Patel [Thu, 15 Feb 2018 16:28:15 +0000 (16:28 +0000)]
[InstCombine] test fdiv folds better; NFC

We had redundant tests, but no tests for extra uses or vectors.
'fast' is an overly conservative requirement for these folds.

llvm-svn: 325262

6 years agoAmend r325256. This change was not properly merged locally before the commit happened.
Aaron Ballman [Thu, 15 Feb 2018 16:28:10 +0000 (16:28 +0000)]
Amend r325256. This change was not properly merged locally before the commit happened.

llvm-svn: 325261

6 years ago[clangd] Create trace::Span when running ASTCallback
Ilya Biryukov [Thu, 15 Feb 2018 16:24:34 +0000 (16:24 +0000)]
[clangd] Create trace::Span when running ASTCallback

llvm-svn: 325260

6 years ago[Hexagon] Make the vararg handling a bit more robust
Krzysztof Parzyszek [Thu, 15 Feb 2018 16:24:30 +0000 (16:24 +0000)]
[Hexagon] Make the vararg handling a bit more robust

The FunctionType of the callee is always available, even if the Function
of the callee is not. Use that to get the number of fixed parameters.

llvm-svn: 325259