platform/upstream/llvm.git
6 years agoRevert r326501 due to buildbot breakage.
David L. Jones [Thu, 1 Mar 2018 23:14:00 +0000 (23:14 +0000)]
Revert r326501 due to buildbot breakage.

Original change:

[NFC] Move CommentOpts checks to the call sites that depend on it.

When parsing comments, for example, for -Wdocumentation, slightly different
behaviour occurs when -fparse-all-comments is specified. However, these
differences are subtle:

1. All comments are saved during parsing, regardless of whether they are doc comments or not.
2. "Maybe-doc" comments, like //<, //!, etc, are saved as such, instead of marking them as ordinary comments. The maybe-doc type of comment is never saved otherwise. (Warning on these is the impetus of -Wdocumentation.)
3. All comments are treated as doc comments in ASTContext, even if they are ordinary.

This change moves the logic for checking CommentOptions.ParseAllComments closer
to where it has an effect. The overall logic is unchanged, but checks of the
ParseAllComments flag are now done where the effect will be clearer.

llvm-svn: 326508

6 years agoReport an error if you try to link against .dll instead of .lib.
Rui Ueyama [Thu, 1 Mar 2018 23:11:30 +0000 (23:11 +0000)]
Report an error if you try to link against .dll instead of .lib.

It is a usage error to feed a .dll file instead of a .dll to COFF linker.
Previously, lld failed with a mysterious error message. Now we reject
it at the driver.

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

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

llvm-svn: 326507

6 years agoAccept both `--foo bar` and `--foo=bar` styles options.
Rui Ueyama [Thu, 1 Mar 2018 23:06:10 +0000 (23:06 +0000)]
Accept both `--foo bar` and `--foo=bar` styles options.

GNU linkers by convention supports both `--foo bar` and `--foo=bar` styles
for all long options that take arguments.

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

llvm-svn: 326506

6 years agobpf: introduce -mattr=dwarfris to disable DwarfUsesRelocationsAcrossSections
Yonghong Song [Thu, 1 Mar 2018 23:04:59 +0000 (23:04 +0000)]
bpf: introduce -mattr=dwarfris to disable DwarfUsesRelocationsAcrossSections

Commit e4507fb8c94b ("bpf: disable DwarfUsesRelocationsAcrossSections")
disables MCAsmInfo DwarfUsesRelocationsAcrossSections unconditionally
so that dwarf will not use cross section (between dwarf and symbol table)
relocations. This new debug format enables pahole to dump structures
correctly as libdwarves.so does not have BPF backend support yet.

