platform/upstream/llvm.git
5 years agoFix register coalescer failure to prune value
Stanislav Mekhanoshin [Tue, 21 May 2019 19:32:41 +0000 (19:32 +0000)]
Fix register coalescer failure to prune value

Register coalescer fails for the test in the patch with the assertion in
JoinVals::ConflictResolution `DefMI != nullptr'. It attempts to join
live intervals for two adjacent instructions and erase the copy:

    %2:vreg_256 = COPY %1
    %3:vreg_256 = COPY killed %1

The LI needs to be adjusted to kill subrange for the erased instruction
and extend the subrange of the original def. That was done for the main
interval only but not for the subrange. As a result subrange had a VNI
pointing to the erased slot resulting in the above failure.

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

llvm-svn: 361293

5 years agoFix for sphinx bot warning
Leonard Chan [Tue, 21 May 2019 19:30:25 +0000 (19:30 +0000)]
Fix for sphinx bot warning

llvm-svn: 361292

5 years ago[cmake] Don't use VERSION_GREATER_EQUAL in cmake versions prior to 3.72.
Don Hinton [Tue, 21 May 2019 19:25:54 +0000 (19:25 +0000)]
[cmake] Don't use VERSION_GREATER_EQUAL in cmake versions prior to 3.72.

llvm-svn: 361291

5 years ago[DeLICM] Use polly::singleton to allow empty result.
Michael Kruse [Tue, 21 May 2019 19:18:26 +0000 (19:18 +0000)]
[DeLICM] Use polly::singleton to allow empty result.

isl_map_from_union_map cannot determine the map's space if the union_map
is empty. polly::singleton was designed for this case. We pass the
expected map space to avoid crashing in isl_map_from_union_map.

This fixes an issue found by the aosp buildbot. Thanks to Eli Friedman
for the reproducer.

llvm-svn: 361290

5 years ago[Intrinsic] Signed Fixed Point Saturation Multiplication Intrinsic
Leonard Chan [Tue, 21 May 2019 19:17:19 +0000 (19:17 +0000)]
[Intrinsic] Signed Fixed Point Saturation Multiplication Intrinsic

Add an intrinsic that takes 2 signed integers with the scale of them provided
as the third argument and performs fixed point multiplication on them. The
result is saturated and clamped between the largest and smallest representable
values of the first 2 operands.

This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.

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

llvm-svn: 361289

5 years ago[X86] Remove an unneeded ZERO_EXTEND creation from LowerINTRINSIC_W_CHAIN. NFC
Craig Topper [Tue, 21 May 2019 19:03:45 +0000 (19:03 +0000)]
[X86] Remove an unneeded ZERO_EXTEND creation from LowerINTRINSIC_W_CHAIN. NFC

We were trying to ZERO_EXTEND from an i8 X86ISD::SETCC to i8 again.

llvm-svn: 361288

5 years ago[SelectionDAG] fold insert subvector of undef into undef
Sanjay Patel [Tue, 21 May 2019 18:53:53 +0000 (18:53 +0000)]
[SelectionDAG] fold insert subvector of undef into undef

DAGCombiner simplifies this more liberally as:
  // If inserting an UNDEF, just return the original vector.
  if (N1.isUndef())
    return N0;

So there's no way to make this visible in output AFAIK, but
doing this at node creation time should be slightly more efficient.

llvm-svn: 361287

5 years ago[cmake] Try to make cmake happy and fix bots.
Don Hinton [Tue, 21 May 2019 18:51:21 +0000 (18:51 +0000)]
[cmake] Try to make cmake happy and fix bots.

llvm-svn: 361286

5 years ago[LibTooling] Address post-commit feedback for r361152
Yitzhak Mandelbaum [Tue, 21 May 2019 18:48:58 +0000 (18:48 +0000)]
[LibTooling] Address post-commit feedback for r361152

Fixes a redundant dependency and moves another to its proper place.

Reviewers: thakis

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 361285

5 years ago[SelectionDAG] remove redundant code; NFCI
Sanjay Patel [Tue, 21 May 2019 18:28:22 +0000 (18:28 +0000)]
[SelectionDAG] remove redundant code; NFCI

getNode() squashes concatenation of undefs via FoldCONCAT_VECTORS():
  // Concat of UNDEFs is UNDEF.
  if (llvm::all_of(Ops, [](SDValue Op) { return Op.isUndef(); }))
    return DAG.getUNDEF(VT);

llvm-svn: 361284

5 years ago[OPENMP]Use the attributes for dso locality when building for device.
Alexey Bataev [Tue, 21 May 2019 18:20:08 +0000 (18:20 +0000)]
[OPENMP]Use the attributes for dso locality when building for device.

Currently, we ignore all dso locality attributes/info when building for
the device and thus all symblos are externally visible and can be
preemted at the runtime. It may lead to incorrect results. We need to
follow the same logic, compiler uses for static/pie builds.

llvm-svn: 361283

5 years ago[cmake] Bug in r361281: make include optional and fix typo which might make a differe...
Don Hinton [Tue, 21 May 2019 18:15:01 +0000 (18:15 +0000)]
[cmake] Bug in r361281: make include optional and fix typo which might make a difference on some systems.

llvm-svn: 361282

5 years ago[MergeICmps] Make sorting strongly stable on the rhs.
Clement Courbet [Tue, 21 May 2019 17:58:42 +0000 (17:58 +0000)]
[MergeICmps] Make sorting strongly stable on the rhs.

Summary:
Because the sort order was not strongly stable on the RHS, whether the
chain could merge would depend on the order of the blocks in the Phi.

EXPENSIVE_CHECKS would shuffle the blocks before sorting, resulting in
non-deterministic merging.

Reviewers: gchatelet

Subscribers: hiraditya, llvm-commits, RKSimon

Tags: #llvm

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

llvm-svn: 361281

5 years ago[cmake] Add custom command to touch archives on Darwin so ninja won't rebuild them.
Don Hinton [Tue, 21 May 2019 17:56:45 +0000 (17:56 +0000)]
[cmake] Add custom command to touch archives on Darwin so ninja won't rebuild them.

Summary:
clang and newer versions of ninja use high-resolutions timestamps, but
older versions of libtool on Darwin don't, so the archive will often
get an older timestamp than the last object that was added or updated.
To fix this, we add a custom command to touch the archive after it's
been built so that ninja won't rebuild it unnecessarily the next time
it's run.

Reviewed By: beanz

Tags: #llvm

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

llvm-svn: 361280

5 years ago[Bugpoint] fix use-after-move. NFC
Nick Desaulniers [Tue, 21 May 2019 17:55:26 +0000 (17:55 +0000)]
[Bugpoint] fix use-after-move. NFC

Summary:
This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No.
6".

Note that author also states:
"Note that the loop doesn't actually execute at all."

This is not true, but the author can be forgiven; there's two distinct
variables with very similar identifiers:

MiscompiledFunctions
MisCompFunctions

Reviewers: echristo, srhines, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 361279

5 years ago[clang][Darwin] Refactor header search path logic into the driver
Louis Dionne [Tue, 21 May 2019 17:48:04 +0000 (17:48 +0000)]
[clang][Darwin] Refactor header search path logic into the driver

Summary:
This commit moves the logic for determining system, resource and C++
header search paths from CC1 to the driver. This refactor has already
been made for several platforms, but Darwin had been left behind.

This refactor tries to implement the previous search path logic with
perfect accuracy. In particular, the order of all include paths inside
CC1 and all paths that were skipped because nonexistent are conserved
after the refactor. This change was also tested against a code base
of significant size and revealed no problems.

Reviewers: jfb, arphaman

Subscribers: nemanjai, javed.absar, kbarton, christof, jkorous, dexonsmith, jsji, cfe-commits

Tags: #clang

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

llvm-svn: 361278

5 years agoRemove `SymbolFileDWARF *` when there is already `DWARFUnit *`
Jan Kratochvil [Tue, 21 May 2019 17:38:56 +0000 (17:38 +0000)]
Remove `SymbolFileDWARF *` when there is already `DWARFUnit *`

In D61502#1503247 @clayborg suggested that SymbolFileDWARF *dwarf2Data is
really redundant in all the calls with also having DWARFUnit *cu. So remove it.

One `SymbolFileDWARF *` nullptr check
(DWARFDebugInfoEntry::GetDIENamesAndRanges) could be removed, other two nullptr
checks (DWARFDebugInfoEntry::GetName and DWARFDebugInfoEntry::AppendTypeName)
need to stay in place (now for `DWARFUnit *`).

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

llvm-svn: 361277

5 years ago[Dsymutil] Remove redundant argument (NFC)
Jonas Devlieghere [Tue, 21 May 2019 17:31:51 +0000 (17:31 +0000)]
[Dsymutil] Remove redundant argument (NFC)

The dwarf streamer already holds a copy of the link options, so there's
no need to pass them as an argument.

llvm-svn: 361276

5 years ago[CMake] One more stab at fixing BUILD_SHARED_LIBS
Chris Bieneman [Tue, 21 May 2019 17:30:59 +0000 (17:30 +0000)]
[CMake] One more stab at fixing BUILD_SHARED_LIBS

If clang's libraries are build SHARED, we need to grab their `PRIVATE_LINK_LIBRARIES` properties and add those to clang_shared's interface.

llvm-svn: 361275

5 years agoDo not use the incorrect attribute spelling list index when translating a no_sanitize...
Aaron Ballman [Tue, 21 May 2019 17:24:49 +0000 (17:24 +0000)]
Do not use the incorrect attribute spelling list index when translating a no_sanitize_foo attribute into a no_sanitize("foo") attribute.

This fixes a crash when AST pretty printing declarations marked with no_sanitize_memory.

llvm-svn: 361274

5 years agoRevert "[WebAssembly] Add __start_/_stop_ symbols for data sections"
Sam Clegg [Tue, 21 May 2019 17:16:33 +0000 (17:16 +0000)]
Revert "[WebAssembly] Add __start_/_stop_ symbols for data sections"

This reverts commit 7804dbddccba412087a15cab8db4412939700952.

This change broke a bunch of tests of the WebAssembly waterfall.
Will hopefully reland with increased test coverage.

llvm-svn: 361273

5 years ago[docs] Add new document on building distributions
Chris Bieneman [Tue, 21 May 2019 16:29:31 +0000 (16:29 +0000)]
[docs] Add new document on building distributions

Summary:
This document is an attempt to provide a guide for best practices for using the LLVM build system to generate distributable LLVM-based tools.

Most of the document is geared toward distributions of LLVM-based toolchains, but much of it also applies to distributing other LLVM-based tools and libraries.

Reviewers: tstellar, phosek, jroelofs, hans, sylvestre.ledru

Reviewed By: tstellar

Subscribers: smeenai, dschuff, arphaman, winksaville, llvm-commits

Tags: #llvm

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

llvm-svn: 361272

5 years agoFix BUILD_SHARED_LIBS for clang which broke in D61909
Chris Bieneman [Tue, 21 May 2019 15:56:17 +0000 (15:56 +0000)]
Fix BUILD_SHARED_LIBS for clang which broke in D61909

llvm_add_library ignores `BUILD_SHARED_LIBS` `STATIC` is explicitly specified. This restores the `BUILD_SHARED_LIBS` behavior to the clang build.

llvm-svn: 361271

5 years ago[X86][SSE] computeKnownBitsForTargetNode - add X86ISD::ANDNP support
Simon Pilgrim [Tue, 21 May 2019 15:20:24 +0000 (15:20 +0000)]
[X86][SSE] computeKnownBitsForTargetNode - add X86ISD::ANDNP support

Fixes PACKSS-PSHUFB shuffle regressions mentioned on D61692

llvm-svn: 361270

5 years ago[OPENMP][NVPTX]Mark more functions as always_inline for better
Alexey Bataev [Tue, 21 May 2019 15:11:58 +0000 (15:11 +0000)]
[OPENMP][NVPTX]Mark more functions as always_inline for better
performance.

Internally generated functions must be marked as always_inlines in most
cases. Patch marks some extra reduction function + outlined parallel
functions as always_inline for better performance, but only if the
optimization is requested.

llvm-svn: 361269

5 years ago[DAGCombiner] prevent unsafe reassociation of FP ops
Sanjay Patel [Tue, 21 May 2019 14:47:38 +0000 (14:47 +0000)]
[DAGCombiner] prevent unsafe reassociation of FP ops

There are no FP callers of DAGCombiner::reassociateOps() currently,
but we can add a fast-math check to make sure this API is not being
misused.

This was noted as a potential risk (and that risk might increase) with:
D62191

llvm-svn: 361268

5 years agogn build: Merge r361264
Nico Weber [Tue, 21 May 2019 14:41:27 +0000 (14:41 +0000)]
gn build: Merge r361264

llvm-svn: 361267

5 years ago[ELF] Deleted unused ComdatGroups member variable left by D61854
Fangrui Song [Tue, 21 May 2019 14:40:38 +0000 (14:40 +0000)]
[ELF] Deleted unused ComdatGroups member variable left by D61854

llvm-svn: 361266

5 years agoAdd support for dumping AST comment nodes to JSON.
Aaron Ballman [Tue, 21 May 2019 14:38:29 +0000 (14:38 +0000)]
Add support for dumping AST comment nodes to JSON.

llvm-svn: 361265

5 years ago[Syntax] Rename TokensTest to SyntaxTests. NFC
Ilya Biryukov [Tue, 21 May 2019 14:37:41 +0000 (14:37 +0000)]
[Syntax] Rename TokensTest to SyntaxTests. NFC

To be more consistent with conventions used in the codebase. The new
name will be a better fit when more bits of the syntax library land.

llvm-svn: 361264

5 years agoRevert r361257 "[MergeICmps][NFC] Make BCEAtom move-only."
Clement Courbet [Tue, 21 May 2019 14:24:46 +0000 (14:24 +0000)]
Revert r361257 "[MergeICmps][NFC] Make BCEAtom move-only."

Broke some bots.

llvm-svn: 361263

5 years agogn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Tue, 21 May 2019 14:22:38 +0000 (14:22 +0000)]
gn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

llvm-svn: 361262

5 years ago[ARM][CMSE] Add commandline option and feature macro
Javed Absar [Tue, 21 May 2019 14:21:26 +0000 (14:21 +0000)]
[ARM][CMSE] Add commandline option and feature macro

Defines macro ARM_FEATURE_CMSE to 1 for v8-M targets and introduces
-mcmse option which for v8-M targets sets ARM_FEATURE_CMSE to 3.
A diagnostic is produced when the option is given on architectures
without support for Security Extensions.
Reviewed By: dmgreen, snidertm
Differential Revision: https://reviews.llvm.org/D59879

llvm-svn: 361261

5 years agogn build: Merge r361252
Nico Weber [Tue, 21 May 2019 14:20:46 +0000 (14:20 +0000)]
gn build: Merge r361252

llvm-svn: 361260

5 years agogn build: Merge r361233
Nico Weber [Tue, 21 May 2019 14:10:55 +0000 (14:10 +0000)]
gn build: Merge r361233

llvm-svn: 361259

5 years ago[clangd] Turn no-parse-completion on by when preamble isn't ready. Add flag to force it.
Sam McCall [Tue, 21 May 2019 13:40:31 +0000 (13:40 +0000)]
[clangd] Turn no-parse-completion on by when preamble isn't ready. Add flag to force it.

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 361258

5 years ago[MergeICmps][NFC] Make BCEAtom move-only.
Clement Courbet [Tue, 21 May 2019 13:34:12 +0000 (13:34 +0000)]
[MergeICmps][NFC] Make BCEAtom move-only.

And handle for self-move. This is required so that llvm::sort can work
with EXPENSIVE_CHECKS, as it will do a random shuffle of the input
which can result in self-moves.

llvm-svn: 361257

5 years agoFix typo in r361251.
Paul Robinson [Tue, 21 May 2019 13:23:32 +0000 (13:23 +0000)]
Fix typo in r361251.

llvm-svn: 361256

5 years ago[lldb-mi] Include full path in the -data-disassemble response
Tatyana Krasnukha [Tue, 21 May 2019 13:22:46 +0000 (13:22 +0000)]
[lldb-mi] Include full path in the -data-disassemble response

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

Patch by Anton Kolesov <Anton.Kolesov@synopsys.com>

llvm-svn: 361255

5 years ago[NFC][X86][AArch64] Shift amount masking: tests that show that 'neg' doesn't last
Roman Lebedev [Tue, 21 May 2019 13:04:56 +0000 (13:04 +0000)]
[NFC][X86][AArch64] Shift amount masking: tests that show that 'neg' doesn't last

Meaning if we were to produce 'neg' in dagcombine, we will get an
endless cycle; some inverse transform would need to be guarded somehow.

Also, the 'and (sub 0, x), 31' variant is sticky,
doesn't get optimized in any way.

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

llvm-svn: 361254

5 years ago[ScheduleDAGInstrs] Compute topological ordering on demand.
Florian Hahn [Tue, 21 May 2019 13:04:53 +0000 (13:04 +0000)]
[ScheduleDAGInstrs] Compute topological ordering on demand.

In most cases, the topological ordering does not get changed in
ScheduleDAGInstrs. We can compute the ordering on demand, similar to
D60125.

This drastically cuts down the number of times we need to compute the
topological ordering, e.g. for SPEC2006, SPEC2k and MultiSource, we get
the following stats for -O3 -flto on X86 (showing the top reductions,
with small absolute values filtered). The smallest reduction is -50%.

Slightly positive impact on compile-time (-0.1 % geomean speedup for
test-suite + SPEC & co, with -O1 on X86)

Tests: 243
Metric: pre-RA-sched.NumTopoInits

Program                                        base       patch  diff
 test-suite...ngs-C/fixoutput/fixoutput.test   115.00      3.00   -97.4%
 test-suite...ks/Prolangs-C/cdecl/cdecl.test   957.00     26.00   -97.3%
 test-suite...math/automotive-basicmath.test   107.00      3.00   -97.2%
 test-suite...rolangs-C++/deriv2/deriv2.test   144.00      6.00   -95.8%
 test-suite...lowfish/security-blowfish.test   410.00     18.00   -95.6%
 test-suite...frame_layout/frame_layout.test   441.00     23.00   -94.8%
 test-suite...rolangs-C++/employ/employ.test   159.00     11.00   -93.1%
 test-suite...s/Ptrdist/anagram/anagram.test   157.00     11.00   -93.0%
 test-suite...s-C/unix-smail/unix-smail.test   829.00     59.00   -92.9%
 test-suite...chmarks/Olden/power/power.test   154.00     11.00   -92.9%
 test-suite...T95/147.vortex/147.vortex.test   19876.00  1434.00  -92.8%
 test-suite...000/255.vortex/255.vortex.test   19881.00  1435.00  -92.8%
 test-suite...ce/Applications/Burg/burg.test   2203.00   168.00   -92.4%
 test-suite...urce/Applications/hbd/hbd.test   1067.00    85.00   -92.0%
 test-suite...ternal/HMMER/hmmcalibrate.test   3145.00   251.00   -92.0%
 test-suite.../Applications/spiff/spiff.test   1037.00    84.00   -91.9%
 test-suite...SPEC/CINT95/130.li/130.li.test   5913.00   487.00   -91.8%
 test-suite.../CINT95/134.perl/134.perl.test   12532.00  1041.00  -91.7%
 test-suite...ce/Benchmarks/Olden/bh/bh.test   220.00     19.00   -91.4%
 test-suite :: External/Nurbs/nurbs.test       2304.00   206.00   -91.1%
 test-suite...arks/VersaBench/dbms/dbms.test   773.00     75.00   -90.3%
 test-suite...ce/Applications/siod/siod.test   9043.00   878.00   -90.3%
 test-suite...pplications/treecc/treecc.test   4510.00   438.00   -90.3%
 test-suite...T2006/456.hmmer/456.hmmer.test   7093.00   697.00   -90.2%
 test-suite...s-C/Pathfinder/PathFinder.test   882.00     87.00   -90.1%
 test-suite.../CINT2000/176.gcc/176.gcc.test   64978.00  6721.00  -89.7%
 test-suite...cations/hexxagon/hexxagon.test   657.00     69.00   -89.5%
 test-suite...fice-ispell/office-ispell.test   2712.00   285.00   -89.5%
 test-suite.../CINT2006/403.gcc/403.gcc.test   139613.00 14992.00 -89.3%
 test-suite...lications/ClamAV/clamscan.test   25880.00  2785.00  -89.2%

Reviewers: MatzeB, atrick, efriedma, niravd

Reviewed By: efriedma

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

llvm-svn: 361253

5 years ago[clangd] Add tweak to convert normal to raw string literal, when it contains escapes.
Sam McCall [Tue, 21 May 2019 13:04:24 +0000 (13:04 +0000)]
[clangd] Add tweak to convert normal to raw string literal, when it contains escapes.

Reviewers: ilya-biryukov

Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 361252

5 years ago[DebugInfo] Fix tests missed by r362148
Paul Robinson [Tue, 21 May 2019 12:48:46 +0000 (12:48 +0000)]
[DebugInfo] Fix tests missed by r362148

llvm-svn: 361251

5 years agoDe-Window-ize a test
Paul Robinson [Tue, 21 May 2019 12:08:42 +0000 (12:08 +0000)]
De-Window-ize a test

llvm-svn: 361250

5 years agoFix test failure.
Rui Ueyama [Tue, 21 May 2019 12:01:16 +0000 (12:01 +0000)]
Fix test failure.

I forgot to submit a last-minute change to the last patch.

llvm-svn: 361249

5 years ago[DebugInfo] Handle '# line "file"' correctly for asm source.
Paul Robinson [Tue, 21 May 2019 11:59:03 +0000 (11:59 +0000)]
[DebugInfo] Handle '# line "file"' correctly for asm source.
This provides the correct file path for the original source, rather
than the preprocessed source.

Part of the fix for PR41839.

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

llvm-svn: 361248

5 years agoRevert r360902 "Resubmit: [Salvage] Change salvage debug info ..."
Bob Haarman [Tue, 21 May 2019 11:53:41 +0000 (11:53 +0000)]
Revert r360902 "Resubmit: [Salvage] Change salvage debug info ..."

This reverts commit rr360902. It caused an assertion failure in
lib/IR/DebugInfoMetadata.cpp: Assertion `(OffsetInBits + SizeInBits <=
FragmentSizeInBits) && "new fragment outside of original fragment"'
failed.

