platform/upstream/llvm.git
7 years ago[scudo] Add a shared runtime
Kostya Kortchinsky [Mon, 23 Oct 2017 16:27:47 +0000 (16:27 +0000)]
[scudo] Add a shared runtime

Summary:
Up to now, the Scudo cmake target only provided a static library that had to be
linked to an executable to benefit from the hardened allocator.
This introduces a shared library as well, that can be LD_PRELOAD'ed.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, mgorny, llvm-commits

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

llvm-svn: 316342

7 years ago[MachineOutliner] NFC: Rename getters/setters to fit coding style
Jessica Paquette [Mon, 23 Oct 2017 16:25:53 +0000 (16:25 +0000)]
[MachineOutliner] NFC: Rename getters/setters to fit coding style

Rename endIdx, startIdx, and length to getEndIdx, getStartIdx, and getLength
in Candidate.

llvm-svn: 316341

7 years ago[X86] Change VMPTRST to use PS instead of TB to match VMPTRLD.
Craig Topper [Mon, 23 Oct 2017 16:22:40 +0000 (16:22 +0000)]
[X86] Change VMPTRST to use PS instead of TB to match VMPTRLD.

llvm-svn: 316340

7 years ago[X86] Change RDRAND to use PS instead of TB.
Craig Topper [Mon, 23 Oct 2017 16:22:38 +0000 (16:22 +0000)]
[X86] Change RDRAND to use PS instead of TB.

Should be no functional change for now. A future disassembler change will prevent disassembling with 0xf2/0xf3.

llvm-svn: 316339

7 years agoPull X86 "CPUKind" checking into .cpp file. [NFC]
Erich Keane [Mon, 23 Oct 2017 16:20:15 +0000 (16:20 +0000)]
Pull X86 "CPUKind" checking into .cpp file. [NFC]

Preparing to do a refactor of CPU/feature checking, this
patch pulls the one CPU implementation from the .h file
to the .cpp file.

llvm-svn: 316338

7 years ago[X86] Change XRSTOR to use PS instead of TB to match XSAVE.
Craig Topper [Mon, 23 Oct 2017 16:11:33 +0000 (16:11 +0000)]
[X86] Change XRSTOR to use PS instead of TB to match XSAVE.

I don't think this changes anything functionally yet, but I plan to fix the disassembler to use this to disable matching certain instructions with 0xf3/0xf2/0x66 prefixes.

llvm-svn: 316337

7 years ago[X86][SSE] Remove AssertZext stage from PEXTRW/PEXTRB lowering. NFCI.
Simon Pilgrim [Mon, 23 Oct 2017 16:00:57 +0000 (16:00 +0000)]
[X86][SSE] Remove AssertZext stage from PEXTRW/PEXTRB lowering. NFCI.

Remove AssertZext and instead add PEXTRW/PEXTRB support to computeKnownBitsForTargetNode to simplify instruction selection.

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

llvm-svn: 316336

7 years agoclang-cl: Expose --version.
Nico Weber [Mon, 23 Oct 2017 15:54:44 +0000 (15:54 +0000)]
clang-cl: Expose --version.

This is for consistency with lld-link, see https://reviews.llvm.org/D38972
Also give --version a help text so it shows up in --help / /? output (for
both clang-cl and regular clang).

llvm-svn: 316335

7 years agoUpdate DPPD/DPPS instruction scheduling on btver2.
Andrew V. Tischenko [Mon, 23 Oct 2017 15:53:30 +0000 (15:53 +0000)]
Update DPPD/DPPS instruction scheduling on btver2.
Differential Revision: https://reviews.llvm.org/D39046

llvm-svn: 316334

7 years ago[X86] Add PTWRITE instruction for assembler and disassembler.
Craig Topper [Mon, 23 Oct 2017 15:53:21 +0000 (15:53 +0000)]
[X86] Add PTWRITE instruction for assembler and disassembler.

llvm-svn: 316333

7 years ago[X86] Add RDPID instruction for assembler and disassembler.
Craig Topper [Mon, 23 Oct 2017 15:53:16 +0000 (15:53 +0000)]
[X86] Add RDPID instruction for assembler and disassembler.

llvm-svn: 316332

7 years ago[DAGCombine] Permit combining of shuffles of equivalent splat BUILD_VECTORs
Simon Pilgrim [Mon, 23 Oct 2017 15:48:08 +0000 (15:48 +0000)]
[DAGCombine] Permit combining of shuffles of equivalent splat BUILD_VECTORs

combineShuffleOfScalars is very conservative about shuffled BUILD_VECTORs that can be combined together.

This patch adds one additional case - if both BUILD_VECTORs represent splats of the same scalar value but with different UNDEF elements, then we should create a single splat BUILD_VECTOR, sharing only the UNDEF elements defined by the shuffle mask.

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

llvm-svn: 316331

7 years agoSupport formatting formatv_objects.
Sam McCall [Mon, 23 Oct 2017 15:40:44 +0000 (15:40 +0000)]
Support formatting formatv_objects.

Summary:
Support formatting formatv_objects.

While here, fix documentation about member-formatters, and attempted
perfect-forwarding (I think).

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 316330

7 years agoAdd the --version option.
Rui Ueyama [Mon, 23 Oct 2017 14:57:53 +0000 (14:57 +0000)]
Add the --version option.

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

llvm-svn: 316329

