platform/upstream/llvm.git
7 years agoRemove a stale test case.
Lang Hames [Thu, 17 Nov 2016 01:02:52 +0000 (01:02 +0000)]
Remove a stale test case.

llvm-svn: 287183

7 years agollvm-dis: Remove dead code.
Peter Collingbourne [Thu, 17 Nov 2016 00:42:08 +0000 (00:42 +0000)]
llvm-dis: Remove dead code.

llvm-svn: 287182

7 years agoInsert a type check before reading vtable.
Ivan Krasin [Thu, 17 Nov 2016 00:39:48 +0000 (00:39 +0000)]
Insert a type check before reading vtable.

Summary:
this is to prevent a situation when a pointer is invalid or null,
but we get to reading from vtable before we can check that
(possibly causing a segfault without a good diagnostics).

Reviewers: pcc

Subscribers: cfe-commits

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

llvm-svn: 287181

7 years ago[AVR] Remove some accidentally-commited code that broke the bots
Dylan McKay [Thu, 17 Nov 2016 00:09:38 +0000 (00:09 +0000)]
[AVR] Remove some accidentally-commited code that broke the bots

This is a remnant of an on-chip unit testing tool that has since been
moved out-of-tree.

It was accidentally committed in r287162.

llvm-svn: 287180

7 years ago[CMake] Support lld with LTO bootstrap
Petr Hosek [Wed, 16 Nov 2016 23:59:06 +0000 (23:59 +0000)]
[CMake] Support lld with LTO bootstrap

lld has LTO support, if requested we should add a dependency on lld
rather than LLVMgold when doing LTO bootstrap build.

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

llvm-svn: 287179

7 years agoIntroduce GlobalSplit pass.
Peter Collingbourne [Wed, 16 Nov 2016 23:40:26 +0000 (23:40 +0000)]
Introduce GlobalSplit pass.

This pass splits globals into elements using inrange annotations on
getelementptr indices.

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

llvm-svn: 287178

7 years agoAdd warning when assigning enums to bitfields without an explicit unsigned underlying...
Reid Kleckner [Wed, 16 Nov 2016 23:40:00 +0000 (23:40 +0000)]
Add warning when assigning enums to bitfields without an explicit unsigned underlying type

Summary:
Add a warning when assigning enums to bitfields without an explicit
unsigned underlying type. This is to prevent problems with MSVC
compatibility, since the Microsoft ABI defaults to storing enums with a
signed type, causing inconsistencies with saving to/reading from
bitfields.

Also disabled the warning in the dr0xx.cpp test which throws the error,
and added a test for the warning.

The warning can be disabled with -Wno-signed-enum-bitfield.

Patch by Sasha Bermeister!

Reviewers: rnk, aaron.ballman

Subscribers: mehdi_amini, aaron.ballman, cfe-commits, thakis, dcheng

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

llvm-svn: 287177

7 years ago[AVR] Wrap all methods in the pseudo expansion pass in an anon namespace
Dylan McKay [Wed, 16 Nov 2016 23:06:14 +0000 (23:06 +0000)]
[AVR] Wrap all methods in the pseudo expansion pass in an anon namespace

The '-fpermissive' compiler flag complains if the template
specializations used in the class are used in a different namespace.

llvm-svn: 287176

7 years ago[analyzer] Remove unused check::RegionChanges::wantsRegionChangeUpdate callback
Anna Zaks [Wed, 16 Nov 2016 22:59:01 +0000 (22:59 +0000)]
[analyzer] Remove unused check::RegionChanges::wantsRegionChangeUpdate callback

Remove the check::RegionChanges::wantsRegionChangeUpdate callback as it is no
longer used (since checkPointerEscape has been added).

A patch by Krzysztof Wiśniewski!

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

llvm-svn: 287175

7 years ago[AVR] Fix basic block naming in ctlz and cttz tests
Dylan McKay [Wed, 16 Nov 2016 22:48:38 +0000 (22:48 +0000)]
[AVR] Fix basic block naming in ctlz and cttz tests

The branch selector would change the names.

llvm-svn: 287174

7 years ago[AVR] Remove unused method from AVRTargetMachine
Dylan McKay [Wed, 16 Nov 2016 22:48:30 +0000 (22:48 +0000)]
[AVR] Remove unused method from AVRTargetMachine

llvm-svn: 287173

7 years ago[AVR] Add tests for counting leading/trailing zeros
Dylan McKay [Wed, 16 Nov 2016 22:38:43 +0000 (22:38 +0000)]
[AVR] Add tests for counting leading/trailing zeros

This adds two test files that verify the 'cttz' and 'ctlz' operations.

llvm-svn: 287172

7 years ago[x86] allow FP-logic ops when one operand is FP and result is FP
Sanjay Patel [Wed, 16 Nov 2016 22:34:05 +0000 (22:34 +0000)]
[x86] allow FP-logic ops when one operand is FP and result is FP

We save an inter-register file move this way. If there's any CPU where
the FP logic is slower, we could transform this back to int-logic in
MachineCombiner.

This helps, but doesn't solve, PR6137:
https://llvm.org/bugs/show_bug.cgi?id=6137

The 'andn' test shows that we're missing a pattern match to
recognize the xor with -1 constant as a 'not' op.

llvm-svn: 287171

7 years ago[AsmParser] Avoid recursing when lexing ';'. NFC.
Ahmed Bougacha [Wed, 16 Nov 2016 22:25:05 +0000 (22:25 +0000)]
[AsmParser] Avoid recursing when lexing ';'. NFC.

This should prevent stack overflows in non-optimized builds on
.ll files with lots of consecutive commented-out lines.

Instead of recursing into LexToken(), continue into a 'while (true)'.

llvm-svn: 287170