PR41931.

llvm-svn: 361246

5 years ago[DebugInfo] Handle -main-file-name correctly for asm source.
Paul Robinson [Tue, 21 May 2019 11:52:27 +0000 (11:52 +0000)]
[DebugInfo] Handle -main-file-name correctly for asm source.
This option provides only the base filename, not a full relative path.

Part of the fix for PR41839.

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

llvm-svn: 361245

5 years ago[WebAssembly] Add --reproduce.
Rui Ueyama [Tue, 21 May 2019 11:52:14 +0000 (11:52 +0000)]
[WebAssembly] Add --reproduce.

--reproduce is a convenient option for debugging. If you invoke lld
with `--reproduce=repro.tar`, it creates `repro.tar` with all input
files and the command line options given to the linker, so that it is
very easy to run lld with the exact same inputs.

ELF and Windows lld have this option.

This patch add that option to lld/wasm.

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

llvm-svn: 361244

5 years ago[X86][SSE] Add shuffle tests for 'splat3' patterns.
Simon Pilgrim [Tue, 21 May 2019 11:42:28 +0000 (11:42 +0000)]
[X86][SSE] Add shuffle tests for 'splat3' patterns.

Test codegen from shuffles for { dst[0] = dst[1] = dst[2] = *src++; dst += 3 } 'splatting' memcpy patterns generated by loop-vectorizer.