7 years ago[X86][SSE] Regenerate bitcast-and-setcc tests
Simon Pilgrim [Mon, 23 Oct 2017 14:47:49 +0000 (14:47 +0000)]
[X86][SSE] Regenerate bitcast-and-setcc tests

Avoid the retl/retq changes in an upcoming patch

llvm-svn: 316328

7 years ago[clangd] Allow to pass code completion opts to ClangdServer.
Ilya Biryukov [Mon, 23 Oct 2017 14:46:48 +0000 (14:46 +0000)]
[clangd] Allow to pass code completion opts to ClangdServer.

Reviewers: bkramer, krasimir, sammccall

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 316327

7 years ago[X86][AVX2] Regenerate AVX2 intrinsics tests on 32 + 64-bit targets
Simon Pilgrim [Mon, 23 Oct 2017 14:19:46 +0000 (14:19 +0000)]
[X86][AVX2] Regenerate AVX2 intrinsics tests on 32 + 64-bit targets

llvm-svn: 316326

7 years ago[X86][AVX] Regenerate AVX intrinsics tests on 32 + 64-bit targets
Simon Pilgrim [Mon, 23 Oct 2017 14:17:59 +0000 (14:17 +0000)]
[X86][AVX] Regenerate AVX intrinsics tests on 32 + 64-bit targets

llvm-svn: 316325

7 years ago[X86][F16C] Regenerate F16C schedule tests
Simon Pilgrim [Mon, 23 Oct 2017 14:15:24 +0000 (14:15 +0000)]
[X86][F16C] Regenerate F16C schedule tests

llvm-svn: 316324

7 years ago[clangd] Updated outdated test comment. NFC.
Ilya Biryukov [Mon, 23 Oct 2017 14:08:52 +0000 (14:08 +0000)]
[clangd] Updated outdated test comment. NFC.

llvm-svn: 316323

7 years agoTest commit.
Artur Gainullin [Mon, 23 Oct 2017 13:25:49 +0000 (13:25 +0000)]
Test commit.

llvm-svn: 316322

7 years ago[llvm-dwarfdump] - Teach tool about few GNU call_sites constants.
George Rimar [Mon, 23 Oct 2017 11:24:14 +0000 (11:24 +0000)]
[llvm-dwarfdump] - Teach tool about few GNU call_sites constants.

This teaches tool about following consants:
DW_TAG_GNU_call_site,
DW_TAG_GNU_call_site_parameter,
DW_AT_GNU_call_site_value,
DW_AT_GNU_all_call_sites.

Constants documented here: https://sourceware.org/elfutils/DwarfExtensions

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

llvm-svn: 316321

7 years ago[X86] Add test for opportunity to use bzhi X86 instruction instead of load+and instru...
Ayman Musa [Mon, 23 Oct 2017 10:24:19 +0000 (10:24 +0000)]
[X86] Add test for opportunity to use bzhi X86 instruction instead of load+and instructions.

Transformation uploaded for CR in https://reviews.llvm.org/D34141.

llvm-svn: 316320

7 years agoFix for Bug 30718 - Failure to disassemble certain MOV with rex.R. The issue was...
Andrew V. Tischenko [Mon, 23 Oct 2017 09:36:33 +0000 (09:36 +0000)]
Fix for Bug 30718 - Failure to disassemble certain MOV with rex.R. The issue was in illegal segment register index.
Differential Revision: https://reviews.llvm.org/D38786

llvm-svn: 316319

7 years ago[MinGW] Omit libc++/libc++abi/libunwind from autoexporting
Martin Storsjo [Mon, 23 Oct 2017 09:08:28 +0000 (09:08 +0000)]
[MinGW] Omit libc++/libc++abi/libunwind from autoexporting

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

llvm-svn: 316318

7 years ago[COFF] Fix exporting of functions starting with underscores, etc
Martin Storsjo [Mon, 23 Oct 2017 09:08:24 +0000 (09:08 +0000)]
[COFF] Fix exporting of functions starting with underscores, etc

This fixes exporting functions in the following cases:
- functions starting with an underscore in def files
- functions starting with an underscore, via dllexport attributes, for mingw
- fastcall and vectorcall functions when declared undecorated in def files
- vectorcall functions when declared decorated in def files
- stdcall functions when declared decorated in def files for mingw

This still exports the stdcall functions with the wrong name
in the normal msvc/link.exe mode, if declared with decoration in
the def file though (this is not a regression though). Exporting
functions via def files including decoration is not something I
believe is routinely done though, but is tested to try to match
link.exe's behaviour as far as easily possible.

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

llvm-svn: 316317

7 years ago[COFF] Improve the check for functions that should get an extra underscore
Martin Storsjo [Mon, 23 Oct 2017 09:08:13 +0000 (09:08 +0000)]
[COFF] Improve the check for functions that should get an extra underscore

This fixes exporting functions starting with an underscore, and
fully decorated fastcall/vectorcall functions.

Tests will be added in the lld repo.

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

llvm-svn: 316316

7 years agoFix a -Wpedantic warning.
Haojian Wu [Mon, 23 Oct 2017 09:02:59 +0000 (09:02 +0000)]
Fix a -Wpedantic warning.

llvm-svn: 316315