7 years ago[CodeGen] Pass references, not pointers, to MMI helpers. NFC.
Ahmed Bougacha [Wed, 16 Nov 2016 22:25:03 +0000 (22:25 +0000)]
[CodeGen] Pass references, not pointers, to MMI helpers. NFC.

While there, rename them to follow the coding style.

llvm-svn: 287169

7 years agoRevert "Get GlobalISel to build on Linux after r286407"
Ahmed Bougacha [Wed, 16 Nov 2016 22:24:59 +0000 (22:24 +0000)]
Revert "Get GlobalISel to build on Linux after r286407"

This reverts commit r286962.

We want to avoid depending on SelectionDAG, and AddLandingPadInfo
lives in CodeGen now.

llvm-svn: 287168

7 years ago[CodeGen] Pull MMI helpers from FunctionLoweringInfo to MMI. NFC.
Ahmed Bougacha [Wed, 16 Nov 2016 22:24:56 +0000 (22:24 +0000)]
[CodeGen] Pull MMI helpers from FunctionLoweringInfo to MMI. NFC.

They're not SelectionDAG- or FunctionLoweringInfo-specific.  They
are, however, specific to building MMI from IR.
We could make them members, but it's nice having MMI be a "simple" data
structure and this logic kept separate.

This also lets us reuse them from GlobalISel.

llvm-svn: 287167

7 years ago[CodeGen] Cleanup MachineModuleInfo doxygen comments. NFC.
Ahmed Bougacha [Wed, 16 Nov 2016 22:24:53 +0000 (22:24 +0000)]
[CodeGen] Cleanup MachineModuleInfo doxygen comments. NFC.

Remove redundant names and only keep header comments.

llvm-svn: 287166

7 years ago[CodeGen] Sort MMI forward declarations. NFC.
Ahmed Bougacha [Wed, 16 Nov 2016 22:24:46 +0000 (22:24 +0000)]
[CodeGen] Sort MMI forward declarations. NFC.

llvm-svn: 287165

7 years ago[libc++] Introduce `_LIBCPP_OVERRIDABLE_FUNC_VIS`
Shoaib Meenai [Wed, 16 Nov 2016 22:18:10 +0000 (22:18 +0000)]
[libc++] Introduce `_LIBCPP_OVERRIDABLE_FUNC_VIS`

This is a generalization of `_LIBCPP_NEW_DELETE_VIS`; the new macro name
captures the semantics better, and also allows us to get rid of the
`_WIN32` check in `include/new`. No functional change.

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

llvm-svn: 287164

7 years agoGeneral clean up of error handling in llvm-objdump to remove its use of report_fatal_...
Kevin Enderby [Wed, 16 Nov 2016 22:17:38 +0000 (22:17 +0000)]
General clean up of error handling in llvm-objdump to remove its use of report_fatal_error().
No real functional change with this commit.

The problem with report_fatal_error() is it does not include the tool name
and the file name the for which the error message was generated.

Uses of report_fatal_error() were change to report_error() or error()
to get a better error and to make the code smaller and cleaner.

Also changed things like error(errorToErrorCode(SOrErr.takeError())) to
use report_error() with a file name and the llvm::Error (as well as the
ArchitectureName if available) so the error message is printed.

llvm-svn: 287163

7 years ago[AVR] Add the pseudo instruction expansion pass
Dylan McKay [Wed, 16 Nov 2016 21:58:04 +0000 (21:58 +0000)]
[AVR] Add the pseudo instruction expansion pass

Summary:
A lot of the pseudo instructions are required because LLVM assumes that
all integers of the same size as the pointer size are legal. This means
that it will not currently expand 16-bit instructions to their 8-bit
variants because it thinks 16-bit types are legal for the operations.

This also adds all of the CodeGen tests that required the pass to run.

Reviewers: arsenm, kparzysz

Subscribers: wdng, mgorny, modocache, llvm-commits

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

llvm-svn: 287162

7 years agoFix "isn't a prototype" warning
Vitaly Buka [Wed, 16 Nov 2016 21:51:39 +0000 (21:51 +0000)]
Fix "isn't a prototype" warning

llvm-svn: 287161

7 years agoX86: Simplify X86ISD::Wrapper operand checks. NFCI.
Peter Collingbourne [Wed, 16 Nov 2016 21:48:59 +0000 (21:48 +0000)]
X86: Simplify X86ISD::Wrapper operand checks. NFCI.

We only ever create TargetConstantPool, TargetJumpTable, TargetExternalSymbol,
TargetGlobalAddress, TargetGlobalTLSAddress, MCSymbol and TargetBlockAddress
nodes as operands of X86ISD::Wrapper nodes, so we can remove one check and
invert the other.

Also update the documentation comment for X86ISD::Wrapper.

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

llvm-svn: 287160

7 years ago[ImplicitNullChecks] Do not not handle call MachineInstrs
Sanjoy Das [Wed, 16 Nov 2016 21:45:22 +0000 (21:45 +0000)]
[ImplicitNullChecks] Do not not handle call MachineInstrs

We don't track callee clobbered registers correctly, so avoid hoisting
across calls.

Note: for this bug to trigger we need a `readonly` call target, since we
already have logic to not hoist across potentially storing instructions
either.

llvm-svn: 287159

7 years agoFix some unit test compilation failures.
Zachary Turner [Wed, 16 Nov 2016 21:45:11 +0000 (21:45 +0000)]
Fix some unit test compilation failures.

llvm-svn: 287158

7 years agoMake Apropos functions accept StringRefs.
Zachary Turner [Wed, 16 Nov 2016 21:45:04 +0000 (21:45 +0000)]
Make Apropos functions accept StringRefs.

llvm-svn: 287157

7 years agoBitcode: Introduce initial multi-module reader API.
Peter Collingbourne [Wed, 16 Nov 2016 21:44:45 +0000 (21:44 +0000)]
Bitcode: Introduce initial multi-module reader API.

Implement getLazyBitcodeModule() and parseBitcodeFile() in terms of it.

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