llvm-svn: 361243

5 years ago[CodeGenModule] BlockByrefHelpers - add missing uninitialized variables to constructo...
Simon Pilgrim [Tue, 21 May 2019 11:37:54 +0000 (11:37 +0000)]
[CodeGenModule] BlockByrefHelpers - add missing uninitialized variables to constructor. NFCI.

llvm-svn: 361242

5 years ago[NFC][X86][AArch64] Add some more tests for shift amount masking
Roman Lebedev [Tue, 21 May 2019 11:14:01 +0000 (11:14 +0000)]
[NFC][X86][AArch64] Add some more tests for shift amount masking

The negation creation should be more eager:
https://bugs.llvm.org/show_bug.cgi?id=41952

llvm-svn: 361241

5 years ago[llvm-objdump] Make --disassemble-functions imply -d
George Rimar [Tue, 21 May 2019 11:05:46 +0000 (11:05 +0000)]
[llvm-objdump] Make --disassemble-functions imply -d

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

Patch by Mike Pozulp!

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

llvm-svn: 361240

5 years ago[MergeICmps] Preserve the dominator tree.
Clement Courbet [Tue, 21 May 2019 11:02:23 +0000 (11:02 +0000)]
[MergeICmps] Preserve the dominator tree.

Summary: In preparation for D60318 .