7 years ago[rename] Don't overwrite the template argument when renaming a template function.
Haojian Wu [Mon, 23 Oct 2017 08:58:50 +0000 (08:58 +0000)]
[rename] Don't overwrite the template argument when renaming a template function.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cierpuchaw, cfe-commits, klimek

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

llvm-svn: 316314

7 years ago[ARM] Allow unrolling of multi-block loops.
Sam Parker [Mon, 23 Oct 2017 08:05:14 +0000 (08:05 +0000)]
[ARM] Allow unrolling of multi-block loops.

Before, loop unrolling was only enabled for loops with a single
block. This restriction has been removed and replaced by:
- allow a maximum of two exiting blocks,
- a four basic block limit for cores with a branch predictor.

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

llvm-svn: 316313

7 years ago[clangd] Report proper kinds for 'Keyword' and 'Snippet' completion items.
Ilya Biryukov [Mon, 23 Oct 2017 06:06:21 +0000 (06:06 +0000)]
[clangd] Report proper kinds for 'Keyword' and 'Snippet' completion items.

Reviewers: rwols, malaperle, krasimir, bkramer, sammccall

Reviewed By: rwols, sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 316311

7 years agoFor better compatibility with C++11 and C++14, emit a nondiscardable definition
Richard Smith [Mon, 23 Oct 2017 03:58:34 +0000 (03:58 +0000)]
For better compatibility with C++11 and C++14, emit a nondiscardable definition
of a static constexpr data member if it's defined 'constexpr' out of line, not
only if it's defined 'constexpr' in the class.

llvm-svn: 316310

7 years ago[X86] Update a doxygen comment in the disassembler tablegen code. NFC
Craig Topper [Mon, 23 Oct 2017 03:42:35 +0000 (03:42 +0000)]
[X86] Update a doxygen comment in the disassembler tablegen code. NFC

llvm-svn: 316309

7 years ago[X86] Fix disassembly of EVEX rounding control and SAE instructions.
Craig Topper [Mon, 23 Oct 2017 02:26:24 +0000 (02:26 +0000)]
[X86] Fix disassembly of EVEX rounding control and SAE instructions.

Fixes PR31955.

llvm-svn: 316308

7 years ago[ELF] When placing orphans, handle case when last section is dead
Petr Hosek [Mon, 23 Oct 2017 00:51:08 +0000 (00:51 +0000)]
[ELF] When placing orphans, handle case when last section is dead