llvm-svn: 287156

7 years agoUpdate GenerateAdditionalHelpAvenues to take StringRef.
Zachary Turner [Wed, 16 Nov 2016 21:34:22 +0000 (21:34 +0000)]
Update GenerateAdditionalHelpAvenues to take StringRef.

llvm-svn: 287155

7 years agoUse the member function location in enable_if diagnostics.
George Burgess IV [Wed, 16 Nov 2016 21:31:25 +0000 (21:31 +0000)]
Use the member function location in enable_if diagnostics.

Before:
<stdin>:3:3: error: no matching member function for call to 'bar'
  Foo().bar();
  ^

After:
<stdin>:3:9: error: no matching member function for call to 'bar'
  Foo().bar();
        ^

llvm-svn: 287154

7 years ago[clang-tidy] Fix identifier naming for initializer list member initializers.
Eric Fiselier [Wed, 16 Nov 2016 21:15:58 +0000 (21:15 +0000)]
[clang-tidy] Fix identifier naming for initializer list member initializers.

Summary:
This patch adds handling for member initializers in a constructors initializer list. Previously we only handled base-class and delegating initializers, which are transformed by the `TypeLoc` matcher. For Example:

```
// Style options: All identifiers should start with an upper case letter.
struct base { ...  };
struct der :  base {
  int field;  // FIXES: int Field;
  der() : der(42) {} // FIXES: Der() : Der(42) {}
  der(int X) : base(), field(X) {} // FIXES: Der(int X) : Base(), field(X)
  // Note that `field` doesn't get replaced
};
```

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 287153

7 years agoDon't allow direct access to StreamString's internal buffer.
Zachary Turner [Wed, 16 Nov 2016 21:15:24 +0000 (21:15 +0000)]
Don't allow direct access to StreamString's internal buffer.

This is a large API change that removes the two functions from
StreamString that return a std::string& and a const std::string&,
and instead provide one function which returns a StringRef.

Direct access to the underlying buffer violates the concept of
a "stream" which is intended to provide forward only access,
and makes porting to llvm::raw_ostream more difficult in the
future.

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

llvm-svn: 287152

7 years ago[ELF][MIPS] Add MipsGotSection to handle MIPS GOT
Simon Atanasyan [Wed, 16 Nov 2016 21:01:02 +0000 (21:01 +0000)]
[ELF][MIPS] Add MipsGotSection to handle MIPS GOT

MIPS GOT handling is very different from other targets so it is better
to keep the code in the separatre section class MipsGotSection. This
patch introduces the new section and moves all MIPS specific code from
GotSection to the new class. I did not rename fields and methods in the
MipsGotSection class to reduce the diff and plan to do that by the
separate commit.

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

llvm-svn: 287150

7 years agoARM: fix CodeGen for 64-bit shifts.
Tim Northover [Wed, 16 Nov 2016 20:54:28 +0000 (20:54 +0000)]
ARM: fix CodeGen for 64-bit shifts.

One half of the shifts obviously needed conditional selection based on whether
the shift amount is more than 32-bits, but leaving the other half as the
natural shift isn't acceptable either: it's undefined behaviour to shift a
32-bit value by more than 31.

llvm-svn: 287149

7 years agoMake block placement deterministic
Rong Xu [Wed, 16 Nov 2016 20:50:06 +0000 (20:50 +0000)]
Make block placement deterministic

We fail to produce bit-to-bit matching stage2 and stage3 compiler in PGO
bootstrap build. The reason is because LoopBlockSet is of SmallPtrSet type
whose iterating order depends on the pointer value.

This patch fixes this issue by changing to use SmallSetVector.

Differential Revision: http://reviews.llvm.org/D26634

llvm-svn: 287148

7 years ago[InstCombine] replace unreachable with assert and remove unreachable code; NFCI
Sanjay Patel [Wed, 16 Nov 2016 20:40:02 +0000 (20:40 +0000)]
[InstCombine] replace unreachable with assert and remove unreachable code; NFCI

llvm-svn: 287147

7 years agoAMDGPU: Enable ConstrainCopy DAG mutation
Matt Arsenault [Wed, 16 Nov 2016 20:35:23 +0000 (20:35 +0000)]
AMDGPU: Enable ConstrainCopy DAG mutation

This fixes a probably unintended divergence from the default
scheduler behavior.

llvm-svn: 287146

7 years ago[InstCombine] fix formatting and add FIXMEs to foldOperationIntoSelectOperand(); NFC
Sanjay Patel [Wed, 16 Nov 2016 20:18:34 +0000 (20:18 +0000)]
[InstCombine] fix formatting and add FIXMEs to foldOperationIntoSelectOperand(); NFC

llvm-svn: 287145

7 years agoadding operator* to help working with primitive values
Mike Aizatsky [Wed, 16 Nov 2016 19:35:37 +0000 (19:35 +0000)]
adding operator* to help working with primitive values

Subscribers: kubabrecka

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

llvm-svn: 287144

7 years ago[ELF] Don't replace path separators on *NIX.
Davide Italiano [Wed, 16 Nov 2016 19:35:36 +0000 (19:35 +0000)]
[ELF] Don't replace path separators on *NIX.

Apparently this is wrong because it's legal to have a filename
on UNIX which contains a backslash.

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

llvm-svn: 287143

7 years ago[AArch64] Handle vector types in replaceZeroVectorStore.
Geoff Berry [Wed, 16 Nov 2016 19:35:19 +0000 (19:35 +0000)]
[AArch64] Handle vector types in replaceZeroVectorStore.

Summary:
Extend replaceZeroVectorStore to handle more vector type stores,
floating point zero vectors and set alignment more accurately on split
stores.

This is a follow-up change to r286875.

This change fixes PR31038.

Reviewers: MatzeB

Subscribers: mcrosier, aemerson, llvm-commits, rengolin

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