Reviewers: gchatelet, efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 361239

5 years ago[CGBuiltin] dumpRecord - remove unused field offset. NFCI.
Simon Pilgrim [Tue, 21 May 2019 10:48:42 +0000 (10:48 +0000)]
[CGBuiltin] dumpRecord - remove unused field offset. NFCI.

llvm-svn: 361238

5 years ago[PPC64] Update LocalEntry from assigned symbols
Fangrui Song [Tue, 21 May 2019 10:41:25 +0000 (10:41 +0000)]
[PPC64] Update LocalEntry from assigned symbols

On PowerPC64 ELFv2 ABI, functions may have 2 entry points: global and local.
The local entry point location of a function is stored in the st_other field of the symbol, as an offset relative to the global entry point.

In order to make symbol assignments (e.g. .equ/.set) work properly with this, PPCTargetELFStreamer already copies the local entry bits from the source symbol to the destination one, on emitAssignment(). The problem is that this copy is performed only at the assignment location, where the source symbol may not yet have processed the .localentry directive, that sets the local entry. This may cause the destination symbol to end up with wrong local entry information. Other symbol info is not affected by this because, in this case, the destination symbol value is actually a symbol reference.

This change keeps track of these assignments, and update all needed st_other fields when finish() is called.

Patch by Leandro Lupori!