r315292 introduced a change that's supposed to consistently ignore
"dead" output sections when placing orphans. Unfortunately, that
change doesn't handle the special case when the orphan section is
second to last section and the last section is dead (e.g. because
it's being discarded) introducing a regression in some cases.

This change handles this case by using the same predicate when
checking the last section.

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

llvm-svn: 316307

7 years agoAdd R_PPC_ADDR16_HI relocation support
Rui Ueyama [Sun, 22 Oct 2017 23:33:49 +0000 (23:33 +0000)]
Add R_PPC_ADDR16_HI relocation support

The support of R_PPC_ADDR16_HI improves ld compatibility and makes
things on par with RuntimeDyldELF that already implements this
relocation.

Patch by vit9696.

llvm-svn: 316306

7 years agoRemove a fast lookup table from MergeInputSection.
Rui Ueyama [Sun, 22 Oct 2017 23:02:07 +0000 (23:02 +0000)]
Remove a fast lookup table from MergeInputSection.

We used to have a map from section piece offsets to section pieces
as a cache for binary search. But I found that the map took quite a
large amount of memory and didn't make linking faster. So, in this
patch, I removed the map.

This patch saves 566 MiB of RAM (2.019 GiB -> 1.453 GiB) when linking
clang with debug info, and the link time is 4% faster in that test case.

Thanks for Sean Silva for pointing this out.

llvm-svn: 316305

7 years ago[c++2a] Update cxx_status w __VA_OPT__ marked as completed in SVN.
Faisal Vali [Sun, 22 Oct 2017 22:29:52 +0000 (22:29 +0000)]
[c++2a] Update cxx_status w __VA_OPT__ marked as completed in SVN.

llvm-svn: 316304

7 years agoExecutionEngine: make COFF Thumb2 assertions non-tautological
Saleem Abdulrasool [Sun, 22 Oct 2017 20:51:25 +0000 (20:51 +0000)]
ExecutionEngine: make COFF Thumb2 assertions non-tautological

The overflow detection assertions were tautological due to truncation.
Adjust them to no longer be tautological.

Patch by Alex Langford!

llvm-svn: 316303

7 years agoFix invalid ptrtoint in InstCombine
Yichao Yu [Sun, 22 Oct 2017 20:28:17 +0000 (20:28 +0000)]
Fix invalid ptrtoint in InstCombine

Summary:
It's unclear if this is the only thing we can do but at least this is consistent with the check
of address space agreement in `isBitCastable`.

The code is used at least in both instcombine and jumpthreading though
I could only find a way to trigger the invalid cast in instcombine.

Reviewers: loladiro, sanjoy, majnemer

Reviewed By: sanjoy

Subscribers: llvm-commits

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

llvm-svn: 316302

7 years agoCreate fewer copies of StringMaps. No functionality change intended.
Benjamin Kramer [Sun, 22 Oct 2017 20:16:28 +0000 (20:16 +0000)]
Create fewer copies of StringMaps. No functionality change intended.

llvm-svn: 316301

7 years agoMake HIDDEN_DIRECTIVE a function-like macro. NFCI.
Martin Storsjo [Sun, 22 Oct 2017 19:39:26 +0000 (19:39 +0000)]
Make HIDDEN_DIRECTIVE a function-like macro. NFCI.

This avoids a hack for making it a no-op for windows.

Also explicitly check for _WIN32 instead of assuming it.

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

llvm-svn: 316300

7 years ago[X86] Add missing override. NFC.
Benjamin Kramer [Sun, 22 Oct 2017 19:16:31 +0000 (19:16 +0000)]
[X86] Add missing override. NFC.

llvm-svn: 316299

7 years ago[SimplifyCFG] delay switch condition forwarding to -latesimplifycfg
Sanjay Patel [Sun, 22 Oct 2017 19:10:07 +0000 (19:10 +0000)]
[SimplifyCFG] delay switch condition forwarding to -latesimplifycfg

As discussed in D39011:
https://reviews.llvm.org/D39011
...replacing constants with a variable is inverting the transform done
by other IR passes, so we definitely don't want to do this early.
In fact, it's questionable whether this transform belongs in SimplifyCFG
at all. I'll look at moving this to codegen as a follow-up step.

llvm-svn: 316298

7 years ago[utils] Support -mtriple=powerpc64
Fangrui Song [Sun, 22 Oct 2017 18:43:23 +0000 (18:43 +0000)]
[utils] Support -mtriple=powerpc64

Summary: test/CodeGen/PowerPC/pr33093.ll uses both powerpc64 (big-endian) and powerpc64le while the former was unsupported.

Subscribers: nemanjai

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

llvm-svn: 316297

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Sun, 22 Oct 2017 18:38:57 +0000 (18:38 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 316296

7 years agoAdd logic to greedy reg alloc to avoid bad eviction chains
Marina Yatsina [Sun, 22 Oct 2017 17:59:38 +0000 (17:59 +0000)]
Add logic to greedy reg alloc to avoid bad eviction chains

This fixes bugzilla 26810
https://bugs.llvm.org/show_bug.cgi?id=26810

This is intended to prevent sequences like:
movl %ebp, 8(%esp) # 4-byte Spill
movl %ecx, %ebp
movl %ebx, %ecx
movl %edi, %ebx
movl %edx, %edi
cltd
idivl %esi
movl %edi, %edx
movl %ebx, %edi
movl %ecx, %ebx
movl %ebp, %ecx
movl 16(%esp), %ebp # 4 - byte Reload

Such sequences are created in 2 scenarios:

Scenario #1:
vreg0 is evicted from physreg0 by vreg1
Evictee vreg0 is intended for region splitting with split candidate physreg0 (the reg vreg0 was evicted from)
Region splitting creates a local interval because of interference with the evictor vreg1 (normally region spliiting creates 2 interval, the "by reg" and "by stack" intervals. Local interval created when interference occurs.)
one of the split intervals ends up evicting vreg2 from physreg1
Evictee vreg2 is intended for region splitting with split candidate physreg1
one of the split intervals ends up evicting vreg3 from physreg2 etc.. until someone spills

Scenario #2
vreg0 is evicted from physreg0 by vreg1
vreg2 is evicted from physreg2 by vreg3 etc
Evictee vreg0 is intended for region splitting with split candidate physreg1
Region splitting creates a local interval because of interference with the evictor vreg1
one of the split intervals ends up evicting back original evictor vreg1 from physreg0 (the reg vreg0 was evicted from)
Another evictee vreg2 is intended for region splitting with split candidate physreg1
one of the split intervals ends up evicting vreg3 from physreg2 etc.. until someone spills

As compile time was a concern, I've added a flag to control weather we do cost calculations for local intervals we expect to be created (it's on by default for X86 target, off for the rest).

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

Change-Id: Id9411ff7bbb845463d289ba2ae97737a1ee7cc39
llvm-svn: 316295

7 years ago[X86] More correctly support LIG and WIG for EVEX instructions in the disassembler...
Craig Topper [Sun, 22 Oct 2017 17:22:29 +0000 (17:22 +0000)]
[X86] More correctly support LIG and WIG for EVEX instructions in the disassembler tables.

This is similar to how we generate the VEX tables.

More fixes are still needed for the instructions that use EVEX.b (broadcast and embedded rounding).

llvm-svn: 316294

7 years ago[SimplifyCFG] try harder to forward switch condition to phi (PR34471)
Sanjay Patel [Sun, 22 Oct 2017 16:51:03 +0000 (16:51 +0000)]
[SimplifyCFG] try harder to forward switch condition to phi (PR34471)

The missed canonicalization/optimization in the motivating test from PR34471 leads to very different codegen:

  int switcher(int x) {
      switch(x) {
      case 17: return 17;
      case 19: return 19;
      case 42: return 42;
      default: break;
      }
      return 0;
    }

  int comparator(int x) {
    if (x == 17) return 17;
    if (x == 19) return 19;
    if (x == 42) return 42;
    return 0;
  }

For the first example, we use a bit-test optimization to avoid a series of compare-and-branch:
https://godbolt.org/g/BivDsw

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

llvm-svn: 316293

7 years ago[C++17] Fix PR34970 - tweak overload resolution for class template deduction-guides...
Faisal Vali [Sun, 22 Oct 2017 14:45:08 +0000 (14:45 +0000)]
[C++17] Fix PR34970 - tweak overload resolution for class template deduction-guides in line with WG21's p0620r0.

In order to identify the copy deduction candidate, I considered two approaches:
  - attempt to determine whether an implicit guide is a copy deduction candidate by checking certain properties of its subsituted parameter during overload-resolution.
  - using one of the many bits (WillHaveBody) from FunctionDecl (that CXXDeductionGuideDecl inherits from) that are otherwise irrelevant for deduction guides

After some brittle gymnastics w the first strategy, I settled on the second, although to avoid confusion and to give that bit a better name, i turned it into a member of an anonymous union.

Given this identification 'bit', the tweak to overload resolution was a simple reordering of the deduction guide checks (in SemaOverload.cpp::isBetterOverloadCandidate), in-line with Jason Merrill's p0620r0 drafting which made it into the working paper.  Concordant with that, I made sure the copy deduction candidate is always added.

References:
See https://bugs.llvm.org/show_bug.cgi?id=34970
See http://wg21.link/p0620r0

llvm-svn: 316292

7 years agoshared: Implement aligned vector stores (vstorea_half)
Jan Vesely [Sun, 22 Oct 2017 14:21:59 +0000 (14:21 +0000)]
shared: Implement aligned vector stores (vstorea_half)

Float version passes newly posted piglit tests on turks, float and double pass on carrizo.
v2: scalar vstorea_half
v3: fix typo

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 316291

7 years agoshared: Implement aligned vector loads (vloada_half)
Jan Vesely [Sun, 22 Oct 2017 14:21:56 +0000 (14:21 +0000)]
shared: Implement aligned vector loads (vloada_half)

Passes newly posted piglits on turks and carrizo
v2: add scalar vloada_half
v3: fix typo

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 316290

7 years ago[ARM] Dynamic stack alignment for 16-bit Thumb
Momchil Velikov [Sun, 22 Oct 2017 11:56:35 +0000 (11:56 +0000)]
[ARM] Dynamic stack alignment for 16-bit Thumb

This patch implements dynamic stack (re-)alignment for 16-bit Thumb. When
targeting processors, which support only the 16-bit Thumb instruction set
the compiler ignores the alignment attributes of automatic variables and may
silently generate incorrect code.

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

llvm-svn: 316289

7 years ago[X86] Add a pass to convert instruction chains between domains.
Guy Blank [Sun, 22 Oct 2017 11:43:08 +0000 (11:43 +0000)]
[X86] Add a pass to convert instruction chains between domains.

The pass scans the function to find instruction chains that define
registers in the same domain (closures).
It then calculates the cost of converting the closure to another domain.
If found profitable, the instructions are converted to instructions in
the other domain and the register classes are changed accordingly.

This commit adds the pass infrastructure and a simple conversion from
the GPR domain to the Mask domain.

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

Change-Id: Ic2cf1d76598110401168326d411128ae2580a604
llvm-svn: 316288

7 years ago[mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in RuntimeDyld.
Nitesh Jain [Sun, 22 Oct 2017 09:47:41 +0000 (09:47 +0000)]
[mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in RuntimeDyld.

Reviewers: sdardis

Subscribers: jaydeep, bhushan, llvm-commits

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

llvm-svn: 316287

7 years ago[Compiler-rt][MIPS] Fix cross build for XRAY.
Nitesh Jain [Sun, 22 Oct 2017 09:37:50 +0000 (09:37 +0000)]
[Compiler-rt][MIPS] Fix cross build for XRAY.

Reviewers: dberris, sdardis

Subscribers: jaydeep, bhushan, llvm-commits

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

llvm-svn: 316286

7 years ago[X86] Teach the disassembler that some instructions use VEX.W==0 without a correspond...
Craig Topper [Sun, 22 Oct 2017 06:18:26 +0000 (06:18 +0000)]
[X86] Teach the disassembler that some instructions use VEX.W==0 without a corresponding VEX.W==1 instruction and we shouldn't treat them as if VEX.W is ignored.

Fixes PR11304.

llvm-svn: 316285

7 years ago[X86] Add VEX_WIG to applicable AVX512 instructions.
Craig Topper [Sun, 22 Oct 2017 06:18:23 +0000 (06:18 +0000)]
[X86] Add VEX_WIG to applicable AVX512 instructions.

This should be NFC. Will be used in future patches to fix disassembler bugs.

llvm-svn: 316284

7 years ago[X86] Add VEX_WIG to VROUNDSSrr/VROUNDSSrm/VROUNDSDrr/VROUNDSDrm
Craig Topper [Sun, 22 Oct 2017 06:18:20 +0000 (06:18 +0000)]
[X86] Add VEX_WIG to VROUNDSSrr/VROUNDSSrm/VROUNDSDrr/VROUNDSDrm

llvm-svn: 316283

7 years ago[X86] Don't allow gather/scatter to disassembler if memory operand does not use a...
Craig Topper [Sun, 22 Oct 2017 04:32:30 +0000 (04:32 +0000)]
[X86] Don't allow gather/scatter to disassembler if memory operand does not use a SIB byte.

Fixes PR34998.

llvm-svn: 316282

7 years agoSimplify.
Rui Ueyama [Sun, 22 Oct 2017 01:58:30 +0000 (01:58 +0000)]
Simplify.

llvm-svn: 316281

7 years agoAssume that mergeable input sections are smaller than 4 GiB.
Rui Ueyama [Sat, 21 Oct 2017 23:20:13 +0000 (23:20 +0000)]
Assume that mergeable input sections are smaller than 4 GiB.

By assuming that mergeable input sections are smaller than 4 GiB,
lld's memory usage when linking clang with debug info drops from
2.788 GiB to 2.019 GiB (measured by valgrind, and that does not include
memory space for mmap'ed files). I think that's a reasonable assumption
given such a large RAM savings, so this patch.

According to valgrind, gold needs 3.54 GiB of RAM to do the same thing.

NB: This patch does not introduce a limitation on the size of
output sections. You can still create sections larger than 4 GiB.

llvm-svn: 316280

7 years agoReverting r316278 due to failing build bots.
Aaron Ballman [Sat, 21 Oct 2017 21:52:48 +0000 (21:52 +0000)]
Reverting r316278 due to failing build bots.

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/11896
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/12380

llvm-svn: 316279

7 years ago[libclang, bindings]: add spelling location
Masud Rahman [Sat, 21 Oct 2017 20:53:49 +0000 (20:53 +0000)]
[libclang, bindings]: add spelling location

 o) Add a 'Location' class that represents the four properties of a
    physical location

 o) Enhance 'SourceLocation' to provide 'expansion' and 'spelling'
    locations, maintaining backwards compatibility with existing code by
    forwarding the four properties to 'expansion'.

 o) Update the implementation to use 'clang_getExpansionLocation'
    instead of the deprecated 'clang_getInstantiationLocation', which
    has been present since 2011.

 o) Update the implementation of 'clang_getSpellingLocation' to actually
    obtain spelling location instead of file location.