llvm-svn: 287142

7 years agoRelax testcase.
Adrian Prantl [Wed, 16 Nov 2016 19:31:44 +0000 (19:31 +0000)]
Relax testcase.
This removes checks that are irrelevant for what is being tested.

llvm-svn: 287141

7 years agoReduce number of tasks in parallel_for_each.
Rui Ueyama [Wed, 16 Nov 2016 19:27:33 +0000 (19:27 +0000)]
Reduce number of tasks in parallel_for_each.

TaskGroup has a fairly high overhead, so we don't want to partition
tasks into too small tasks. This patch partition tasks into up to
1024 tasks.

I compared this patch with the original LLD's parallel_for_each.
I reverted r287042 locally for comparison.

With this patch, time to self-link lld with debug info changed from
6.23 seconds to 4.62 seconds (-25.8%), with -threads and without -build-id.
With both -threads and -build-id, it improved from 11.71 seconds
to 4.94 seconds (-57.8%). Full results are below.

BTW, GNU gold takes 11.65 seconds to link the same binary.

NOW

--no-threads --build-id=none
       6789.847776 task-clock (msec)         #    1.000 CPUs utilized            ( +-  1.86% )
               685 context-switches          #    0.101 K/sec                    ( +-  2.82% )
                 4 cpu-migrations            #    0.001 K/sec                    ( +- 31.18% )
         1,424,690 page-faults               #    0.210 M/sec                    ( +-  1.07% )
    21,339,542,522 cycles                    #    3.143 GHz                      ( +-  1.49% )
    13,092,260,230 stalled-cycles-frontend   #   61.35% frontend cycles idle     ( +-  2.23% )
   <not supported> stalled-cycles-backend
    21,462,051,828 instructions              #    1.01  insns per cycle
                                             #    0.61  stalled cycles per insn  ( +-  0.41% )
     3,955,296,378 branches                  #  582.531 M/sec                    ( +-  0.39% )
        75,699,909 branch-misses             #    1.91% of all branches          ( +-  0.08% )

       6.787630744 seconds time elapsed                                          ( +-  1.86% )

--threads --build-id=none
      14767.148697 task-clock (msec)         #    3.196 CPUs utilized            ( +-  2.56% )
            28,891 context-switches          #    0.002 M/sec                    ( +-  1.99% )
               905 cpu-migrations            #    0.061 K/sec                    ( +-  5.49% )
         1,262,122 page-faults               #    0.085 M/sec                    ( +-  1.68% )
    43,116,163,217 cycles                    #    2.920 GHz                      ( +-  3.07% )
    33,690,171,242 stalled-cycles-frontend   #   78.14% frontend cycles idle     ( +-  3.67% )
   <not supported> stalled-cycles-backend
    22,836,731,536 instructions              #    0.53  insns per cycle
                                             #    1.48  stalled cycles per insn  ( +-  1.13% )
     4,382,712,998 branches                  #  296.788 M/sec                    ( +-  1.33% )
        78,622,295 branch-misses             #    1.79% of all branches          ( +-  0.54% )

       4.621228056 seconds time elapsed                                          ( +-  1.90% )

--threads --build-id=sha1
      24594.457135 task-clock (msec)         #    4.974 CPUs utilized            ( +-  1.78% )
            29,902 context-switches          #    0.001 M/sec                    ( +-  2.62% )
             1,097 cpu-migrations            #    0.045 K/sec                    ( +-  6.29% )
         1,313,947 page-faults               #    0.053 M/sec                    ( +-  2.36% )
    70,516,415,741 cycles                    #    2.867 GHz                      ( +-  0.78% )
    47,570,262,296 stalled-cycles-frontend   #   67.46% frontend cycles idle     ( +-  0.86% )
   <not supported> stalled-cycles-backend
    73,124,599,029 instructions              #    1.04  insns per cycle
                                             #    0.65  stalled cycles per insn  ( +-  0.33% )
    10,495,266,104 branches                  #  426.733 M/sec                    ( +-  0.41% )
        91,444,149 branch-misses             #    0.87% of all branches          ( +-  0.83% )

       4.944291711 seconds time elapsed                                          ( +-  1.72% )

PREVIOUS

--threads --build-id=none
       7307.437544 task-clock (msec)         #    1.160 CPUs utilized            ( +-  2.34% )
             3,128 context-switches          #    0.428 K/sec                    ( +-  4.37% )
               352 cpu-migrations            #    0.048 K/sec                    ( +-  5.98% )
         1,354,450 page-faults               #    0.185 M/sec                    ( +-  2.20% )
    22,081,733,098 cycles                    #    3.022 GHz                      ( +-  1.46% )
    13,709,991,267 stalled-cycles-frontend   #   62.09% frontend cycles idle     ( +-  1.77% )
   <not supported> stalled-cycles-backend
    21,634,468,895 instructions              #    0.98  insns per cycle
                                             #    0.63  stalled cycles per insn  ( +-  0.86% )
     3,993,062,361 branches                  #  546.438 M/sec                    ( +-  0.83% )
        76,188,819 branch-misses             #    1.91% of all branches          ( +-  0.19% )

       6.298101157 seconds time elapsed                                          ( +-  2.03% )

--threads --build-id=sha1
      12845.420265 task-clock (msec)         #    1.097 CPUs utilized            ( +-  1.95% )
             4,020 context-switches          #    0.313 K/sec                    ( +-  2.89% )
               369 cpu-migrations            #    0.029 K/sec                    ( +-  6.26% )
         1,464,822 page-faults               #    0.114 M/sec                    ( +-  1.37% )
    40,668,449,813 cycles                    #    3.166 GHz                      ( +-  0.96% )
    18,863,982,388 stalled-cycles-frontend   #   46.38% frontend cycles idle     ( +-  1.82% )
   <not supported> stalled-cycles-backend
    71,560,499,058 instructions              #    1.76  insns per cycle
                                             #    0.26  stalled cycles per insn  ( +-  0.14% )
    10,044,152,441 branches                  #  781.925 M/sec                    ( +-  0.19% )
        87,835,773 branch-misses             #    0.87% of all branches          ( +-  0.09% )

      11.711773314 seconds time elapsed                                          ( +-  1.51% )