Reviewed By: MaskRay

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

llvm-svn: 361237

5 years ago[WebAssembly] Add __start_/_stop_ symbols for data sections
Sam Clegg [Tue, 21 May 2019 10:07:30 +0000 (10:07 +0000)]
[WebAssembly] Add __start_/_stop_ symbols for data sections

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

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

llvm-svn: 361236

5 years ago[AArch64] Skip mask checks for masks with an odd number of elements.
Florian Hahn [Tue, 21 May 2019 10:05:26 +0000 (10:05 +0000)]
[AArch64] Skip mask checks for masks with an odd number of elements.

Some checks in isShuffleMaskLegal expect an even number of elements,
e.g. isTRN_v_undef_Mask or isUZP_v_undef_Mask, otherwise they access
invalid elements and crash. This patch adds checks to the impacted
functions.

Fixes PR41951

Reviewers: t.p.northover, dmgreen, samparker

Reviewed By: dmgreen

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

llvm-svn: 361235

5 years ago[libclang] visit c++14 lambda capture init expressions
Nikolai Kosjar [Tue, 21 May 2019 09:21:35 +0000 (09:21 +0000)]
[libclang] visit c++14 lambda capture init expressions

Patch by Milian Wolff.

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

llvm-svn: 361234

5 years ago[WebAssembly] Refactor synthetic sections and relocation processing. NFC.
Sam Clegg [Tue, 21 May 2019 09:13:09 +0000 (09:13 +0000)]
[WebAssembly] Refactor synthetic sections and relocation processing. NFC.

Major refactor to better match the structure of the ELF linker.

- Split out relocation processing into scanRelocations
- Split out synthetic sections into their own classes.

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

llvm-svn: 361233

5 years agoDWARF: Port debug_addr over to DWARFContext
Pavel Labath [Tue, 21 May 2019 09:11:11 +0000 (09:11 +0000)]
DWARF: Port debug_addr over to DWARFContext

llvm-svn: 361232

5 years ago[llvm-objcopy] Strip file symbols with --strip-unneeded
Eugene Leviant [Tue, 21 May 2019 09:09:33 +0000 (09:09 +0000)]
[llvm-objcopy] Strip file symbols with --strip-unneeded

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

llvm-svn: 361231