llvm-svn: 316278

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Sat, 21 Oct 2017 20:40:49 +0000 (20:40 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 316277

7 years agoReverting r316270 due to failing build bots.
Aaron Ballman [Sat, 21 Oct 2017 20:38:15 +0000 (20:38 +0000)]
Reverting r316270 due to failing build bots.

http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/12899
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/7951

llvm-svn: 316276

7 years agoFix a typo with -fno-double-square-bracket-attributes and add a test to demonstrate...
Aaron Ballman [Sat, 21 Oct 2017 20:28:58 +0000 (20:28 +0000)]
Fix a typo with -fno-double-square-bracket-attributes and add a test to demonstrate that it works as expected in C++11 mode. Additionally corrected the handling of -fdouble-square-bracket-attributes to be properly passed down to the cc1 option.

llvm-svn: 316275

7 years ago[X86][SSE] Add extractps/pextrd equivalence to domain tables
Simon Pilgrim [Sat, 21 Oct 2017 20:19:48 +0000 (20:19 +0000)]
[X86][SSE] Add extractps/pextrd equivalence to domain tables

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

llvm-svn: 316274

7 years ago[X86] Fix disassembling of EVEX instructions to stop accidentally decoding the SIB...
Craig Topper [Sat, 21 Oct 2017 20:03:20 +0000 (20:03 +0000)]
[X86] Fix disassembling of EVEX instructions to stop accidentally decoding the SIB index register as an XMM/YMM/ZMM register.

This introduces a new operand type to encode the whether the index register should be XMM/YMM/ZMM. And new code to fixup the results created by readSIB.

This has the nice effect of removing a bunch of code that hard coded the name of every GATHER and SCATTER instruction to map the index type.

This fixes PR32807.

llvm-svn: 316273

7 years agoFix MSVC 'result of 32-bit shift implicitly converted to 64 bits' warning. NFCI.
Simon Pilgrim [Sat, 21 Oct 2017 17:23:04 +0000 (17:23 +0000)]
Fix MSVC 'result of 32-bit shift implicitly converted to 64 bits' warning. NFCI.

llvm-svn: 316271

7 years ago[PPC CodeGen] Fix the bitreverse.i64 intrinsic.
Fangrui Song [Sat, 21 Oct 2017 16:59:40 +0000 (16:59 +0000)]
[PPC CodeGen] Fix the bitreverse.i64 intrinsic.

Summary: The two 32-bit words were swapped.

Subscribers: nemanjai, kbarton

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

llvm-svn: 316270

7 years agoAdd release notes for the recent -fdouble-square-bracket-attributes and -fno-double...
Aaron Ballman [Sat, 21 Oct 2017 16:45:08 +0000 (16:45 +0000)]
Add release notes for the recent -fdouble-square-bracket-attributes and -fno-double-square-bracket-attributes compiler flags.

llvm-svn: 316269

7 years ago[Sema] Fixes for enum handling for tautological comparison diagnostics
Roman Lebedev [Sat, 21 Oct 2017 16:44:03 +0000 (16:44 +0000)]
[Sema] Fixes for enum handling for tautological comparison diagnostics

Summary:
As Mattias Eriksson has reported in PR35009, in C, for enums, the underlying type should
be used when checking for the tautological comparison, unlike C++, where the enumerator
values define the value range. So if not in CPlusPlus mode, use the enum underlying type.

Also, i have discovered a problem (a crash) when evaluating tautological-ness of the following comparison:
```
enum A { A_a = 0 };
if (a < 0) // expected-warning {{comparison of unsigned enum expression < 0 is always false}}
return 0;
```
This affects both the C and C++, but after the first fix, only C++ code was affected.
That was also fixed, while preserving (i think?) the proper diagnostic output.

And while there, attempt to enhance the test coverage.
Yes, some tests got moved around, sorry about that :)