llvm-svn: 287140

7 years agoAdd the missing FileCheck invocation to this testcase.
Adrian Prantl [Wed, 16 Nov 2016 19:26:11 +0000 (19:26 +0000)]
Add the missing FileCheck invocation to this testcase.

llvm-svn: 287139

7 years agoRangify for loops, NFC.
Yaron Keren [Wed, 16 Nov 2016 19:24:10 +0000 (19:24 +0000)]
Rangify for loops, NFC.

llvm-svn: 287138

7 years agoExport fewer functions from Error.h.
Rui Ueyama [Wed, 16 Nov 2016 18:54:37 +0000 (18:54 +0000)]
Export fewer functions from Error.h.

Also add a comment saying that check() returns a value.

llvm-svn: 287136

7 years ago[LoopVectorize] Fix for non-determinism in codegen
Mandeep Singh Grang [Wed, 16 Nov 2016 18:53:17 +0000 (18:53 +0000)]
[LoopVectorize] Fix for non-determinism in codegen

Summary: This patch fixes issues in codegen uncovered due to https://reviews.llvm.org/D26718

Reviewers: mssimpso

Subscribers: llvm-commits, mzolotukhin

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

llvm-svn: 287135

7 years agoFix PR31029 by attaching an artificial debug location to msabi thunks.
Adrian Prantl [Wed, 16 Nov 2016 18:49:47 +0000 (18:49 +0000)]
Fix PR31029 by attaching an artificial debug location to msabi thunks.
This was a latent bug that was recently uncovered by r286400.

llvm-svn: 287134

7 years ago[ELF] - Separate locals list from versions.
George Rimar [Wed, 16 Nov 2016 18:46:23 +0000 (18:46 +0000)]
[ELF] - Separate locals list from versions.

This change separates all versioned locals to be a separate list in config,
that was suggested by Rafael and simplifies the logic a bit.

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

llvm-svn: 287132

7 years agoAMDGPU/SI: Avoid creating unnecessary copies in the SIFixSGPRCopies pass
Tom Stellard [Wed, 16 Nov 2016 18:42:17 +0000 (18:42 +0000)]
AMDGPU/SI: Avoid creating unnecessary copies in the SIFixSGPRCopies pass

Summary:
1. Don't try to copy values to and from the same register class.
2. Replace copies with of registers with immediate values with v_mov/s_mov
   instructions.

The main purpose of this change is to make MachineSink do a better job of
determining when it is beneficial to split a critical edge, since the pass
assumes that copies will become move instructions.

This prevents a regression in uniform-cfg.ll if we enable critical edge
splitting for AMDGPU.

Reviewers: arsenm

Subscribers: arsenm, kzhuravl, llvm-commits

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

llvm-svn: 287131

7 years ago[ExecutionEngine] Fix examples build broken in r287126 and other Include What You...
Eugene Zelenko [Wed, 16 Nov 2016 18:32:58 +0000 (18:32 +0000)]
[ExecutionEngine] Fix examples build broken in r287126 and other Include What You Use warnings.

llvm-svn: 287130

7 years agoFixed layout of test/ASTMerge.
Sean Callanan [Wed, 16 Nov 2016 18:21:00 +0000 (18:21 +0000)]
Fixed layout of test/ASTMerge.

As outlined in a previous RFC, the test/ASTMerge/Inputs folder is getting full and the tests are starting to become interdependent. This is undesirable because

- it makes it harder to write new tests
- it makes it harder to figure out at a glance what old tests are doing, and
- it adds the risk of breaking one test while changing a different one, because of the interdependencies.

To fix this, according to the conversation in the RFC, I have changed the layout from

a.c
Inputs/a1.c
Inputs/a2.c

to

a/test.c
a/Inputs/a1.c
a/Inputs/a2.c
for all existing tests. I have also eliminated interdependencies by replicating the input files for each test that uses them.

https://reviews.llvm.org/D26571

llvm-svn: 287129

7 years ago[Frontend] Allow attaching an external sema source to compiler instance and extra...
Benjamin Kramer [Wed, 16 Nov 2016 18:15:26 +0000 (18:15 +0000)]
[Frontend] Allow attaching an external sema source to compiler instance and extra diags to TypoCorrections

This can be used to append alternative typo corrections to an existing diag.
include-fixer can use it to suggest includes to be added.

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

llvm-svn: 287128

7 years agofix comment formatting; NFC
Sanjay Patel [Wed, 16 Nov 2016 18:09:44 +0000 (18:09 +0000)]
fix comment formatting; NFC

llvm-svn: 287127

7 years ago[ExecutionEngine] Fix some Clang-tidy modernize-use-default, modernize-use-equals...
Eugene Zelenko [Wed, 16 Nov 2016 18:07:33 +0000 (18:07 +0000)]
[ExecutionEngine] Fix some Clang-tidy modernize-use-default, modernize-use-equals-delete and Include What You Use warnings; other minor fixes.

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

llvm-svn: 287126

7 years agoDon't error if __tls_get_addr is defined.
Rafael Espindola [Wed, 16 Nov 2016 18:01:41 +0000 (18:01 +0000)]
Don't error if __tls_get_addr is defined.

Turns out some systems do define it. Not producing an error in this
case matches gold and bfd.

llvm-svn: 287125

7 years ago[ELF] - Added support for extern "c++" local symbols in version script.
George Rimar [Wed, 16 Nov 2016 17:59:10 +0000 (17:59 +0000)]
[ELF] - Added support for extern "c++" local symbols in version script.