5 years ago[AArch64][SVE2] Asm: add integer unary instructions (predicated)
Cullen Rhodes [Tue, 21 May 2019 09:06:51 +0000 (09:06 +0000)]
[AArch64][SVE2] Asm: add integer unary instructions (predicated)

Summary:
Patch adds support for the following instructions:

    * URECPE, URSQRTE, SQABS, SQNEG

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer

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

llvm-svn: 361230

5 years ago[AArch64][SVE2] Asm: add integer pairwise arithmetic instructions
Cullen Rhodes [Tue, 21 May 2019 08:59:00 +0000 (08:59 +0000)]
[AArch64][SVE2] Asm: add integer pairwise arithmetic instructions

Summary:
Patch adds support for the following instructions:

    ADDP, SMAXP, UMAXP, SMINP, UMINP

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer

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

llvm-svn: 361229

5 years ago[ELF] Don't advance position in a memory region when assigning to the Dot
Fangrui Song [Tue, 21 May 2019 08:21:44 +0000 (08:21 +0000)]
[ELF] Don't advance position in a memory region when assigning to the Dot

For memory5.test, ld.bfd appears to ignore `. += 0x2000;`, so the test was testing
a wrong behavior. After deleting the code added in rLLD336335, we match ld.bfd and thus fix PR41357.

PR37836 (memory4.test) seems to have been fixed by another change.

Reviewed By: ruiu

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

llvm-svn: 361228

5 years ago[ARM][CGP] Skip nuw in PrepareConstants
Sam Parker [Tue, 21 May 2019 07:56:47 +0000 (07:56 +0000)]
[ARM][CGP] Skip nuw in PrepareConstants

PrepareConstants step converts add/sub with 'negative' immediates to
sub/add with a 'positive' imm to make promotion more simple. nuw
already states that the add shouldn't cause an unsigned wrap, so
it shouldn't need any tweaking. Plus, we also don't allow a sub with
a 'negative' immediate to be safe wrap, so this functionality has
been removed. The PrepareConstants step now just handles the add
instructions that we've determined would be safe if they wrap around
zero.

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

llvm-svn: 361227

5 years ago[Preamble] Reuse preamble even if an unsaved file does not exist
Nikolai Kosjar [Tue, 21 May 2019 07:26:59 +0000 (07:26 +0000)]
[Preamble] Reuse preamble even if an unsaved file does not exist

When a preamble is created an unsaved file not existing on disk is
already part of PrecompiledPreamble::FilesInPreamble. However, when
checking whether the preamble can be re-used, a failed stat of such an
unsaved file invalidated the preamble, which led to pointless and time
consuming preamble regenerations on subsequent reparses.

Do not require anymore that unsaved files should exist on disk.

This avoids costly preamble invalidations depending on timing issues for
the cases where the file on disk might be removed just to be regenerated
a bit later.

It also allows an IDE to provide in-memory files that might not exist on
disk, e.g. because the build system hasn't generated those yet.

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

llvm-svn: 361226

5 years ago[clang-tidy] New option for misc-throw-by-value-catch-by-reference
Adam Balogh [Tue, 21 May 2019 07:25:06 +0000 (07:25 +0000)]
[clang-tidy] New option for misc-throw-by-value-catch-by-reference

Catching trivial objects by value is not dangerous but may be
inefficient if they are too large. This patch adds an option
`WarnOnLargeObject` to the checker to also warn if such an object
is caught by value. An object is considered as "large" if its
size is greater than `MaxSize` which is another option. Default
value is the machine word of the architecture (size of the type
`size_t`).

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

llvm-svn: 361225

5 years agoDWARF: Introduce DWARFUnitHeader class
Pavel Labath [Tue, 21 May 2019 07:22:34 +0000 (07:22 +0000)]
DWARF: Introduce DWARFUnitHeader class

Summary:
This patch introduces the DWARFUnitHeader class. Its purpose (and its
structure, to the extent it was possible to make it) is the same as its
LLVM counterpart -- to extract the unit header information before we
actually construct the unit, so that we know which kind of units to
construct. This is needed because as of DWARF5, type units live in the
.debug_info section, which means it's not possible to statically
determine the type of units in a given section.

Reviewers: aprantl, clayborg, JDevlieghere

Subscribers: lldb-commits

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

llvm-svn: 361224

5 years ago[CMake] Specify component for all target types
Petr Hosek [Tue, 21 May 2019 07:13:58 +0000 (07:13 +0000)]
[CMake] Specify component for all target types

This addresses an issue introduced in r360230 which broke existing
use cases of LLVM_DISTRIBUTION_COMPONENTS since ARCHIVE and LIBRARY
target types are no longer handled as components.

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

llvm-svn: 361223

5 years agoAdd TargetLoweringInfo hook for explicitly setting the ABI calling convention endianess
Dylan McKay [Tue, 21 May 2019 06:38:02 +0000 (06:38 +0000)]
Add TargetLoweringInfo hook for explicitly setting the ABI calling convention endianess

Summary:
The endianess used in the calling convention does not always match the
endianess of the target on all architectures, namely AVR.

When an argument is too large to be legalised by the architecture and is
split for the ABI, a new hook TargetLoweringInfo::shouldSplitFunctionArgumentsAsLittleEndian
is queried to find the endianess that function arguments must be laid
out in.

This approach was recommended by Eli Friedman.

Originally reported in https://github.com/avr-rust/rust/issues/129.

Patch by Carl Peto.

Reviewers: bogner, t.p.northover, RKSimon, niravd, efriedma

Reviewed By: efriedma

Subscribers: JDevlieghere, llvm-commits

Tags: #llvm

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

llvm-svn: 361222

5 years ago[NFC][PowerPC] Add a test to verify if the scheduler schedule the addi before the...
QingShan Zhang [Tue, 21 May 2019 06:32:31 +0000 (06:32 +0000)]
[NFC][PowerPC] Add a test to verify if the scheduler schedule the addi before the load.