Fixes PR35009

Reviewers: aaron.ballman, rsmith, rjmccall

Reviewed By: aaron.ballman

Subscribers: Rakete1111, efriedma, materi, cfe-commits

Tags: #clang

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

llvm-svn: 316268

7 years agoFixing broken attribute documentation for __attribute__((noescape)); a code block...
Aaron Ballman [Sat, 21 Oct 2017 16:43:01 +0000 (16:43 +0000)]
Fixing broken attribute documentation for __attribute__((noescape)); a code block was missing and the existing code block was missing a mandatory newline.

llvm-svn: 316267

7 years ago[ValueTracking] Remove unnecessary temporary APInt from computeNumSignBitsVectorConstant.
Craig Topper [Sat, 21 Oct 2017 16:35:41 +0000 (16:35 +0000)]
[ValueTracking] Remove unnecessary temporary APInt from computeNumSignBitsVectorConstant.

We can just use getNumSignBits instead of inverting negative numbers.

llvm-svn: 316266

7 years ago[ValueTracking] Simplify the known bits code for constant vectors a little.
Craig Topper [Sat, 21 Oct 2017 16:35:39 +0000 (16:35 +0000)]
[ValueTracking] Simplify the known bits code for constant vectors a little.

Neither of these cases really require a temporary APInt outside the loop. For the ConstantDataSequential case the APInt will never be larger than 64-bits so its fine to just call getElementAsAPInt. For ConstantVector we can get the APInt by reference and only make a copy where the inversion is needed.