Previously we did not support them,
patch implements this functionality

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

llvm-svn: 287124

7 years ago[ELF] - Change error message according to review comment. NFC.
George Rimar [Wed, 16 Nov 2016 17:45:45 +0000 (17:45 +0000)]
[ELF] - Change error message according to review comment. NFC.

Forgot about that, I am sorry.

llvm-svn: 287123

7 years ago[x86] add fake scalar FP logic instructions to ReplaceableInstrs to save some bytes
Sanjay Patel [Wed, 16 Nov 2016 17:42:40 +0000 (17:42 +0000)]
[x86] add fake scalar FP logic instructions to ReplaceableInstrs to save some bytes

We can replace "scalar" FP-bitwise-logic with other forms of bitwise-logic instructions.
Scalar SSE/AVX FP-logic instructions only exist in your imagination and/or the bowels of
compilers, but logically equivalent int, float, and double variants of bitwise-logic
instructions are reality in x86, and the float variant may be a shorter instruction
depending on which flavor (SSE or AVX) of vector ISA you have...so just prefer float all
the time.

This is a preliminary step towards solving PR6137:
https://llvm.org/bugs/show_bug.cgi?id=6137

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

llvm-svn: 287122

7 years ago[Orc] Re-enable the RPC unit test disabled in r286917.
Lang Hames [Wed, 16 Nov 2016 17:31:09 +0000 (17:31 +0000)]
[Orc] Re-enable the RPC unit test disabled in r286917.

This unit test infinite-looped on s390x due to a thread_yield being optimized
out. I've updated the QueueChannel class (where thread_yield was called) to use
a condition variable instead. This should cause the unit test to behave
correctly.

llvm-svn: 287121

7 years ago[ELF] - Improve diagnostic messages.
George Rimar [Wed, 16 Nov 2016 17:24:06 +0000 (17:24 +0000)]
[ELF] - Improve diagnostic messages.

Particulaty "cannot preempt symbol" message
is extended with locations now.

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

llvm-svn: 287120

7 years agoDefine -build-id=tree as a synonym for -build-id=sha1.
Rui Ueyama [Wed, 16 Nov 2016 17:14:11 +0000 (17:14 +0000)]
Define -build-id=tree as a synonym for -build-id=sha1.

Our build-id is a tree hash anyway, so I'll define this as a synonym
for sha1. GNU gold takes this parameter, so this is for compatibility
with that.

llvm-svn: 287119

7 years ago[change-namespace] handle constructor initializer: Derived : Base::Base() {} and...
Eric Liu [Wed, 16 Nov 2016 16:54:53 +0000 (16:54 +0000)]
[change-namespace] handle constructor initializer: Derived : Base::Base() {} and added conflict detections

Summary:
namespace nx { namespace ny { class Base { public: Base(i) {}} } }
namespace na {
namespace nb {
class X : public nx::ny {
public:
  X() : Base::Base(1) {}
};
}
}

When changing from na::nb to x::y, "Base::Base" will be changed to "nx::ny::Base" and
 "Base::" in "Base::Base" will be replaced with "nx::ny::Base" too, which causes
conflict. This conflict should've been detected when adding replacements but was hidden by `addOrMergeReplacement`. We now also detect conflict when adding replacements where conflict must not happen.

The namespace lookup is tricky here, we simply replace "Base::Base()" with "nx::ny::Base()" as a workaround, which compiles but not perfect.

Reviewers: hokein

Subscribers: bkramer, cfe-commits

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

llvm-svn: 287118

7 years ago[sancov] Name the global containing the main source file name
Reid Kleckner [Wed, 16 Nov 2016 16:50:43 +0000 (16:50 +0000)]
[sancov] Name the global containing the main source file name

If the global name doesn't start with __sancov_gen, ASan will insert
unecessary red zones around it.

llvm-svn: 287117

7 years agotest commit, changed tab to spaces, NFC
Daniil Fukalov [Wed, 16 Nov 2016 16:41:40 +0000 (16:41 +0000)]
test commit, changed tab to spaces, NFC

llvm-svn: 287116

7 years agotarget-data test update for TCE and TCELE
Pekka Jaaskelainen [Wed, 16 Nov 2016 16:21:59 +0000 (16:21 +0000)]
target-data test update for TCE and TCELE

llvm-svn: 287115

7 years agoRemove duplicate condition (PR30648). NFCI.
Simon Pilgrim [Wed, 16 Nov 2016 16:11:08 +0000 (16:11 +0000)]
Remove duplicate condition (PR30648). NFCI.

We only need to check that the bitstream entry is a Record.

llvm-svn: 287114

7 years agoRemove Windows-specific minidump plugin
Adrian McCarthy [Wed, 16 Nov 2016 16:04:14 +0000 (16:04 +0000)]
Remove Windows-specific minidump plugin

With the cross-platform minidump plugin working, the Windows-specific one is no longer needed. This eliminates the unnecessary code.

This does not eliminate the Windows-specific tests, as they hit a few cases the general tests don't. (The Windows-specific tests are currently passing.) I'll look into a separate patch to make sure we're not doing too much duplicate testing.

After that I might do a little re-org in the Windows plugin, as there was some factoring there (Common & Live) that probably isn't necessary anymore.

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

llvm-svn: 287113

7 years agoAdd a little endian variant of TCE.
Pekka Jaaskelainen [Wed, 16 Nov 2016 15:22:31 +0000 (15:22 +0000)]
Add a little endian variant of TCE.

llvm-svn: 287112

7 years agoAdd a little endian variant of TCE.
Pekka Jaaskelainen [Wed, 16 Nov 2016 15:22:23 +0000 (15:22 +0000)]
Add a little endian variant of TCE.

llvm-svn: 287111