llvm-svn: 361221

5 years agoMove thumbv7k test from AArch64 to ARM
Nikita Popov [Tue, 21 May 2019 06:24:36 +0000 (06:24 +0000)]
Move thumbv7k test from AArch64 to ARM

As pointed out by charukcs on rL361166, this test uses an ARM triple.

llvm-svn: 361220

5 years ago[PowerPC] test cases for selecting x-form instruction for unaligned offset - NFC
Chen Zheng [Tue, 21 May 2019 05:06:09 +0000 (05:06 +0000)]
[PowerPC] test cases for selecting x-form instruction for unaligned offset - NFC

llvm-svn: 361219

5 years ago[PowerPC] use more meaningful name - NFC
Chen Zheng [Tue, 21 May 2019 03:54:42 +0000 (03:54 +0000)]
[PowerPC] use more meaningful name - NFC

llvm-svn: 361218

5 years ago[CMake] Correct some dependencies
Alex Langford [Tue, 21 May 2019 03:41:05 +0000 (03:41 +0000)]
[CMake] Correct some dependencies

Symbol doesn't depend on CPlusPlusLanguage, but Expressiond does.

llvm-svn: 361216

5 years ago[ORC] Assert that JITDylibs have unique names.
Lang Hames [Tue, 21 May 2019 03:23:08 +0000 (03:23 +0000)]
[ORC] Assert that JITDylibs have unique names.

Patch by Praveen Velliengiri. Thanks Praveen!

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

llvm-svn: 361215

5 years agoTweaks for setting CMAKE_LINKER to lld-link
Nico Weber [Tue, 21 May 2019 03:01:01 +0000 (03:01 +0000)]
Tweaks for setting CMAKE_LINKER to lld-link

- Just look for "lld-link", not "lld-link.exe".
  llvm/cmake/platforms/WinMsvc.cmake for example sets CMAKE_LINKER to
  lld-link without .exe

- Stop passing -gwarf to the compiler in sanitizer options when lld is
  enabled -- there's no reason to use different debug information keyed
  off the linker. (If this was for MinGW, we should check for that
  instead.)

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

llvm-svn: 361214

5 years ago[ELF] Error on relocations to local undefined symbols
Fangrui Song [Tue, 21 May 2019 02:38:11 +0000 (02:38 +0000)]
[ELF] Error on relocations to local undefined symbols

For a reference to a local symbol, ld.bfd and gold error if the symbol
is defined in a discarded section but accept it if the symbol is
undefined. This inconsistent behavior seems unnecessary for us (it
probably makes sense for them as they differentiate local/global
symbols, the error would mean more code).

Catch such errors. Symbol index 0 may be used by marker relocations,
e.g. R_*_NONE R_ARM_V4BX. Don't error on them.

The difference from D61563 (which caused msan failure) is we don't call
Sym.computeBinding() on local symbols - VersionId is uninitialized.

llvm-svn: 361213

5 years agoRevert r361206 "[COFF] Store alignment in log2 form, NFC"
Nico Weber [Tue, 21 May 2019 02:06:59 +0000 (02:06 +0000)]
Revert r361206 "[COFF] Store alignment in log2 form, NFC"

Makes the linker crash when linking nasm.exe.

llvm-svn: 361212

5 years agolldb-server: LLGS: support 32-bit on 64-bit hosts
Saleem Abdulrasool [Tue, 21 May 2019 01:25:48 +0000 (01:25 +0000)]
lldb-server: LLGS: support 32-bit on 64-bit hosts

Enable the ARM emulation support on AArch64 which can execute ARM32
code. Similarly, handle MIPS 32 on 64.

llvm-svn: 361210

5 years agoTry to fix build with older gccs after r361152
Nico Weber [Tue, 21 May 2019 00:27:26 +0000 (00:27 +0000)]
Try to fix build with older gccs after r361152

Also merge the cmake change there to the gn build.

llvm-svn: 361209

5 years agoGive 'fixit-cxx0x.cpp' a more modern name.
Richard Smith [Mon, 20 May 2019 23:37:18 +0000 (23:37 +0000)]
Give 'fixit-cxx0x.cpp' a more modern name.

llvm-svn: 361208

5 years ago[builtins] Deduplicate __eqsf2 and __gtsf2 via macro
Petr Hosek [Mon, 20 May 2019 23:34:24 +0000 (23:34 +0000)]
[builtins] Deduplicate __eqsf2 and __gtsf2 via macro

The only difference between __eqsf2 and __gtsf2 is whether they return
1 or -1 on NaN. Rather than duplicating all the code, use a macro to
define the function twice and use an argument to decide whether to
negate the return value.

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

llvm-svn: 361207

5 years ago[COFF] Store alignment in log2 form, NFC
Reid Kleckner [Mon, 20 May 2019 22:57:52 +0000 (22:57 +0000)]
[COFF] Store alignment in log2 form, NFC

Summary:
Valid section or chunk alignments are powers of 2 in the range [1,
8192]. These can be stored more canonically in log2 form to free up some
bits in Chunk. Combined with D61696, SectionChunk gets 8 bytes smaller.

Reviewers: ruiu, aganea

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 361206

5 years ago[Sema] Fix for build on some iOS programs.
Leonard Chan [Mon, 20 May 2019 22:42:19 +0000 (22:42 +0000)]
[Sema] Fix for build on some iOS programs.

Nullability attributes weren't being stripped for AttributedTypes that
were wrapped in a MacroQualifiedType. This fix adds a check for this
type and a test.

llvm-svn: 361205

5 years ago[CodeGen] Fix order of PHINode and MA Write generation.
Michael Kruse [Mon, 20 May 2019 22:31:09 +0000 (22:31 +0000)]
[CodeGen] Fix order of PHINode and MA Write generation.