llvm-svn: 316265

7 years ago[bindings] allow null strings in Python 3
Masud Rahman [Sat, 21 Oct 2017 16:13:41 +0000 (16:13 +0000)]
[bindings] allow null strings in Python 3

Some API calls accept 'NULL' instead of a char array (e.g. the second
argument to 'clang_ParseTranslationUnit').  For Python 3 compatibility,
all strings are passed through 'c_interop_string' which expects to
receive only 'bytes' or 'str' objects.  This change extends this
behavior to additionally allow 'None' to be supplied.

A test case was added which breaks in Python 3, and is fixed by this
change.  All the test cases pass in both, Python 2 and Python 3.

llvm-svn: 316264

7 years agoTest commit
Masud Rahman [Sat, 21 Oct 2017 16:03:17 +0000 (16:03 +0000)]
Test commit

llvm-svn: 316263

7 years ago[X86][SSE] Add missing extractps scheduling test
Simon Pilgrim [Sat, 21 Oct 2017 14:35:09 +0000 (14:35 +0000)]
[X86][SSE] Add missing extractps scheduling test

llvm-svn: 316262

7 years ago[LoopInterchange] Fix phi node ordering miscompile.
David Green [Sat, 21 Oct 2017 13:58:37 +0000 (13:58 +0000)]
[LoopInterchange] Fix phi node ordering miscompile.

The way that splitInnerLoopHeader splits blocks requires that
the induction PHI will be the first PHI in the inner loop
header. This makes sure that is actually the case when there
are both IV and reduction phis.

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

llvm-svn: 316261

7 years agoclang-tidy: Fix deps.
NAKAMURA Takumi [Sat, 21 Oct 2017 11:02:30 +0000 (11:02 +0000)]
clang-tidy: Fix deps.

llvm-svn: 316260

7 years ago[SelectionDAG] Use dyn_cast without cast.
Florian Hahn [Sat, 21 Oct 2017 05:37:10 +0000 (05:37 +0000)]
[SelectionDAG] Use dyn_cast without cast.

llvm-svn: 316258

7 years ago[SelectionDAG] Use isa to silence unused variable warning (NFC).
Florian Hahn [Sat, 21 Oct 2017 04:57:03 +0000 (04:57 +0000)]
[SelectionDAG] Use isa to silence unused variable warning (NFC).

llvm-svn: 316257

7 years ago[SelectionDAG] Don't subject ConstantSDNodes to the depth limit in computeKnownBits...
Craig Topper [Sat, 21 Oct 2017 03:22:13 +0000 (03:22 +0000)]
[SelectionDAG] Don't subject ConstantSDNodes to the depth limit in computeKnownBits and ComputeNumSignBits.

We don't need to do any additional recursion, we just need to analyze the APInt stored in the node. This matches what the ValueTracking versions do for IR.

llvm-svn: 316256

7 years ago[SelectionDAG] Don't subject ISD:Constant to the depth limit in TargetLowering::Simpl...
Craig Topper [Sat, 21 Oct 2017 02:27:19 +0000 (02:27 +0000)]
[SelectionDAG] Don't subject ISD:Constant to the depth limit in TargetLowering::SimplifyDemandedBits.

Summary:
We shouldn't recurse any further but it doesn't mean we shouldn't be able to give the known bits for a constant. The caller would probably like that we always return the right answer for a constant RHS. This matches what InstCombine does in this case.

I don't have a test case because this showed up while trying to revive D31724.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: arsenm, llvm-commits

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

llvm-svn: 316255

7 years ago[X86] Do not generate __multi3 for mul i128 on X86
Craig Topper [Sat, 21 Oct 2017 02:26:00 +0000 (02:26 +0000)]
[X86] Do not generate __multi3 for mul i128 on X86