This new debug format, however, breaks bcc (https://github.com/iovisor/bcc)
source debug output as llvm in-memory Dwarf support has some issues to
handle it. More specifically, with DwarfUsesRelocationsAcrossSections
disabled, JIT compiler does not generate .debug_abbrev and Dwarf
DIE (debug info entry) processing is not happy about this.

This patch introduces a new flag -mattr=dwarfris
(dwarf relocation in section) to disable DwarfUsesRelocationsAcrossSections.
DwarfUsesRelocationsAcrossSections is true by default.

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

6 years agoRename a test file and fix indentation.
Rui Ueyama [Thu, 1 Mar 2018 23:01:41 +0000 (23:01 +0000)]
Rename a test file and fix indentation.

llvm-svn: 326504

6 years agoSet DF_TEXTREL to executables that need text relocations.
Rui Ueyama [Thu, 1 Mar 2018 22:56:52 +0000 (22:56 +0000)]
Set DF_TEXTREL to executables that need text relocations.

Summary:
If an executable needs text relocations, it should be marked as such so
that the loader can prepare for text relocations. We currently create a
dummy segment with DT_TEXTREL for that purpose.

Generic ABI as of 2000 [1] mentioned that "Its [DT_TEXTREL's] use
has been superseded by the DF_TEXTREL flag". However, it's actually not
superseded even after 18 years. OpenBSD and musl recognize only DT_TEXTREL.
So we still need to set both.

[1] http://www.sco.com/developers/gabi/2000-07-17/ch5.dynamic.html

Reviewers: rafael

Subscribers: emaste, llvm-commits, arichardson

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

llvm-svn: 326503

6 years ago[InstCombine] allow fmul fold with less than 'fast'
Sanjay Patel [Thu, 1 Mar 2018 22:53:47 +0000 (22:53 +0000)]
[InstCombine] allow fmul fold with less than 'fast'

llvm-svn: 326502

6 years ago[NFC] Move CommentOpts checks to the call sites that depend on it.
David L. Jones [Thu, 1 Mar 2018 22:41:53 +0000 (22:41 +0000)]
[NFC] Move CommentOpts checks to the call sites that depend on it.

When parsing comments, for example, for -Wdocumentation, slightly different
behaviour occurs when -fparse-all-comments is specified. However, these
differences are subtle:

 1. All comments are saved during parsing, regardless of whether they are doc
    comments or not.
 2. "Maybe-doc" comments, like //<, //!, etc, are saved as such, instead of
    marking them as ordinary comments. The maybe-doc type of comment is never
    saved otherwise. (Warning on these is the impetus of -Wdocumentation.)
 3. All comments are treated as doc comments in ASTContext, even if they are
    ordinary.

This change moves the logic for checking CommentOptions.ParseAllComments closer
to where it has an effect. The overall logic is unchanged, but checks of the
ParseAllComments flag are now done where the effect will be clearer.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 326501

6 years ago[DAGCombiner] When combining zero_extend of a truncate, only mask before extending...
Craig Topper [Thu, 1 Mar 2018 22:32:25 +0000 (22:32 +0000)]
[DAGCombiner] When combining zero_extend of a truncate, only mask before extending for vectors.

Masking first, prevents the extend from being combine with loads. Its also interfering with some vXi1 extraction code.

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

llvm-svn: 326500

6 years ago[Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS
Chih-Hung Hsieh [Thu, 1 Mar 2018 22:26:19 +0000 (22:26 +0000)]
[Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS

Since LLVM r326341, default EmulatedTLS mode is decided in backend
according to target triple. Any front-end should pass -f[no]-emulated-tls
to backend and set up ExplicitEmulatedTLS only when the flags are used.

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

llvm-svn: 326499

6 years agoDon't ingoned --enable-new-dtags.
Rafael Espindola [Thu, 1 Mar 2018 22:23:51 +0000 (22:23 +0000)]
Don't ingoned --enable-new-dtags.

llvm-svn: 326498

6 years ago[X86][MMX] Improve handling of 64-bit MMX constants
Simon Pilgrim [Thu, 1 Mar 2018 22:22:31 +0000 (22:22 +0000)]
[X86][MMX] Improve handling of 64-bit MMX constants

64-bit MMX constant generation usually ends up lowering into SSE instructions before being spilled/reloaded as a MMX type.

This patch bitcasts the constant to a double value to allow correct loading directly to the MMX register.

I've added MMX constant asm comment support to improve testing, it's better to always print the double values as hex constants as MMX is mainly an integer unit (and even with 3DNow! its just floats).

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

llvm-svn: 326497

6 years ago[modules] Don't diagnose "redefinition" of a friend with a pending definition
Richard Smith [Thu, 1 Mar 2018 22:20:13 +0000 (22:20 +0000)]
[modules] Don't diagnose "redefinition" of a friend with a pending definition
if the other definition is a merged copy of the same function.

llvm-svn: 326496

6 years ago[SelectionDAG] Support some SimplifySetCC cases for comparing against vector splats...
Craig Topper [Thu, 1 Mar 2018 22:15:39 +0000 (22:15 +0000)]
[SelectionDAG] Support some SimplifySetCC cases for comparing against vector splats of constants.

This supports things like

(setcc ugt X, 0) -> (setcc ne X, 0)

I've restricted to only make changes to vectors before legalize ops because I doubt all targets have accurate condition code legality information for vectors given how little we did before.

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

llvm-svn: 326495

6 years ago[X86][AVX] Add v2f32 <-> v2i8/v2i16/v2i32 vector tests
Simon Pilgrim [Thu, 1 Mar 2018 22:05:40 +0000 (22:05 +0000)]
[X86][AVX] Add v2f32 <-> v2i8/v2i16/v2i32 vector tests

llvm-svn: 326494

6 years ago[www] Capitalize "Clang" when referring to the project, and generalize the
Richard Smith [Thu, 1 Mar 2018 22:01:06 +0000 (22:01 +0000)]
[www] Capitalize "Clang" when referring to the project, and generalize the
introduction on the front page page.

We still use the lowercase "clang" spelling when referring to the driver binary.

llvm-svn: 326493

6 years ago[Hexagon] Add trap1 instruction
Krzysztof Parzyszek [Thu, 1 Mar 2018 21:54:08 +0000 (21:54 +0000)]
[Hexagon] Add trap1 instruction

llvm-svn: 326492

6 years agoAdd an llc testcase analogous to test/LTO/X86/strip-debug-info.ll
Adrian Prantl [Thu, 1 Mar 2018 21:53:17 +0000 (21:53 +0000)]
Add an llc testcase analogous to test/LTO/X86/strip-debug-info.ll

rdar://problem/37963669

llvm-svn: 326491

6 years agoAMDGPU/GlobalISel: Define instruction mapping for @llvm.amdgcn.cvt.pkrtz
Matt Arsenault [Thu, 1 Mar 2018 21:25:30 +0000 (21:25 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for @llvm.amdgcn.cvt.pkrtz

Patch by Tom Stellard

llvm-svn: 326490

6 years agoAMDGPU/GlobalISel: Define instruction mapping for G_OR
Matt Arsenault [Thu, 1 Mar 2018 21:25:25 +0000 (21:25 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for G_OR

Patch by Tom Stellard

llvm-svn: 326489

6 years ago[X86][SSE] Regenerate float to/from i8/i16 vector tests
Simon Pilgrim [Thu, 1 Mar 2018 21:21:30 +0000 (21:21 +0000)]
[X86][SSE] Regenerate float to/from i8/i16 vector tests

llvm-svn: 326488

6 years agoAMDGPU/GlobalISel: Remove default register mapping
Matt Arsenault [Thu, 1 Mar 2018 21:20:44 +0000 (21:20 +0000)]
AMDGPU/GlobalISel: Remove default register mapping

This crashes for some opcodes, which prevents the SelectionDAG
fallback from working.

Patch by Tom Stellard

llvm-svn: 326487

6 years ago[AArch64] Clean up code (NFC)
Evandro Menezes [Thu, 1 Mar 2018 21:17:36 +0000 (21:17 +0000)]
[AArch64] Clean up code (NFC)

Clean up a couple of functions in `AArch64TargetLowering` by removing
redundant statements.

llvm-svn: 326486

6 years agoAdded P0805 to the list of ready bits
Marshall Clow [Thu, 1 Mar 2018 21:16:07 +0000 (21:16 +0000)]
Added P0805 to the list of ready bits

llvm-svn: 326485

6 years ago[X86][SSE] Regenerate odd sized sext/zext tests
Simon Pilgrim [Thu, 1 Mar 2018 21:13:26 +0000 (21:13 +0000)]
[X86][SSE] Regenerate odd sized sext/zext tests

llvm-svn: 326484

6 years agoAMDGPU/GlobalISel: Use a more correct getValueMapping
Matt Arsenault [Thu, 1 Mar 2018 21:08:51 +0000 (21:08 +0000)]
AMDGPU/GlobalISel: Use a more correct getValueMapping

This was finding the wrong size registers for anything with
more than 2 components.

Patch by Tom Stellard

llvm-svn: 326483

6 years agoAMDGPU/GlobalISel: Define instruction mapping for G_BITCAST
Matt Arsenault [Thu, 1 Mar 2018 20:59:44 +0000 (20:59 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for G_BITCAST

Patch by Tom Stellard

llvm-svn: 326482

6 years agoAMDGPU/GlobalISel: Mark i32->i64 zext as legal
Matt Arsenault [Thu, 1 Mar 2018 20:56:21 +0000 (20:56 +0000)]
AMDGPU/GlobalISel: Mark i32->i64 zext as legal

llvm-svn: 326481

6 years ago[AArch64] Add support for secrel add/load/store relocations for COFF
Martin Storsjo [Thu, 1 Mar 2018 20:42:28 +0000 (20:42 +0000)]
[AArch64] Add support for secrel add/load/store relocations for COFF

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

llvm-svn: 326480

6 years agoAMDGPU/GlobalISel: InstrMapping for llvm.amdgcn.exp.compr
Matt Arsenault [Thu, 1 Mar 2018 20:40:55 +0000 (20:40 +0000)]
AMDGPU/GlobalISel: InstrMapping for llvm.amdgcn.exp.compr

Patch by Tom Stellard

llvm-svn: 326479

6 years ago[MinGW] Fix --{start,end}-group.
Rui Ueyama [Thu, 1 Mar 2018 20:38:38 +0000 (20:38 +0000)]
[MinGW] Fix --{start,end}-group.

Currently --start-group=foo is accidentally accepted by the MinGW driver.

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

llvm-svn: 326478

6 years agoAMDGPU/GlobalISel: Define instruction mapping for @llvm.amdgcn.exp
Matt Arsenault [Thu, 1 Mar 2018 20:24:37 +0000 (20:24 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for @llvm.amdgcn.exp

Patch by Tom Stellard

llvm-svn: 326477

6 years ago[RecordLayout] Only assert that fundamental type sizes are power of two on MSVC
Martin Storsjo [Thu, 1 Mar 2018 20:22:57 +0000 (20:22 +0000)]
[RecordLayout] Only assert that fundamental type sizes are power of two on MSVC

Make types with sizes that aren't a power of two an error (that can
be disabled) in structs with ms_struct layout, except on mingw where
the situation is quite likely to occur and GCC handles it silently.

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

llvm-svn: 326476

6 years ago[SimplifyLibCalls] Update an obviously copy and pasted header comment to match this...
Craig Topper [Thu, 1 Mar 2018 20:05:09 +0000 (20:05 +0000)]
[SimplifyLibCalls] Update an obviously copy and pasted header comment to match this file. NFC

llvm-svn: 326475

6 years ago[InstCombine] Auto-generate complete checks. NFC
Craig Topper [Thu, 1 Mar 2018 20:05:07 +0000 (20:05 +0000)]
[InstCombine] Auto-generate complete checks. NFC

llvm-svn: 326474

6 years agoAMDGPU/GlobalISel: Define InstrMappings for G_ICMP
Matt Arsenault [Thu, 1 Mar 2018 19:27:10 +0000 (19:27 +0000)]
AMDGPU/GlobalISel: Define InstrMappings for G_ICMP

Patch by Tom Stellard

llvm-svn: 326472

6 years agoAMDGPU/GlobalISel: Make i32 mul legal
Matt Arsenault [Thu, 1 Mar 2018 19:22:05 +0000 (19:22 +0000)]
AMDGPU/GlobalISel: Make i32 mul legal

llvm-svn: 326471

6 years agoAMDGPU/GlobalISel: Define instruction mapping for G_IMPLICIT_DEF
Matt Arsenault [Thu, 1 Mar 2018 19:16:52 +0000 (19:16 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for G_IMPLICIT_DEF

Patch by Tom Stellard

llvm-svn: 326470

6 years agoDriver: hoist `-fno-rtti-data` to a driver flag
Saleem Abdulrasool [Thu, 1 Mar 2018 19:13:43 +0000 (19:13 +0000)]
Driver: hoist `-fno-rtti-data` to a driver flag

This is needed for building with the GNU driver (`clang++`) when
targeting Windows and using msvcprt.  This flag is the equivalent of
`/GR-`.

llvm-svn: 326469

6 years agoAMDGPU/GlobalISel: Define instruction mapping for G_FCONSTANT
Matt Arsenault [Thu, 1 Mar 2018 19:13:30 +0000 (19:13 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for G_FCONSTANT

Patch by Tom Stellard

llvm-svn: 326468

6 years agoAMDGPU/GlobalISel: Add copyCost for VGPR->SGPR copies
Matt Arsenault [Thu, 1 Mar 2018 19:09:25 +0000 (19:09 +0000)]
AMDGPU/GlobalISel: Add copyCost for VGPR->SGPR copies

Patch by Tom Stellard

llvm-svn: 326467

6 years agoAMDGPU/GlobalISel: Make i32 xor legal
Matt Arsenault [Thu, 1 Mar 2018 19:09:21 +0000 (19:09 +0000)]
AMDGPU/GlobalISel: Make i32 xor legal

llvm-svn: 326466

6 years agoAMDGPU/GlobalISel: Mark 32/64-bit G_FCMP as legal
Matt Arsenault [Thu, 1 Mar 2018 19:09:16 +0000 (19:09 +0000)]
AMDGPU/GlobalISel: Mark 32/64-bit G_FCMP as legal

Patch by Tom Stellard

llvm-svn: 326465

6 years agoAMDGPU/GlobalISel: Mark 32-bit G_FPTOSI as legal
Matt Arsenault [Thu, 1 Mar 2018 19:04:25 +0000 (19:04 +0000)]
AMDGPU/GlobalISel: Mark 32-bit G_FPTOSI as legal

Patch by Tom Stellard

llvm-svn: 326464

6 years agoCorrect man page description for --section-start
Ed Maste [Thu, 1 Mar 2018 19:02:41 +0000 (19:02 +0000)]
Correct man page description for --section-start

The argument is section=address, not just address.

(For compatibility with GNU linkers we need to, but do not yet, accept
--section-start=section=address.)

llvm-svn: 326463

6 years ago[analyzer] Enable cfg-temporary-dtors by default.
Artem Dergachev [Thu, 1 Mar 2018 18:53:13 +0000 (18:53 +0000)]
[analyzer] Enable cfg-temporary-dtors by default.

Don't enable c++-temp-dtor-inlining by default yet, due to this reference
counting pointe problem.

Otherwise the new mode seems stable and allows us to incrementally fix C++
problems in much less hacky ways.

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

llvm-svn: 326461

6 years ago[WebAssembly] Fix broken gcc build after rL326454
Sam Clegg [Thu, 1 Mar 2018 18:48:08 +0000 (18:48 +0000)]
[WebAssembly] Fix broken gcc build after rL326454

The gcc builders were broken by rL326454
See: https://reviews.llvm.org/D43921

llvm-svn: 326460

6 years agoWhere possible use --long-opt=value in lld man page
Ed Maste [Thu, 1 Mar 2018 18:40:11 +0000 (18:40 +0000)]
Where possible use --long-opt=value in lld man page

We intend to maintain compatibility with GNU ld, and in the GNU world
long options are conventionally specified as --long-option=value. For
whatever reason GNU ld.bfd accepts both --long-option value and
--long-option=value, but documents the former. Follow suit.

Some lld long options do not accept the = form; this is probably a bug
to be fixed (along with a man page update).

Reported by Ingo Schwarze, for --entry.

llvm-svn: 326459

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

llvm-svn: 326458

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

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

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

llvm-svn: 326457

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

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

Reviewers: sammccall, hokein

Reviewed By: sammccall

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

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

llvm-svn: 326456

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

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

llvm-svn: 326455

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

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

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

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

llvm-svn: 326454

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

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

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

llvm-svn: 326453

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

llvm-svn: 326452

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

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

llvm-svn: 326451

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

llvm-svn: 326450

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

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

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

llvm-svn: 326449

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

llvm-svn: 326448

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

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

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

llvm-svn: 326447

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

Patch by Ingo Schwarze

llvm-svn: 326446

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

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

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

llvm-svn: 326445

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

llvm-svn: 326444

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

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

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

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

llvm-svn: 326443

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

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

llvm-svn: 326442

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

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

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

Found while looking at pr36515.

llvm-svn: 326441

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

llvm-svn: 326440

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

Originally submitted as r326323 and r326324.
Reverted in r326432.

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

llvm-svn: 326439

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

llvm-svn: 326438

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

llvm-svn: 326437

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

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

llvm-svn: 326436

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

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

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

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

llvm-svn: 326435

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

llvm-svn: 326434

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

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

Reviewers: thanm, sanjoy, rnk

Reviewed By: rnk

Subscribers: llvm-commits

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

llvm-svn: 326433

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

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

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

llvm-svn: 326432

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

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

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

llvm-svn: 326431

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

This is PR36515.

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

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

llvm-svn: 326430

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

llvm-svn: 326429

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

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

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

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

llvm-svn: 326428

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

Was broken after recent testcases changes.

llvm-svn: 326427

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

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

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

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

Reviewers: krasimir, djasper

Reviewed By: djasper

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

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

llvm-svn: 326426

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

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

llvm-svn: 326425

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

This fixes a TODO introduced in rLLD325861.

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

llvm-svn: 326424

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

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

Reviewers: asb, apazos, mgrang

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

llvm-svn: 326420

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

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

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

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

llvm-svn: 326419

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

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

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

llvm-svn: 326418

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

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

llvm-svn: 326417

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

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

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

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

llvm-svn: 326416

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

llvm-svn: 326415

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

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

Bring back the old behavior.

llvm-svn: 326414

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

llvm-svn: 326413

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

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

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

<rdar://problem/38010986>

llvm-svn: 326412

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

llvm-svn: 326411

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

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

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

llvm-svn: 326410

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

It now includes both linkerscript and non linkerscript variants.

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

llvm-svn: 326409

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

llvm-svn: 326408

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

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

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

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 326407

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

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

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

llvm-svn: 326406

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

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

Re-applied after a revert in r324167.

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

Patch by David Carlier!

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

llvm-svn: 326405

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

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

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

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

Patch by Fedor Indutny

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

llvm-svn: 326404