platform/upstream/llvm.git
6 years agotsan: improve "destroy of a locked mutex" reports
Dmitry Vyukov [Fri, 27 Apr 2018 08:59:35 +0000 (08:59 +0000)]
tsan: improve "destroy of a locked mutex" reports

1. Allow to suppress by current stack.
We generally allow to suppress by all main stacks.
Current is probably the stack one wants to use to
suppress such reports.

2. Fix last lock stack restoration.
We trimmed shadow value by storing it in u32.
This magically worked for the test that provoked
the report on the main thread. But this breaks
for locks in any other threads.

llvm-svn: 331023

6 years ago[SCEV] Add trivial case handling for umin utilities. NFC.
Serguei Katkov [Fri, 27 Apr 2018 08:02:50 +0000 (08:02 +0000)]
[SCEV] Add trivial case handling for umin utilities. NFC.

Reviewers: sanjoy, mkazantsev
Reviewed By: mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46175

llvm-svn: 331022

6 years agoMake MultiplexASTDeserializationListener part of the API [NFC]
Raphael Isemann [Fri, 27 Apr 2018 07:05:40 +0000 (07:05 +0000)]
Make MultiplexASTDeserializationListener part of the API [NFC]

Summary:
This patch moves the MultiplexASTDeserializationListener declaration into a public header.

We're currently using this multiplexer in the cling interpreter to attach another
ASTDeserializationListener during the execution (so, after the MultiplexConsumer is already
attached which prevents us from attaching more). So far we're doing this by patching clang
and making this class public, but it makes things easier if we make this instead just public in
upstream.

Reviewers: thakis, v.g.vassilev, rsmith, bruno

Reviewed By: bruno

Subscribers: llvm-commits, cfe-commits, v.g.vassilev

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

llvm-svn: 331021

6 years ago[CodeGen] Avoid destructing a callee-destructued struct type in a
Akira Hatanaka [Fri, 27 Apr 2018 06:57:00 +0000 (06:57 +0000)]
[CodeGen] Avoid destructing a callee-destructued struct type in a
function if a function delegates to another function.

Fix a bug introduced in r328731, which caused a struct with ObjC __weak
fields that was passed to a function to be destructed twice, once in the
callee function and once in another function the callee function
delegates to. To prevent this, keep track of the callee-destructed
structs passed to a function and disable their cleanups at the point of
the call to the delegated function.

This reapplies r331016, which was reverted in r331019 because it caused
an assertion to fail in EmitDelegateCallArg on a windows bot. I made
changes to EmitDelegateCallArg so that it doesn't try to deactivate
cleanups for structs that have trivial destructors (cleanups for those
structs are never pushed to the cleanup stack in EmitParmDecl).

rdar://problem/39194693

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

llvm-svn: 331020

6 years agoRevert "[CodeGen] Avoid destructing a callee-destructued struct type in a"
Akira Hatanaka [Fri, 27 Apr 2018 05:56:55 +0000 (05:56 +0000)]
Revert "[CodeGen] Avoid destructing a callee-destructued struct type in a"

This reverts commit r331016, which broke a windows bot.

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11727

llvm-svn: 331019

6 years ago[ELF] Fix typo. NFC
Fangrui Song [Fri, 27 Apr 2018 05:50:40 +0000 (05:50 +0000)]
[ELF] Fix typo. NFC

llvm-svn: 331018

6 years agoFix typo.
Richard Smith [Fri, 27 Apr 2018 04:27:26 +0000 (04:27 +0000)]
Fix typo.

llvm-svn: 331017

6 years ago[CodeGen] Avoid destructing a callee-destructued struct type in a
Akira Hatanaka [Fri, 27 Apr 2018 04:21:51 +0000 (04:21 +0000)]
[CodeGen] Avoid destructing a callee-destructued struct type in a
function if a function delegates to another function.

Fix a bug introduced in r328731, which caused a struct with ObjC __weak
fields that was passed to a function to be destructed twice, once in the
callee function and once in another function the callee function
delegates to. To prevent this, keep track of the callee-destructed
structs passed to a function and disable their cleanups at the point of
the call to the delegated function.

rdar://problem/39194693

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

llvm-svn: 331016

6 years ago[SCEV] Introduce bulk umin creation utilities
Serguei Katkov [Fri, 27 Apr 2018 03:56:53 +0000 (03:56 +0000)]
[SCEV] Introduce bulk umin creation utilities

Add new umin creation method which accepts a list of operands.

SCEV does not represents umin which is required in getExact, so
it transforms umin to umax with not. As a result the transformation of
tree of max to max with several operands does not work.
We just use the new introduced method for creation umin from several operands.

Reviewers: sanjoy, mkazantsev
Reviewed By: sanjoy
Subscribers: javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46047

llvm-svn: 331015

6 years ago[analyzer] Fix operator delete[] array-type-sub-expression handling.
Artem Dergachev [Fri, 27 Apr 2018 02:16:03 +0000 (02:16 +0000)]
[analyzer] Fix operator delete[] array-type-sub-expression handling.

Avoid crash when the sub-expression of operator delete[] is of array type.

This is not the same as simply using a delete[] syntax.

We're still not properly calling destructors in this case in the analyzer.

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

llvm-svn: 331014

6 years agoParse A::template B as an identifier rather than as a template-id with no
Richard Smith [Fri, 27 Apr 2018 02:00:13 +0000 (02:00 +0000)]
Parse A::template B as an identifier rather than as a template-id with no
template arguments.

This fixes some cases where we'd incorrectly accept "A::template B" when B is a
kind of template that requires template arguments (in particular, a variable
template or a concept).

llvm-svn: 331013