7 years ago[X86] Add integer division test for PR23590
Simon Pilgrim [Wed, 16 Nov 2016 14:54:34 +0000 (14:54 +0000)]
[X86] Add integer division test for PR23590

Shows missed opportunity to recognise reduced integer division result size

llvm-svn: 287110

7 years agoFix -verify tests for older ccache versions
Eric Fiselier [Wed, 16 Nov 2016 14:48:42 +0000 (14:48 +0000)]
Fix -verify tests for older ccache versions

llvm-svn: 287109

7 years ago[X86][AVX512] Autoupgrade lossless i32/u32 to f64 conversion intrinsics with generic IR
Simon Pilgrim [Wed, 16 Nov 2016 14:48:32 +0000 (14:48 +0000)]
[X86][AVX512] Autoupgrade lossless i32/u32 to f64 conversion intrinsics with generic IR

Both the (V)CVTDQ2PD (i32 to f64) and (V)CVTUDQ2PD (u32 to f64) conversion instructions are lossless and can be safely represented as generic SINT_TO_FP/UINT_TO_FP calls instead of x86 intrinsics without affecting final codegen.

LLVM counterpart to D26686

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

llvm-svn: 287108

7 years ago[clang-tidy] New check to prefer transparent functors to non-transparent ones.
Gabor Horvath [Wed, 16 Nov 2016 14:42:10 +0000 (14:42 +0000)]
[clang-tidy] New check to prefer transparent functors to non-transparent ones.

llvm-svn: 287107

7 years ago[X86][AVX512] Added some mask/maskz tests for sitofp/uitofp i32 to f64
Simon Pilgrim [Wed, 16 Nov 2016 14:24:04 +0000 (14:24 +0000)]
[X86][AVX512] Added some mask/maskz tests for sitofp/uitofp i32 to f64

llvm-svn: 287106

7 years ago[www] Fix spelling error in checker release notes.
Devin Coughlin [Wed, 16 Nov 2016 14:23:41 +0000 (14:23 +0000)]
[www] Fix spelling error in checker release notes.

llvm-svn: 287105

7 years ago[X86] Regenerated integer divide tests to test on 32 and 64 bit targets
Simon Pilgrim [Wed, 16 Nov 2016 14:12:11 +0000 (14:12 +0000)]
[X86] Regenerated integer divide tests to test on 32 and 64 bit targets

llvm-svn: 287104

7 years ago[X86][SSE] Added PSUBUS from SELECT tests from D25987
Simon Pilgrim [Wed, 16 Nov 2016 13:59:03 +0000 (13:59 +0000)]
[X86][SSE] Added PSUBUS from SELECT tests from D25987

llvm-svn: 287103

7 years agoRangify for loop, NFC.
Yaron Keren [Wed, 16 Nov 2016 13:45:34 +0000 (13:45 +0000)]
Rangify for loop, NFC.

llvm-svn: 287102

7 years ago[clang-move] Support moving function.
Haojian Wu [Wed, 16 Nov 2016 13:05:19 +0000 (13:05 +0000)]
[clang-move] Support moving function.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 287101

7 years ago[OpenCL] Use the semantic spelling of the Access attribute, rather than a string.
Joey Gouly [Wed, 16 Nov 2016 11:34:09 +0000 (11:34 +0000)]
[OpenCL] Use the semantic spelling of the Access attribute, rather than a string.

Also fix a latent bug, due to an incorrect traversal of the AttributeList.

llvm-svn: 287100

7 years ago[mips] Fix unsigned/signed type error
Simon Dardis [Wed, 16 Nov 2016 11:29:07 +0000 (11:29 +0000)]
[mips] Fix unsigned/signed type error

MipsFastISel uses a a class to represent addresses with a signed member
to represent the offset. MipsFastISel::emitStore, emitLoad and computeAddress
all treated the offset as being positive. In cases where the offset was
actually negative and a frame pointer was used, this would cause the constant
synthesis routine to crash as it would generate an unexpected instruction
sequence when frame indexes are replaced.

Reviewers: vkalintiris

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

llvm-svn: 287099

7 years agoUpdate to isl-0.17.1-267-gbf9723d
Tobias Grosser [Wed, 16 Nov 2016 11:06:47 +0000 (11:06 +0000)]
Update to isl-0.17.1-267-gbf9723d

This update corrects an incorrect generation of min/max expressions in the isl
AST generator and a problematic nullptr dereference.

llvm-svn: 287098

7 years ago[mips] not instruction alias
Simon Dardis [Wed, 16 Nov 2016 11:04:49 +0000 (11:04 +0000)]
[mips] not instruction alias

This patch adds the single operand form of the not alias to microMIPS and
MIPS along with additional tests.

This partially resolves PR/30381.

Thanks to Sean Bruno for reporting the issue!

llvm-svn: 287097

7 years agoRemove TimeValue class
Pavel Labath [Wed, 16 Nov 2016 10:54:22 +0000 (10:54 +0000)]
Remove TimeValue class

Summary:
All usages have been replaced by appropriate std::chrono funcionality, and the
class is now unused. The only used part of the cpp file is the DumpTimePoint
function, which I have moved into the only caller (CommandObjectTarget.cpp).

Reviewers: clayborg, zturner

Subscribers: mgorny, lldb-commits

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

llvm-svn: 287096

7 years agoFix printf warning I introduced in ModuleSpec.h
Pavel Labath [Wed, 16 Nov 2016 10:54:17 +0000 (10:54 +0000)]
Fix printf warning I introduced in ModuleSpec.h

llvm-svn: 287095

7 years agoRemove TimeValue class
Pavel Labath [Wed, 16 Nov 2016 10:46:48 +0000 (10:46 +0000)]
Remove TimeValue class

Summary:
All uses have been replaced by appropriate std::chrono types, and the class is
now unused.

Reviewers: zturner, mehdi_amini

Subscribers: llvm-commits, mgorny

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

llvm-svn: 287094