Summary: __multi3 is not available on x86 (32-bit). Setting lib call name for MULI_128 to nullptr forces DAGTypeLegalizer::ExpandIntRes_MUL to generate instructions for 128-bit multiply instead of a call to an undefined function.  This fixes PR20871 though it may be worth looking at why licm and indvars combine to generate 65-bit multiplies in that test.

Patch by Riyaz V Puthiyapurayil

Reviewers: craig.topper, schweitz

Reviewed By: craig.topper, schweitz

Subscribers: RKSimon, llvm-commits

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

llvm-svn: 316254

7 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Sat, 21 Oct 2017 00:57:46 +0000 (00:57 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316253

7 years agoDon't call buildSectionOrder multiple times.
Rafael Espindola [Sat, 21 Oct 2017 00:05:01 +0000 (00:05 +0000)]
Don't call buildSectionOrder multiple times.

This takes linking the linux kernel from 1.52s to 0.58s.

llvm-svn: 316251

7 years ago[CodeGen] add tests for __builtin_sqrt*; NFC
Sanjay Patel [Fri, 20 Oct 2017 23:32:41 +0000 (23:32 +0000)]
[CodeGen] add tests for __builtin_sqrt*; NFC

I don't know if this is correct, but this is what we currently do.
More discussion in PR27108 and PR27435 and D27618.

llvm-svn: 316250

7 years ago[Analyzer] Correctly handle parameters passed by reference when bodyfarming std:...
George Karpenkov [Fri, 20 Oct 2017 23:29:59 +0000 (23:29 +0000)]
[Analyzer] Correctly handle parameters passed by reference when bodyfarming std::call_once

Explicitly not supporting functor objects.

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

llvm-svn: 316249

7 years agoRemove unused argument.
Rafael Espindola [Fri, 20 Oct 2017 23:28:19 +0000 (23:28 +0000)]
Remove unused argument.

llvm-svn: 316248

7 years ago[clang-tidy] Remove MSVC inline assembly test from cross-plat test.
Zachary Turner [Fri, 20 Oct 2017 23:09:20 +0000 (23:09 +0000)]
[clang-tidy] Remove MSVC inline assembly test from cross-plat test.

This originally started out here in dev, but I moved it to another
file when it became clear this wouldn't work on non-Windows.
Unfortunately I forgot to remove it from this file.  Test is still
live, just in another source file.

llvm-svn: 316247

7 years ago[clang-tidy] Don't error on MS-style inline assembly.
Zachary Turner [Fri, 20 Oct 2017 23:00:51 +0000 (23:00 +0000)]
[clang-tidy] Don't error on MS-style inline assembly.

To get MS-style inline assembly, we need to link in the various
backends.  Some other clang tools already do this, and this issue
has been raised with clang-tidy several times, indicating there
is sufficient desire to make this work.

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

llvm-svn: 316246

7 years agoImplement current CWG direction for support of arrays of unknown bounds in
Richard Smith [Fri, 20 Oct 2017 22:56:25 +0000 (22:56 +0000)]
Implement current CWG direction for support of arrays of unknown bounds in
constant expressions.

We permit array-to-pointer decay on such arrays, but disallow pointer
arithmetic (since we do not know whether it will have defined behavior).

This is based on r311970 and r301822 (the former by me and the latter by Robert
Haberlach). Between then and now, two things have changed: we have committee
feedback indicating that this is indeed the right direction, and the code
broken by this change has been fixed.

This is necessary in C++17 to continue accepting certain forms of non-type
template argument involving arrays of unknown bound.

llvm-svn: 316245

7 years agolldb-server tests: Propagate environment variables (pr34192)
Pavel Labath [Fri, 20 Oct 2017 22:39:18 +0000 (22:39 +0000)]
lldb-server tests: Propagate environment variables (pr34192)

Summary:
Without this, the launching of the test inferior may fail if it depends
on some component of the environment (most likely LD_LIBRARY_PATH). This
makes sure we propagate the environment variable to the inferior
process.

Reviewers: eugene

Subscribers: lldb-commits

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

llvm-svn: 316244

7 years ago[Packetizer] Add function to check for aliasing between instructions
Krzysztof Parzyszek [Fri, 20 Oct 2017 22:08:40 +0000 (22:08 +0000)]
[Packetizer] Add function to check for aliasing between instructions

llvm-svn: 316243

7 years ago[utils, x86] add regex for retl/retq to reduce duplicated FileChecking (PR35003)
Sanjay Patel [Fri, 20 Oct 2017 21:55:23 +0000 (21:55 +0000)]
[utils, x86] add regex for retl/retq to reduce duplicated FileChecking (PR35003)

llvm-svn: 316242

7 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 20 Oct 2017 21:47:29 +0000 (21:47 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316241

7 years ago[WebAssembly] MC: Fix crash when -g specified.
Sam Clegg [Fri, 20 Oct 2017 21:28:38 +0000 (21:28 +0000)]
[WebAssembly] MC: Fix crash when -g specified.

At this point we don't output any debug sections or thier
relocations.

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

llvm-svn: 316240

7 years agoamdgcn: Add missing datalayout info to .ll files
Jan Vesely [Fri, 20 Oct 2017 21:10:18 +0000 (21:10 +0000)]
amdgcn: Add missing datalayout info to .ll files

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 316239