6 years agoFix a thinko in the iteration over StructuredDataPlugin Create functions.
Jim Ingham [Fri, 27 Apr 2018 01:57:40 +0000 (01:57 +0000)]
Fix a thinko in the iteration over StructuredDataPlugin Create functions.

The code was grabbing the first plugin, and then never getting
another one.

<rdar://problem/39779438>

llvm-svn: 331012

6 years agoRevert "[SimplifyLibcalls] Replace locked IO with unlocked IO"
Matt Morehouse [Fri, 27 Apr 2018 01:48:09 +0000 (01:48 +0000)]
Revert "[SimplifyLibcalls] Replace locked IO with unlocked IO"

This reverts r331002 due to sanitizer bot breakage.

llvm-svn: 331011

6 years ago[Driver] Don't enable "-fregister-global-dtors-with-atexit" by default
Akira Hatanaka [Fri, 27 Apr 2018 01:42:33 +0000 (01:42 +0000)]
[Driver] Don't enable "-fregister-global-dtors-with-atexit" by default
when compiling the kernel or kexts.

Destructors should be registered with atexit by default only when we are
compiling userland code.

llvm-svn: 331010

6 years agoRevert "[CMake] Make simple source used for CMake checks a C file"
Petr Hosek [Fri, 27 Apr 2018 01:25:32 +0000 (01:25 +0000)]
Revert "[CMake] Make simple source used for CMake checks a C file"

This reverts commit r331003 which breaks sanitizer bots because of
missing 32-bit libstdc++ library.

llvm-svn: 331009

6 years ago[LowerTypeTests] Mark .cfi.jumptable nounwind.
Eli Friedman [Fri, 27 Apr 2018 00:32:24 +0000 (00:32 +0000)]
[LowerTypeTests] Mark .cfi.jumptable nounwind.

It doesn't unwind, and the wrong marking leads to the creation of an
.eh_frame section when it isn't necessary.

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

llvm-svn: 331008

6 years ago[MachineOutliner] Don't outline from functions with a section marking.
Eli Friedman [Fri, 27 Apr 2018 00:21:34 +0000 (00:21 +0000)]
[MachineOutliner] Don't outline from functions with a section marking.

The program might have unusual expectations for functions; for example,
the Linux kernel's build system warns if it finds references from .text
to .init.data.

I'm not sure this is something we actually want to make any guarantees
about (there isn't any explicit rule that would disallow outlining
in this case), but we might want to be conservative anyway.

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

llvm-svn: 331007

6 years agotypo
Sam Clegg [Fri, 27 Apr 2018 00:17:24 +0000 (00:17 +0000)]
typo

llvm-svn: 331006

6 years ago[WebAssembly] Section symbols must have local binding
Sam Clegg [Fri, 27 Apr 2018 00:17:21 +0000 (00:17 +0000)]
[WebAssembly] Section symbols must have local binding

Summary: Also test for symbols information in test/MC/WebAssembly/debug-info.ll.

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, JDevlieghere, llvm-commits

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

llvm-svn: 331005

6 years ago[debugserver] Fix handling of the 'g' packet
Frederic Riss [Fri, 27 Apr 2018 00:09:04 +0000 (00:09 +0000)]
[debugserver] Fix handling of the 'g' packet