7 years ago[ELF] Convert RelocationSection to input section
Eugene Leviant [Wed, 16 Nov 2016 10:02:27 +0000 (10:02 +0000)]
[ELF] Convert RelocationSection to input section

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

llvm-svn: 287092

7 years ago[clang-tidy] Handle template instantiations in modenize-use-default check
Malcolm Parsons [Wed, 16 Nov 2016 09:51:40 +0000 (09:51 +0000)]
[clang-tidy] Handle template instantiations in modenize-use-default check

Summary:
Duplicate fixes were being created for explicit template instantiations
of out-of-line constructors or destructors.

Fixes PR30921.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 287091

7 years ago[ELF] Add Section() to expression object
Eugene Leviant [Wed, 16 Nov 2016 09:49:39 +0000 (09:49 +0000)]
[ELF] Add Section() to expression object

This allows making symbols containing ADDR(section) synthetic,
and defining synthetic symbols outside SECTIONS block.

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

llvm-svn: 287090

7 years ago[XRay][compiler-rt] Attempt to fix ARM buildbots after r287068
Diana Picus [Wed, 16 Nov 2016 09:32:23 +0000 (09:32 +0000)]
[XRay][compiler-rt] Attempt to fix ARM buildbots after r287068

Include xray_defs.h in xray_arm.cc (seems to be the only one that doesn't
include it).

Buildbot errors:
[...]/compiler-rt/lib/xray/xray_arm.cc:31:58: error: expected initializer before 'XRAY_NEVER_INSTRUMENT'
 inline static uint32_t getMovwMask(const uint32_t Value) XRAY_NEVER_INSTRUMENT {

llvm-svn: 287089

7 years ago[X86][AVX512] Replace lossless i32/u32 to f64 conversion intrinsics with generic IR
Simon Pilgrim [Wed, 16 Nov 2016 09:27:40 +0000 (09:27 +0000)]
[X86][AVX512] Replace lossless i32/u32 to f64 conversion intrinsics with generic IR

Both the (V)CVTDQ2PD (i32 to f64) and (V)CVTUDQ2PD (u32 to f64) conversion instructions are lossless and can be safely represented as generic __builtin_convertvector calls instead of x86 intrinsics without affecting final codegen.

This patch removes the clang builtins and their use in the headers - a future patch will deal with removing the llvm intrinsics.

This is an extension patch to D20528 which dealt with the equivalent sse/avx cases.

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

llvm-svn: 287088

7 years ago[X86][AVX512] Removing llvm x86 intrinsics for _mm_mask_move_{ss|sd} intrinsics.
Ayman Musa [Wed, 16 Nov 2016 09:00:28 +0000 (09:00 +0000)]
[X86][AVX512] Removing llvm x86 intrinsics for _mm_mask_move_{ss|sd} intrinsics.

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

llvm-svn: 287087

7 years ago[ELF] - Better diagnostic for "can't create dynamic relocation" error.
George Rimar [Wed, 16 Nov 2016 08:34:19 +0000 (08:34 +0000)]
[ELF] - Better diagnostic for "can't create dynamic relocation" error.

Patch improves message to show locations for
"can't create dynamic relocation" error.

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

llvm-svn: 287086

7 years agoImprove handling of __FUNCTION__ and other predefined expression for Objective-C...
Mehdi Amini [Wed, 16 Nov 2016 07:07:28 +0000 (07:07 +0000)]
Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks

Instead of always displaying the mangled name, try to do better
and get something closer to regular functions.

Recommit r287039 (that was reverted in r287039) with a tweak to
be more generic, and test fixes!

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

llvm-svn: 287085

7 years ago[Driver] Infer the correct option to ld64 for -fembed-bitcode
Steven Wu [Wed, 16 Nov 2016 06:06:44 +0000 (06:06 +0000)]
[Driver] Infer the correct option to ld64 for -fembed-bitcode

Summary:
-fembed-bitcode infers -bitcode_bundle to ld64 but it is not correctly
passed when using LTO. LTO is a special case of -fembed-bitcode which
it doesn't require embed the bitcode in a special section in the object
file but it requires linker to save that as part of the final executable.

rdar://problem/29274226

Reviewers: mehdi_amini

Subscribers: cfe-commits

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

llvm-svn: 287084

7 years ago[X86] Remove the scalar intrinsics for fadd/fsub/fdiv/fmul
Craig Topper [Wed, 16 Nov 2016 05:24:10 +0000 (05:24 +0000)]
[X86] Remove the scalar intrinsics for fadd/fsub/fdiv/fmul

Summary: These intrinsics have been unused for clang for a while. This patch removes them. We auto upgrade them to extractelements, a scalar operation and then an insertelement. This matches the sequence used by clangs intrinsic file.

Reviewers: zvi, delena, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 287083

7 years ago[ELF] Update lld now that ELF.h in LLVM has been converted to Expected.
Davide Italiano [Wed, 16 Nov 2016 05:11:30 +0000 (05:11 +0000)]
[ELF] Update lld now that ELF.h in LLVM has been converted to Expected.

llvm-svn: 287082

7 years ago[ELF] Convert ELF.h to Expected<T>.
Davide Italiano [Wed, 16 Nov 2016 05:10:28 +0000 (05:10 +0000)]
[ELF] Convert ELF.h to Expected<T>.

This has two advantages:
1) We slowly move away from ErrorOr to the new handling interface,
in the hope of having an uniform error handling in LLVM, eventually.
2) We're starting to have *meaningful* error messages for invalid
object ELF files, rather than a generic "parse error". At some point
we should include also the offset to improve the quality of the
diagnostic.

llvm-svn: 287081

7 years agoFix non-reserved name usage
Eric Fiselier [Wed, 16 Nov 2016 04:45:32 +0000 (04:45 +0000)]
Fix non-reserved name usage

llvm-svn: 287080