At the end of a region statement, the PHINode must be generated
while the current IRBuilder's block is the region's exit node. For
obvious reasons: The PHINode references the region's exiting block.
A partial write would insert new control flow, i.e. insert new basic
blocks between the exiting blocks and the current block.

We fix this by generating the PHI nodes (region exit values) before
generating any MemoryAccess's stores.

This should fix the AOSP buildbot.

Reported-by: Eli Friedman <efriedma@quicinc.com>
llvm-svn: 361204

5 years ago[ORC] fix use-after-move. NFC
Nick Desaulniers [Mon, 20 May 2019 22:17:43 +0000 (22:17 +0000)]
[ORC] fix use-after-move. NFC

Summary:
scan-build flagged a potential use-after-move in debug builds.  It's not
safe that a moved from value contains anything but garbage.  Manually
DRY up these repeated expressions.

Reviewers: lhames

Reviewed By: lhames

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

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

llvm-svn: 361203

5 years agoAMDGPU: Force skip branches over calls
Matt Arsenault [Mon, 20 May 2019 22:04:42 +0000 (22:04 +0000)]
AMDGPU: Force skip branches over calls

Unfortunately the way SIInsertSkips works is backwards, and is
required for correctness. r338235 added handling of some special cases
where skipping is mandatory to avoid side effects if no lanes are
active. It conservatively handled asm correctly, but the same logic
needs to apply to calls.

Usually the call sequence code is larger than the skip threshold,
although the way the count is computed is really broken, so I'm not
sure if anything was likely to really hit this.

llvm-svn: 361202

5 years agoEnsure that hash<basic_string> uses char_traits. Fixes PR#41876. Reviewed as https...
Marshall Clow [Mon, 20 May 2019 21:56:51 +0000 (21:56 +0000)]
Ensure that hash<basic_string> uses char_traits. Fixes PR#41876. Reviewed as https://reviews.llvm.org/D61954

llvm-svn: 361201

5 years ago[docs] Fix an RST typo: "code-blocks" should be "code-block".
Lang Hames [Mon, 20 May 2019 21:33:25 +0000 (21:33 +0000)]
[docs] Fix an RST typo: "code-blocks" should be "code-block".

llvm-svn: 361200

5 years ago[ORC] Remove some unreachable code.
Lang Hames [Mon, 20 May 2019 21:30:33 +0000 (21:30 +0000)]
[ORC] Remove some unreachable code.

Fixes http://llvm.org/PR41662.

llvm-svn: 361199

5 years ago[docs] Add more details/examples for LLJIT/LLLazyJIT, tweak lookup discussion.
Lang Hames [Mon, 20 May 2019 21:07:16 +0000 (21:07 +0000)]
[docs] Add more details/examples for LLJIT/LLLazyJIT, tweak lookup discussion.

llvm-svn: 361198

5 years ago[NFC][InstCombine] Add FIXME for one-use check on constant negation transforms.
Cameron McInally [Mon, 20 May 2019 21:00:42 +0000 (21:00 +0000)]
[NFC][InstCombine] Add FIXME for one-use check on constant negation transforms.

llvm-svn: 361197

5 years ago[DependenceInfo] Remove dead initialization. NFC.
Michael Kruse [Mon, 20 May 2019 20:54:17 +0000 (20:54 +0000)]
[DependenceInfo] Remove dead initialization. NFC.

Fix scan-analyzer issue:
Value stored to 'WARMemAccesses' during its initialization is never read

Patch by Dominik Adamski <adamski.dominik@gmail.com>

Signed-off-by: Dominik Adamski <adamski.dominik@gmail.com>
llvm-svn: 361196

5 years ago[Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and OwningMemoryBlock.
Lang Hames [Mon, 20 May 2019 20:53:05 +0000 (20:53 +0000)]
[Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and OwningMemoryBlock.

Rename member 'Size' to 'AllocatedSize' in order to provide a hint that the
allocated size may be different than the requested size. Comments are added to
clarify this point.  Updated the InMemoryBuffer in FileOutputBuffer.cpp to track
the requested buffer size.

Patch by Machiel van Hooren. Thanks Machiel!

https://reviews.llvm.org/D61599

llvm-svn: 361195

5 years agoThis change adds an API to allow setting the flag to indicate that the profile data...
Max Moroz [Mon, 20 May 2019 20:02:20 +0000 (20:02 +0000)]
This change adds an API to allow setting the flag to indicate that the profile data has been dumped to the file.

Summary:
The main use is for users to disable dumping profile data to the file
for certain processes in case the processes don't have permission to
write to the disks, and trying to do so would result in side effects
such as crashes.

Patch by Yuke Liao (@liaoyuke).

Additional context (Chromium use case):
- https://bugs.chromium.org/p/chromium/issues/detail?id=842424
- https://bugs.chromium.org/p/chromium/issues/detail?id=957655
- https://chromium-review.googlesource.com/c/chromium/src/+/1610093

Reviewers: Dor1s, vsk, davidxl

Reviewed By: Dor1s, davidxl

Subscribers: delcypher, davidxl, sajjadm, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 361194

5 years agoAdd more tests for AST JSON output; NFC.
Aaron Ballman [Mon, 20 May 2019 20:01:45 +0000 (20:01 +0000)]
Add more tests for AST JSON output; NFC.

This adds tests for dumping expressions in C. It also updates a comment to note an issue to be fixed with printing character literals discovered as part of this testing.

llvm-svn: 361193

5 years ago[AArch64] Handle lowering lround on windows, where long is 32 bit
Martin Storsjo [Mon, 20 May 2019 19:53:28 +0000 (19:53 +0000)]
[AArch64] Handle lowering lround on windows, where long is 32 bit

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

llvm-svn: 361192

5 years agogn build: Merge r361148
Nico Weber [Mon, 20 May 2019 19:33:32 +0000 (19:33 +0000)]
gn build: Merge r361148

llvm-svn: 361191