LLDB doesn't use this packet so we never hit this, but it looks like
some other projects talk to debugserver and are hitting an assert
(https://github.com/derekparker/delve/issues/1015).

We had an off by 1 in the accounting of the FPU structure sizes.
I added a test that basically just check that 'g' doesn't return
an error (currently it assert in debug builds). I didn't make
it an lldb-server test because it looks like lldb-server doesn't
implement the g packet.

llvm-svn: 331004

6 years ago[CMake] Make simple source used for CMake checks a C file
Petr Hosek [Thu, 26 Apr 2018 23:35:13 +0000 (23:35 +0000)]
[CMake] Make simple source used for CMake checks a C file

The source being compiled is plain C, but using .cc extension forces it
to be compiled as C++ which requires a working C++ compiler including
C++ library which may not be the case when we're building compiler-rt
together with libcxx as part of runtimes build.

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

llvm-svn: 331003

6 years ago[SimplifyLibcalls] Replace locked IO with unlocked IO
David Bolvansky [Thu, 26 Apr 2018 22:31:43 +0000 (22:31 +0000)]
[SimplifyLibcalls] Replace locked IO with unlocked IO

Summary: If file stream arg is not captured and source is fopen, we could replace IO calls by unlocked IO ("_unlocked" function variants) to gain better speed,

Reviewers: efriedma, RKSimon, spatel, sanjoy, hfinkel, majnemer

Subscribers: lebedev.ri, llvm-commits

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

llvm-svn: 331002

6 years ago[MCA] [NFC] Remove unused Index formal from ResourceManager::issueInstruction
Matt Davis [Thu, 26 Apr 2018 22:30:40 +0000 (22:30 +0000)]
[MCA] [NFC] Remove unused Index formal from ResourceManager::issueInstruction

Summary: The instruction index was never referenced in the body.  Just a minor cleanup.

Reviewers: andreadb

Reviewed By: andreadb

Subscribers: javed.absar, gbedwell, llvm-commits

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

llvm-svn: 331001

6 years ago[ELF] Clarify help wording for --symbol-ordering-file
Shoaib Meenai [Thu, 26 Apr 2018 22:25:04 +0000 (22:25 +0000)]
[ELF] Clarify help wording for --symbol-ordering-file

The input file for this option should contain a list of symbols, not a
list of sections, so explicitly refer to ordering symbols (but keep the
reference to laying out sections, since that's how the option must
operate). Referring to the file itself as the "symbol ordering file" is
consistent with --warn-symbol-ordering and less ambiguous than "symbol
file" (albeit slightly redundant).

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

llvm-svn: 331000

6 years ago[libcxx] [test] Remove non-portable assertions from filebuf tests
Billy Robert O'Neal III [Thu, 26 Apr 2018 22:18:33 +0000 (22:18 +0000)]
[libcxx] [test] Remove non-portable assertions from filebuf tests

seekoff.pass.cpp:
libc++'s tests are asserting things about the buffer passed to pubsetbuf. [filebuf.virtuals]/12 says that what the filebuf does with the buffer you give it is completely implementation defined. The MSVC++ implementation takes that buffer and hands it off to the CRT (by calling ::setvbuf) and the CRT doesn't necessarily follow the pattern this test wants.
This change simply makes asserts against the buffer's contents use LIBCPP_ASSERT instead of assert.

pbackfail.pass.cpp:
libc++'s tests are asserting about what characters will and will not be available in the putback area. [filebuf.virtuals]/9 says "The function can alter the number of putback positions available as a result of any call." This change LIBCPP_ASSERTS libc++'s behavior, but checks invariants of the putback area independently.

llvm-svn: 330999

6 years ago[Docs] Escape the @ symbol, so that it appears in documentation output. [NFC]
Matt Davis [Thu, 26 Apr 2018 21:55:45 +0000 (21:55 +0000)]
[Docs] Escape the @ symbol, so that it appears in documentation output. [NFC]

Summary:
The '@' character is a special character in Doxygen.  In a handful of cases we were not escaping this character which resulted in llvm intrinsics not being rendered properly.  Specifically, the @llvm part was removed.

For example, see https://llvm.org/doxygen/classllvm_1_1AssumptionCache.html.  There are a few references to '.assume' without the @llvm. prefix.  This patch corrects this.

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits, sanjoy

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

llvm-svn: 330998

6 years ago[x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsics
Chandler Carruth [Thu, 26 Apr 2018 21:46:01 +0000 (21:46 +0000)]
[x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsics

The LLVM commit introduces a crash in LLVM's instruction selection.

I filed http://llvm.org/PR37260 with the test case.

llvm-svn: 330997

6 years ago[InstCombine][NFC] Regenerate checks in or-xor.ll
Roman Lebedev [Thu, 26 Apr 2018 21:41:56 +0000 (21:41 +0000)]
[InstCombine][NFC] Regenerate checks in or-xor.ll

llvm-svn: 330996

6 years agoFix WAsm dwarfdump.ll test on Windows
Reid Kleckner [Thu, 26 Apr 2018 21:13:59 +0000 (21:13 +0000)]
Fix WAsm dwarfdump.ll test on Windows

llvm-svn: 330995

6 years ago[InstCombine][NFC] Regenerate checks in and-or-not.ll
Roman Lebedev [Thu, 26 Apr 2018 21:13:09 +0000 (21:13 +0000)]
[InstCombine][NFC] Regenerate checks in and-or-not.ll

llvm-svn: 330994

6 years agoRevert "Fix a bug that prevents global variables from having a DW_OP_deref."
Adrian Prantl [Thu, 26 Apr 2018 20:59:58 +0000 (20:59 +0000)]
Revert "Fix a bug that prevents global variables from having a DW_OP_deref."

This reverts commit r3309704 while investigating bot breakage.

llvm-svn: 330993

6 years ago[InstCombine] Simplify Add with remainder expressions as operands.
Sanjoy Das [Thu, 26 Apr 2018 20:52:28 +0000 (20:52 +0000)]
[InstCombine] Simplify Add with remainder expressions as operands.

Summary:
Simplify integer add expression X % C0 + (( X / C0 ) % C1) * C0 to
X % (C0 * C1).  This is a common pattern seen in code generated by the XLA
GPU backend.

Add test cases for this new optimization.

Patch by Bixia Zheng!

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: efriedma, craig.topper, lebedev.ri, llvm-commits, jlebar

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

llvm-svn: 330992

6 years agoAdd test cases to prepare for the optimization that simplifies Add with
Sanjoy Das [Thu, 26 Apr 2018 20:52:27 +0000 (20:52 +0000)]
Add test cases to prepare for the optimization that simplifies Add with
remainder expressions as operands.

Summary:
Add test cases to prepare for the new optimization that Simplifies integer add
expression X % C0 + (( X / C0 ) % C1) * C0 to X % (C0 * C1).

Patch by Bixia Zheng!

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: jlebar, llvm-commits

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

llvm-svn: 330991

6 years ago[asan] Align __asan_global_start so that it works with LLD
Reid Kleckner [Thu, 26 Apr 2018 20:46:50 +0000 (20:46 +0000)]
[asan] Align __asan_global_start so that it works with LLD

Otherwise LLD will not align the .ASAN$GA section start, and
&__asan_globals + 1 will not be the start of the next real ASan global
metadata in .ASAN$GL.

We discovered this issue when attempting to use LLD on Windows in
Chromium: https://crbug.com/837090

llvm-svn: 330990

6 years agoEnable full debug info in the ASan runtime on Windows
Reid Kleckner [Thu, 26 Apr 2018 20:34:19 +0000 (20:34 +0000)]
Enable full debug info in the ASan runtime on Windows

Clang-cl supports the -gline-tables-only flag, so we were going down
that path. Honestly, we should just go ahead and enable full codeview
support.

llvm-svn: 330989

6 years ago[GlobalISel] Reporting rules covered as part of the InstructionSelect's debug-only...
Roman Tereshin [Thu, 26 Apr 2018 20:22:17 +0000 (20:22 +0000)]
[GlobalISel] Reporting rules covered as part of the InstructionSelect's debug-only printing

The main goal of this change is to make it much easier to track which
rules are actually covered by Testgen'erated regression tests.

Reviewers: aemerson, dsanders

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

llvm-svn: 330988

6 years ago[X86] Make __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 only...
Craig Topper [Thu, 26 Apr 2018 20:14:46 +0000 (20:14 +0000)]
[X86] Make __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 only available on 32-bit targets.

These builtins can't be handled by the backend on 64-bit targets. So error up front instead of throwing an isel error.

Fixes PR37225

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

llvm-svn: 330987

6 years ago[InstCombine][NFC] add2.ll: add a few commutative checks.
Roman Lebedev [Thu, 26 Apr 2018 20:07:17 +0000 (20:07 +0000)]
[InstCombine][NFC] add2.ll: add a few commutative checks.

Fixes some missing test coverage in InstCombineAddSub.cpp, visitAdd()

llvm-svn: 330986

6 years ago[InstCombine][NFC] Autogenerate checks in add2.ll
Roman Lebedev [Thu, 26 Apr 2018 20:07:12 +0000 (20:07 +0000)]
[InstCombine][NFC] Autogenerate checks in add2.ll

llvm-svn: 330985

6 years ago[LLD][WASM] Handle WASM_SYMBOL_TYPE_SECTION in toString().
Roman Lebedev [Thu, 26 Apr 2018 20:00:11 +0000 (20:00 +0000)]
[LLD][WASM] Handle WASM_SYMBOL_TYPE_SECTION in toString().

Fixes build. If this is not the desired solution, please revert.
WasmSymbolType was changed in rL330982 / D44184

llvm-svn: 330984

6 years ago[mips] Accept 32-bit offsets for lb and lbu commands
Simon Atanasyan [Thu, 26 Apr 2018 19:55:28 +0000 (19:55 +0000)]
[mips] Accept 32-bit offsets for lb and lbu commands

`lb` and `lbu` commands accepts 16-bit signed offsets. But GAS accepts
larger offsets for these commands. If an offset does not fit in 16-bit
range, `lb` command is translated into lui/lb or lui/addu/lb series.
It's interesting that initially LLVM assembler supported this feature,
but later it was broken.

This patch restores support for 32-bit offsets. It replaces `mem_simm16`
operand for `LB` and `LBu` definitions by the new `mem_simmptr` operand.
This operand is intended to check that offset fits to the same size as
using for pointers. Later we will be able to extend this rule and
accepts 64-bit offsets when it is possible.

Some issues remain:
- The regression also affects LD, SD, LH, LHU commands. I'm going
  to fix them by a separate patch.

- GAS accepts any 32-bit values as an offset. Now LLVM accepts signed
  16-bit values and this patch extends the range to signed 32-bit offsets.
  In other words, the following code accepted by GAS and still triggers
  an error by LLVM:
```
  lb      $4, 0x80000004

  # gas
  lui     a0, 0x8000
    lb      a0, 4(a0)
```

- In case of 64-bit pointers GAS accepts a 64-bit offset and translates
  it to the li/dsll/lb series of commands. LLVM still rejects it.
  Probably this feature has never been implemented in LLVM. This issue
  is for a separate patch.
```
  lb      $4, 0x800000001

  # gas
  li      a0, 0x8000
  dsll    a0, a0, 0x14
  lb      a0, 4(a0)
```

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

llvm-svn: 330983

6 years ago[WebAssembly] Write DWARF data into wasm object file
Sam Clegg [Thu, 26 Apr 2018 19:27:28 +0000 (19:27 +0000)]
[WebAssembly] Write DWARF data into wasm object file

- Writes ".debug_XXX" into corresponding custom sections.
- Writes relocation records into "reloc.debug_XXX" sections.

Patch by Yury Delendik!

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

llvm-svn: 330982

6 years agoDAG: Fix not legalizing vector fcanonicalizes
Matt Arsenault [Thu, 26 Apr 2018 19:21:37 +0000 (19:21 +0000)]
DAG: Fix not legalizing vector fcanonicalizes

If an fcanoncialize was done on a vector type that was legal,

llvm-svn: 330981

6 years agoAMDGPU: Extend extract_vector_elt fneg combine to fabs
Matt Arsenault [Thu, 26 Apr 2018 19:21:32 +0000 (19:21 +0000)]
AMDGPU: Extend extract_vector_elt fneg combine to fabs

Fixes a regression in a future commit.

llvm-svn: 330980

6 years agoAMDGPU: Consolidate SubtargetPredicate definitions
Matt Arsenault [Thu, 26 Apr 2018 19:21:26 +0000 (19:21 +0000)]
AMDGPU: Consolidate SubtargetPredicate definitions

llvm-svn: 330979

6 years agoDelete unused variable.
Rafael Espindola [Thu, 26 Apr 2018 19:21:07 +0000 (19:21 +0000)]
Delete unused variable.

llvm-svn: 330978

6 years agoSpecify REQUIRES: default_triple in a few tests
Justin Bogner [Thu, 26 Apr 2018 19:15:25 +0000 (19:15 +0000)]
Specify REQUIRES: default_triple in a few tests

These were all failing when specifying LLVM_DEFAULT_TARGET_TRIPLE=''.

llvm-svn: 330977

6 years ago[AArch64] Fix scavenged spill slot base when stack realignment required.
Geoff Berry [Thu, 26 Apr 2018 18:50:45 +0000 (18:50 +0000)]
[AArch64] Fix scavenged spill slot base when stack realignment required.

Summary:
Use the FP for scavenged spill slot accesses to prevent corruption of
the callee-save region when the SP is re-aligned.

Based on problem and patch reported by @paulwalker-arm

This is an alternative to solution proposed in D45770

Reviewers: t.p.northover, paulwalker-arm, thegameg, javed.absar

Subscribers: qcolombet, mcrosier, paulwalker-arm, kristof.beyls, rengolin, javed.absar, llvm-commits

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

llvm-svn: 330976

6 years ago[NFC][InstCombine] rem.ll: add a few commutative tests.
Roman Lebedev [Thu, 26 Apr 2018 18:44:37 +0000 (18:44 +0000)]
[NFC][InstCombine] rem.ll: add a few commutative tests.

This closes a gap in missing test coverage in
isKnownToBeAPowerOfTwo() from ValueTracking.cpp

llvm-svn: 330975

6 years ago[NFC][InstCombine] Regenerate rem.ll test
Roman Lebedev [Thu, 26 Apr 2018 18:44:32 +0000 (18:44 +0000)]
[NFC][InstCombine] Regenerate rem.ll test

llvm-svn: 330974

6 years ago[llvm-objcopy] Implement --redefine-sym option
Alexander Shaposhnikov [Thu, 26 Apr 2018 18:28:17 +0000 (18:28 +0000)]
[llvm-objcopy] Implement --redefine-sym option

This diff implements --redefine-sym option
for changing the name of a symbol.

Test plan: make check-all

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

llvm-svn: 330973

6 years agoaugmenting description for fcmp fmf - NFC
Michael Berg [Thu, 26 Apr 2018 18:17:58 +0000 (18:17 +0000)]
augmenting description for fcmp fmf - NFC

llvm-svn: 330972

6 years ago[WebAssembly] Add version to linking section (to match llvm-side change)
Sam Clegg [Thu, 26 Apr 2018 18:17:21 +0000 (18:17 +0000)]
[WebAssembly] Add version to linking section (to match llvm-side change)

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

llvm-svn: 330971

6 years agoFix a bug that prevents global variables from having a DW_OP_deref.
Adrian Prantl [Thu, 26 Apr 2018 18:17:04 +0000 (18:17 +0000)]
Fix a bug that prevents global variables from having a DW_OP_deref.

For local variables the first DW_OP_deref is consumed by turning the
location kind into a memeory location, but that only makes sense for
values that are in a register to begin with, which cannot happen for
global variables that are attached to a symbol.

rdar://problem/39741860

llvm-svn: 330970

6 years ago[WebAssembly] Add version to object file metadata
Sam Clegg [Thu, 26 Apr 2018 18:15:32 +0000 (18:15 +0000)]
[WebAssembly] Add version to object file metadata

Summary: See https://github.com/WebAssembly/tool-conventions/issues/54

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 330969

6 years ago[Tablegen] SubtargetEmitter: move the logic that prints predicates for variant schedu...
Andrea Di Biagio [Thu, 26 Apr 2018 18:03:24 +0000 (18:03 +0000)]
[Tablegen] SubtargetEmitter: move the logic that prints predicates for variant scheduling classes to helper functions. NFC

llvm-svn: 330968

6 years agoAdd a comment. NFC.
Rafael Espindola [Thu, 26 Apr 2018 18:03:04 +0000 (18:03 +0000)]
Add a comment. NFC.

llvm-svn: 330967

6 years agoReplace SharedSymbols with Defined when creating copy relocations.
Rafael Espindola [Thu, 26 Apr 2018 17:58:58 +0000 (17:58 +0000)]
Replace SharedSymbols with Defined when creating copy relocations.

This is slightly simpler to read IMHO. Now if a symbol has a position
in the file, it is Defined.

The main motivation is that with this a SharedSymbol doesn't need a
section, which reduces the size of SymbolUnion.

With this the peak allocation when linking chromium goes from 568.1 to
564.2 MB.

llvm-svn: 330966

6 years ago[GlobalMerge] Fix a typo
Haicheng Wu [Thu, 26 Apr 2018 17:56:50 +0000 (17:56 +0000)]
[GlobalMerge] Fix a typo

now => know

llvm-svn: 330965

6 years agoRevert "Enable EliminateAvailableExternally pass for -O1"
Vlad Tsyrklevich [Thu, 26 Apr 2018 17:54:53 +0000 (17:54 +0000)]
Revert "Enable EliminateAvailableExternally pass for -O1"

This reverts commit r330961 because it breaks a handful of clang tests.

llvm-svn: 330964

6 years ago[llvm-objcopy] Add --localize-symbol option
Paul Semel [Thu, 26 Apr 2018 17:44:43 +0000 (17:44 +0000)]
[llvm-objcopy] Add --localize-symbol option

llvm-svn: 330963

6 years agoUpdate stale comment in AsmWriter.cpp
Vlad Tsyrklevich [Thu, 26 Apr 2018 17:34:51 +0000 (17:34 +0000)]
Update stale comment in AsmWriter.cpp

Summary:
The old comment referred to llvm/IR/Writer.h which doesn't longer exist.
This patch replaces it with an up-to-date description of AsmWriter library.

Patch by Alex Yursha.

Reviewers: gribozavr, vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits

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

llvm-svn: 330962

6 years agoEnable EliminateAvailableExternally pass for -O1
Vlad Tsyrklevich [Thu, 26 Apr 2018 17:33:24 +0000 (17:33 +0000)]
Enable EliminateAvailableExternally pass for -O1

Summary:
Follow-up to D43690, the EliminateAvailableExternally pass currently
runs under -O0 and -O2 and up. Under -O1 we would still want to drop
available_externally symbols to reduce space without inlining having
run.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, llvm-commits, kcc

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

llvm-svn: 330961

6 years agoSimplify processRelocAux.
Rafael Espindola [Thu, 26 Apr 2018 17:22:44 +0000 (17:22 +0000)]
Simplify processRelocAux.

It returns a different Expr only in the case of creating a function
symbol pointing to its plt entry. We can just add a call to
addPltEntry to avoid that and return void.

With this patch further simplifications of how we handle copy
relocations are possible.

llvm-svn: 330960

6 years ago[WebAssembly] objdump: Don't assume all relocations have symbols
Sam Clegg [Thu, 26 Apr 2018 17:05:04 +0000 (17:05 +0000)]
[WebAssembly] objdump: Don't assume all relocations have symbols

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 330959

6 years ago[docs] provide the specific sanitizer option to detect junk-in-the-ftrunc
Sanjay Patel [Thu, 26 Apr 2018 17:04:07 +0000 (17:04 +0000)]
[docs] provide the specific sanitizer option to detect junk-in-the-ftrunc

llvm-svn: 330958

6 years ago[WebAssembly] Implement getRelocationValueString()
Sam Clegg [Thu, 26 Apr 2018 16:41:51 +0000 (16:41 +0000)]
[WebAssembly] Implement getRelocationValueString()

And use it in llvm-objdump.

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

llvm-svn: 330957

6 years ago[mips] Fix a test case which is keeping the expensive checks bot win red (NFC)
Simon Dardis [Thu, 26 Apr 2018 16:22:47 +0000 (16:22 +0000)]
[mips] Fix a test case which is keeping the expensive checks bot win red (NFC)

llvm-svn: 330956

6 years agoMove old test into test/libcxx, and implement new version of test for ostreambuf_iter...
Marshall Clow [Thu, 26 Apr 2018 16:16:45 +0000 (16:16 +0000)]
Move old test into test/libcxx, and implement new version of test for ostreambuf_iterator::failed. Fixes PR#37245. Thanks to Billy O'Neill for the bug report.

llvm-svn: 330955

6 years ago[AMDGPU][Waitcnt] As of gfx7, VMEM operations do not increment the export counter...
Mark Searles [Thu, 26 Apr 2018 16:11:19 +0000 (16:11 +0000)]
[AMDGPU][Waitcnt] As of gfx7, VMEM operations do not increment the export counter and the input registers are available in the next instruction; update the waitcnt pass to take this into account.

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

llvm-svn: 330954

6 years agoDelete GotPltIndex.
Rafael Espindola [Thu, 26 Apr 2018 16:09:30 +0000 (16:09 +0000)]
Delete GotPltIndex.

It was always an offset of PltIndex.

This doesn't reduce the size of the structures, but makes it easier to
do so in a followup patch.

llvm-svn: 330953

6 years ago[mips] Correct the definitions of some control instructions
Simon Dardis [Thu, 26 Apr 2018 16:06:34 +0000 (16:06 +0000)]
[mips] Correct the definitions of some control instructions

Correct the definitions of ei, di, eret, deret, wait, syscall and break.
Also provide microMIPS specific aliases to match the MIPS aliases.

Additionally correct the definition of the wait instruction so that
it is present in the instruction mapping tables.

Reviewers: smaksimovic, abeserminji, atanasyan

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

llvm-svn: 330952

6 years ago[DAGCombiner] limit ftrunc optimizations with function attribute
Sanjay Patel [Thu, 26 Apr 2018 16:04:44 +0000 (16:04 +0000)]
[DAGCombiner] limit ftrunc optimizations with function attribute

As noted, the attribute name is subject to change once we have
the clang side implemented, but it's clear that we need some
kind of attribute-based predication here based on the discussion
for:
rL330437

llvm-svn: 330951

6 years ago[x86] add tests to show potential opt-out of ftrunc optimization; NFC
Sanjay Patel [Thu, 26 Apr 2018 15:36:15 +0000 (15:36 +0000)]
[x86] add tests to show potential opt-out of ftrunc optimization; NFC

This is another preliminary step for disabling this transform as
discussed in the post-commit thread for:
rL330437
I'm using one of the names suggested there for the attribute, but
we can fix that up as needed once the clang side of this is sorted
out.

llvm-svn: 330950

6 years ago[RISCV] Implement isLoadFromStackSlot and isStoreToStackSlot
Alex Bradbury [Thu, 26 Apr 2018 15:34:27 +0000 (15:34 +0000)]
[RISCV] Implement isLoadFromStackSlot and isStoreToStackSlot

This causes some slight shuffling but no meaningful codegen differences on the
corpus I used for testing, but it has a larger impact when combined with e.g.
rematerialisation. Regardless, it makes sense to report as accurate
target-specific information as possible.

llvm-svn: 330949

6 years ago[NVPTX] Make the legalizer expand shufflevector of <2 x half>
Benjamin Kramer [Thu, 26 Apr 2018 15:26:29 +0000 (15:26 +0000)]
[NVPTX] Make the legalizer expand shufflevector of <2 x half>

There's no direct instruction for this, but it's trivially implemented
with two movs. Without this the code generator just dies when
encountering a shufflevector.

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

llvm-svn: 330948

6 years ago[DAGCombiner] refactor FP->int->FP folds; NFC
Sanjay Patel [Thu, 26 Apr 2018 15:20:18 +0000 (15:20 +0000)]
[DAGCombiner] refactor FP->int->FP folds; NFC

As discussed in the post-review comments for rL330437,
we need to guard this fold to allow existing code to
keep working with the undefined behavior that they've
come to rely on.

That would mean duplicating more code than we already
have, so let's fix that first.

llvm-svn: 330947

6 years agoAdd getDeserializationListener to ASTReader
Yuka Takahashi [Thu, 26 Apr 2018 15:09:13 +0000 (15:09 +0000)]
Add getDeserializationListener to ASTReader

Summary:
We need to know if ASTReader already has a DeserializationListner or
not, and this also helps to create a multiplexing deserialization
listener if there is one already attached.

Reviewers: v.g.vassilev, rsmith, dblaikie, thakis

Subscribers: cfe-commits

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

llvm-svn: 330946

6 years ago[SLP] Add tests for transposable binary operations
Matthew Simpson [Thu, 26 Apr 2018 14:50:04 +0000 (14:50 +0000)]
[SLP] Add tests for transposable binary operations

These test cases are vectorizable, but we are currently unable to vectorize
them effectively.

llvm-svn: 330945

6 years ago[OpenMP] Remove compilation warning when using clang to compile bc files.
Guansong Zhang [Thu, 26 Apr 2018 14:06:53 +0000 (14:06 +0000)]
[OpenMP] Remove compilation warning when using clang to compile bc files.

Summary: Minor printf format correction. NVCC ignore those. Clang will give warning on these if debug is enabled.

Reviewers: grokos

Reviewed By: grokos

Subscribers: openmp-commits

Tags: #openmp

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

llvm-svn: 330944

6 years ago[RISCV] Implement isZextFree
Alex Bradbury [Thu, 26 Apr 2018 14:04:18 +0000 (14:04 +0000)]
[RISCV] Implement isZextFree

This returns true for 8-bit and 16-bit loads, allowing LBU/LHU to be selected
and avoiding unnecessary masks.

llvm-svn: 330943

6 years ago[RISCV] Add test case showing suboptimal codegen when loading unsigned char/short
Alex Bradbury [Thu, 26 Apr 2018 14:00:35 +0000 (14:00 +0000)]
[RISCV] Add test case showing suboptimal codegen when loading unsigned char/short

Implementing isZextFree will allow lbu or lhu to be selected rather than
lb+mask and lh+mask.

llvm-svn: 330942

6 years ago[TTI, AArch64] Add transpose shuffle kind
Matthew Simpson [Thu, 26 Apr 2018 13:48:33 +0000 (13:48 +0000)]
[TTI, AArch64] Add transpose shuffle kind

This patch adds a new shuffle kind useful for transposing a 2xn matrix. These
transpose shuffle masks read corresponding even- or odd-numbered vector
elements from two n-dimensional source vectors and write each result into
consecutive elements of an n-dimensional destination vector. The transpose
shuffle kind is meant to model the TRN1 and TRN2 AArch64 instructions. As such,
this patch also considers transpose shuffles in the AArch64 implementation of
getShuffleCost.

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

llvm-svn: 330941

6 years ago[RISCV] Implement isTruncateFree
Alex Bradbury [Thu, 26 Apr 2018 13:37:00 +0000 (13:37 +0000)]
[RISCV] Implement isTruncateFree

Adapted from ARM's implementation introduced in r313533 and r314280.

llvm-svn: 330940

6 years ago[X86] Fix Update Kill Register in Avoid SFB Pass - Bug 37153
Lama Saba [Thu, 26 Apr 2018 13:16:11 +0000 (13:16 +0000)]
[X86] Fix Update Kill Register in Avoid SFB Pass - Bug 37153

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

Change-Id: Icf6f34f6babc3cb2ff5292fde003472473037a71
llvm-svn: 330939

6 years ago[RISCV] Implement isLegalICmpImmediate
Alex Bradbury [Thu, 26 Apr 2018 13:15:17 +0000 (13:15 +0000)]
[RISCV] Implement isLegalICmpImmediate

I'm unable to construct a representative test case that demonstrates the
advantage, but it seems sensible to report accurate target-specific
information regardless.

llvm-svn: 330938

6 years ago[RISCV] Implement isLegalAddImmediate
Alex Bradbury [Thu, 26 Apr 2018 13:00:37 +0000 (13:00 +0000)]
[RISCV] Implement isLegalAddImmediate

This causes a trivial improvement in the recently added lsr-legaladdimm.ll
test case.

llvm-svn: 330937

6 years ago[RISCV] Add test/CodeGen/RISCV/lsr-legaladdimm.ll
Alex Bradbury [Thu, 26 Apr 2018 12:57:29 +0000 (12:57 +0000)]
[RISCV] Add test/CodeGen/RISCV/lsr-legaladdimm.ll

Add a test case which will show a codegen difference upon the implementation
of a target-specific isLegalAddImmediate.

llvm-svn: 330936

6 years ago[Tablegen] Simplify code in CodeGenSchedule. NFCI
Andrea Di Biagio [Thu, 26 Apr 2018 12:56:26 +0000 (12:56 +0000)]
[Tablegen] Simplify code in CodeGenSchedule. NFCI

llvm-svn: 330935

6 years ago[AArch64][SVE] Enable DiagnosticPredicates for SVE LD1 instructions.
Sander de Smalen [Thu, 26 Apr 2018 12:54:42 +0000 (12:54 +0000)]
[AArch64][SVE] Enable DiagnosticPredicates for SVE LD1 instructions.

This patch extends the PredicateMethod of AsmOperands used in SVE's
LD1 instructions with a DiagnosticPredicate. This makes them 'context
sensitive' to the operand that has been parsed and tells the user to
use the right register (with expected shift/extend), rather than telling
the immediate is out of range when it actually parsed a register.

Patch [2/2] in a series to improve assembler diagnostics for SVE:
-  Patch [1/2]: https://reviews.llvm.org/D45879
-  Patch [2/2]: https://reviews.llvm.org/D45880

Reviewers: olista01, stoklund, craig.topper, mcrosier, rengolin, echristo, fhahn, SjoerdMeijer, evandro, javed.absar

Reviewed By: fhahn

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

llvm-svn: 330934

6 years ago[NVPTX] Deduplicate code. No functionality change.
Benjamin Kramer [Thu, 26 Apr 2018 12:30:16 +0000 (12:30 +0000)]
[NVPTX] Deduplicate code. No functionality change.

llvm-svn: 330933

6 years ago[RISCV] Implement isLegalAddressingMode for RISC-V
Alex Bradbury [Thu, 26 Apr 2018 12:13:48 +0000 (12:13 +0000)]
[RISCV] Implement isLegalAddressingMode for RISC-V

This has no impact on codegen for the current RISC-V unit tests or my small
benchmark set and very minor changes in a few programs in the GCC torture
suite. Based on this, I haven't been able to produce a representative test
program that demonstrates a benefit from isLegalAddressingMode. I'm committing
the patch anyway, on the basis that presenting accurate information to the
target-independent code is preferable to relying on incorrect generic
assumptions.

llvm-svn: 330932

6 years ago[LoopInterchange] Ignore debug intrinsics during legality checks.
Florian Hahn [Thu, 26 Apr 2018 10:26:17 +0000 (10:26 +0000)]
[LoopInterchange] Ignore debug intrinsics during legality checks.

Reviewers: aprantl, mcrosier, karthikthecool

Reviewed By: aprantl

Subscribers: mattd, vsk, #debug-info, llvm-commits

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

llvm-svn: 330931

6 years ago[AsmMatcher] Extend PredicateMethod with optional DiagnosticPredicate
Sander de Smalen [Thu, 26 Apr 2018 09:24:45 +0000 (09:24 +0000)]
[AsmMatcher] Extend PredicateMethod with optional DiagnosticPredicate

An optional, light-weight and backward-compatible mechanism to allow
specifying that a diagnostic _only_ applies to a partial mismatch (NearMiss),
rather than a full mismatch.

Patch [1/2] in a series to improve assembler diagnostics for SVE.
-  Patch [1/2]: https://reviews.llvm.org/D45879
-  Patch [2/2]: https://reviews.llvm.org/D45880

Reviewers: olista01, stoklund, craig.topper, mcrosier, rengolin, echristo, fhahn, SjoerdMeijer, evandro, javed.absar

Reviewed By: olista01

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

llvm-svn: 330930

6 years ago[AArch64][SVE] Asm: Negative tests for all LD1 gather (scalar+vector) load instructions.
Sander de Smalen [Thu, 26 Apr 2018 08:43:22 +0000 (08:43 +0000)]
[AArch64][SVE] Asm: Negative tests for all LD1 gather (scalar+vector) load instructions.

Patch [3/3] in series to add support for SVE's gather load instructions
that use scalar+vector addressing modes:
- Patch [1/3]: https://reviews.llvm.org/D45951
- Patch [2/3]: https://reviews.llvm.org/D46023
- Patch [3/3]: https://reviews.llvm.org/D45958

Reviewers: fhahn, rengolin, samparker, SjoerdMeijer, t.p.northover, echristo, evandro, javed.absar

Reviewed By: fhahn

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

llvm-svn: 330929

6 years ago[AArch64][SVE] Asm: Support for gather LD1/LDFF1 (scalar + vector) load instructions.
Sander de Smalen [Thu, 26 Apr 2018 08:19:53 +0000 (08:19 +0000)]
[AArch64][SVE] Asm: Support for gather LD1/LDFF1 (scalar + vector) load instructions.

Patch [2/3] in series to add support for SVE's gather load instructions
that use scalar+vector addressing modes:
- Patch [1/3]: https://reviews.llvm.org/D45951
- Patch [2/3]: https://reviews.llvm.org/D46023
- Patch [3/3]: https://reviews.llvm.org/D45958

Reviewers: fhahn, rengolin, samparker, SjoerdMeijer, t.p.northover, echristo, evandro, javed.absar

Reviewed By: fhahn

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

llvm-svn: 330928

6 years agoMake test more platform neutral
Serge Pavlov [Thu, 26 Apr 2018 08:08:25 +0000 (08:08 +0000)]
Make test more platform neutral

llvm-svn: 330927

6 years ago[ConfigFiles] Update argument strings when merging argrument lists
Serge Pavlov [Thu, 26 Apr 2018 06:28:47 +0000 (06:28 +0000)]
[ConfigFiles] Update argument strings when merging argrument lists

Implementation of `InputArgList` assumes its field `ArgStrings` contains
strings for each argument exactly in the same order. This condition was
broken when arguments from config file and from invocation were merged.

This change fixes https://bugs.llvm.org/show_bug.cgi?id=37196 (Clang
config files can crash argument handling).

llvm-svn: 330926

6 years agoAdd a test. NFC.
Rafael Espindola [Thu, 26 Apr 2018 06:10:18 +0000 (06:10 +0000)]
Add a test. NFC.

This would have fund a bug in a patch I am working on.

llvm-svn: 330925

6 years ago[cmake] Make linker detection take flags into account
Shoaib Meenai [Thu, 26 Apr 2018 06:04:46 +0000 (06:04 +0000)]
[cmake] Make linker detection take flags into account

LLVM might be compiled using a toolchain file which controls the linker
to use via flags (e.g. `-B` or `-fuse-ld=`). Take these flags into
account for linker detection. We can also correct the detection by
manually passing LLVM_USE_LINKER, of course, but it seems more
convenient to have the detection take flags into account.

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

llvm-svn: 330924