platform/upstream/llvm.git
7 years agoCodeGen: simplify TargetMachine::getSymbol interface. NFC.
Tim Northover [Tue, 22 Nov 2016 16:17:20 +0000 (16:17 +0000)]
CodeGen: simplify TargetMachine::getSymbol interface. NFC.

No-one actually had a mangler handy when calling this function, and
getSymbol itself went most of the way towards getting its own mangler
(with a local TLOF variable) so forcing all callers to supply one was
just extra complication.

llvm-svn: 287645

7 years ago[X86] Change lowerBuildVectorToBitOp() to take a BuildVectorSDNode. NFC.
Zvi Rackover [Tue, 22 Nov 2016 15:33:28 +0000 (15:33 +0000)]
[X86] Change lowerBuildVectorToBitOp() to take a BuildVectorSDNode. NFC.

llvm-svn: 287644

7 years ago[X86] Remove dead code from LowerVectorBroadcast
Zvi Rackover [Tue, 22 Nov 2016 15:17:52 +0000 (15:17 +0000)]
[X86] Remove dead code from LowerVectorBroadcast

Summary: Splat vectors are canonicalized to BUILD_VECTOR's so the code can be simplified. NFC-ish.

Reviewers: craig.topper, delena, RKSimon, andreadb

Subscribers: RKSimon, llvm-commits

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

llvm-svn: 287643

7 years ago[AArch64] Set the max interleave factor for Falkor.
Chad Rosier [Tue, 22 Nov 2016 14:25:02 +0000 (14:25 +0000)]
[AArch64] Set the max interleave factor for Falkor.

llvm-svn: 287642

7 years ago[AArch64] Maximize 80-column. NFC.
Chad Rosier [Tue, 22 Nov 2016 14:12:09 +0000 (14:12 +0000)]
[AArch64] Maximize 80-column. NFC.

llvm-svn: 287640

7 years agoMake llvm::Error generated from replacement interfaces more specific.
Eric Liu [Tue, 22 Nov 2016 13:46:42 +0000 (13:46 +0000)]
Make llvm::Error generated from replacement interfaces more specific.

Summary:
The new error information contains the type of error (e.g. overlap or bad file path)
and the replacement(s) that is causing the error. This enables us to resolve some errors.
For example, for insertion at the same location conflict, we need to know the
existing replacement which conflicts with the new replacement in order to calculate
the new position to be insert before/after the existing replacement (for merging).

Reviewers: klimek, bkramer

Subscribers: djasper, cfe-commits

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

llvm-svn: 287639

7 years agoFix line endings
Simon Pilgrim [Tue, 22 Nov 2016 13:27:29 +0000 (13:27 +0000)]
Fix line endings

llvm-svn: 287638

7 years ago[wasm] hack around test failure after r287553.
Benjamin Kramer [Tue, 22 Nov 2016 13:13:33 +0000 (13:13 +0000)]
[wasm] hack around test failure after r287553.

This test is very brittle as small changes to block layout break the
check patterns. Hack around a change one more time.

llvm-svn: 287637

7 years agoImprove detection of global vs local variables
Sam McCall [Tue, 22 Nov 2016 11:40:25 +0000 (11:40 +0000)]
Improve detection of global vs local variables

Summary:
Improve detection of global vs local variables.

Currently when a global variable is optimized out or otherwise has an unknown
location (DW_AT_location is empty) it gets reported as local.

I added two new heuristics:
 - if a mangled name is present, the variable is global (or static)
 - if DW_AT_location is present but invalid, the variable is global (or static)

Subscribers: lldb-commits

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

llvm-svn: 287636

7 years ago[SelectionDAG] ComputeNumSignBits of TRUNCATE operations
Simon Pilgrim [Tue, 22 Nov 2016 11:29:19 +0000 (11:29 +0000)]
[SelectionDAG] ComputeNumSignBits of TRUNCATE operations

Add basic ComputeNumSignBits support for TRUNCATE ops for cases where the source's number of sign bits overlaps with the truncated size.

Improves X86 SIGN_EXTEND_IN_REG vector cases which were needlessly sign extending boolean vector results.

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

llvm-svn: 287635

7 years agotsan: fix build after 287632
Dmitry Vyukov [Tue, 22 Nov 2016 11:09:35 +0000 (11:09 +0000)]
tsan: fix build after 287632

1. Mac does not have MAP_32BIT.
Define it to 0 if it is not defined.

2. We are lacking nolibc stub for ListOfModules::init.
Add it.

llvm-svn: 287634

7 years agoMissing initializer.
Axel Naumann [Tue, 22 Nov 2016 10:00:23 +0000 (10:00 +0000)]
Missing initializer.

llvm-svn: 287633

7 years agotsan: switch libignore from /proc/self/maps to dl_iterate_phdr
Dmitry Vyukov [Tue, 22 Nov 2016 09:49:11 +0000 (09:49 +0000)]
tsan: switch libignore from /proc/self/maps to dl_iterate_phdr

/proc/self/maps can't be read atomically, this leads to episodic
crashes in libignore as it thinks that a module is loaded twice.
See the new test for an example.
dl_iterate_phdr does not have this problem.
Switch libignore to dl_iterate_phdr.

llvm-svn: 287632

7 years agoFix build failure on Linux and BSD by reverting r287597
Omair Javaid [Tue, 22 Nov 2016 09:47:00 +0000 (09:47 +0000)]
Fix build failure on Linux and BSD by reverting r287597

Linux and BSD builds failing after this changes from rev 287597.

llvm-svn: 287631

7 years ago[AVX512][inline-asm] Fix AVX512 inline assembly instruction resolution when the size...
Coby Tayree [Tue, 22 Nov 2016 09:30:29 +0000 (09:30 +0000)]
[AVX512][inline-asm] Fix AVX512 inline assembly instruction resolution when the size qualifier of a memory operand is not specified explicitly.

This commit handles cases where the size qualifier of an indirect memory reference operand in Intel syntax is missing (e.g. "vaddps xmm1, xmm2, [a]").

GCC will deduce the size qualifier for AVX512 vector and broadcast memory operands based on the possible matches:
"vaddps xmm1, xmm2, [a]" matches only “XMMWORD PTR” qualifier.
"vaddps xmm1, xmm2, [a]{1to4}" matches only “DWORD PTR” qualifier.

This is different from the current behavior of LLVM, which deduces the size qualifier based on the size of the memory operand.
For "vaddps xmm1, xmm2, [a]"
"char a;" will imply "BYTE PTR" qualifier
"short a;" will imply "WORD PTR" qualifier.

This commit aligns LLVM to GCC’s behavior.

This is the LLVM part of the review.
The Clang part of the review: https://reviews.llvm.org/D26587

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

llvm-svn: 287630

7 years agotsan: mark cur_thread_placeholder definition as initial-exec
Dmitry Vyukov [Tue, 22 Nov 2016 08:59:17 +0000 (08:59 +0000)]
tsan: mark cur_thread_placeholder definition as initial-exec

See https://sourceware.org/bugzilla/show_bug.cgi?id=20805 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78294 for context.
Previously we marked only declaration as initial-exec. But compilers treat
initial-exec attribute somewhat differently. Mark definition as well.

llvm-svn: 287629

7 years agoRename option to -lto-pass-remarks-output
Adam Nemet [Tue, 22 Nov 2016 07:35:19 +0000 (07:35 +0000)]
Rename option to -lto-pass-remarks-output

The new option -pass-remarks-output broke LLVM_LINK_LLVM_DYLIB because
of the duplicate option name with opt.

llvm-svn: 287628

7 years agoRename option to -lto-pass-remarks-output
Adam Nemet [Tue, 22 Nov 2016 07:35:14 +0000 (07:35 +0000)]
Rename option to -lto-pass-remarks-output

The new option -pass-remarks-output broke LLVM_LINK_LLVM_DYLIB because
of the duplicate option name with opt.

llvm-svn: 287627

7 years ago[test] Simplify test case by removing unreferenced instructions [NFC]
Tobias Grosser [Tue, 22 Nov 2016 07:18:57 +0000 (07:18 +0000)]
[test] Simplify test case by removing unreferenced instructions [NFC]

Drop instructions that do not influence the memory impact of a basic block.
They are not needed to reproduce the original bug (verified) and will cause
random test noise if we would decide to only model the instructions that
have visible side-effects.

llvm-svn: 287626

7 years ago[test] Ensure important basic blocks in test case have side effects
Tobias Grosser [Tue, 22 Nov 2016 07:06:59 +0000 (07:06 +0000)]
[test] Ensure important basic blocks in test case have side effects

Add two store instructions at the end of basic blocks that are required to
reproduce the original bug to ensure we always process and model these basic
blocks. This makes this test case stable even in case we would decide to bail
out early of basic blocks which do not modify the global state. Also add
additional check lines to verify how we model the basic block.

llvm-svn: 287625

7 years ago[TableGen][ISel] When factoring ScopeMatcher, if the child of the ScopeMatcher we...
Craig Topper [Tue, 22 Nov 2016 07:00:06 +0000 (07:00 +0000)]
[TableGen][ISel] When factoring ScopeMatcher, if the child of the ScopeMatcher we're working on is also a ScopeMatcher, merge all its children into the one we're working on.

There were several cases in X86 where we were unable to fully factor a ScopeMatcher but created nested ScopeMatchers for some portions of it. Then we created a SwitchType that split it up and further factored it so that we ended up with something like this:

SwitchType
  Scope
    Scope
      Sequence of matchers
      Some other sequence of matchers
    EndScope
    Another sequence of matchers
  EndScope
...Next type

This change turns it into this:

SwitchType
  Scope
    Sequence of matchers
    Some other sequence of matchers
    Another sequence of matchers
  EndScope
...Next type

Several other in-tree targets had similar nested scopes like this. Overall this doesn't save many bytes, but makes the isel output a little more regular.

llvm-svn: 287624

7 years agotest: add more details to non-affine test case
Tobias Grosser [Tue, 22 Nov 2016 06:28:08 +0000 (06:28 +0000)]
test: add more details to non-affine test case

We add CHECK lines to this test case to make it easier to see the difference
between affine and non-affine memory accesses. We also change the test case to
use a parameteric index expression as otherwise our range analysis will
understand that the non-affine memory access can only access input[1],
which makes it difficult to see that the memory access is in-fact modeled as
non-affine access.

llvm-svn: 287623

7 years ago[X86] Remove alternate CodeGenOnly version of (v)movq that declared the load size...
Craig Topper [Tue, 22 Nov 2016 05:31:43 +0000 (05:31 +0000)]
[X86] Remove alternate CodeGenOnly version of (v)movq that declared the load size as i128mem. Change all uses to the use the i64mem version.

I'm sure this caused the load size to misprint in Intel syntax output. We were also inconsistent about which patterns used which instruction between VEX and EVEX.

There are two different reg/reg versions of movq, one from a GPR and one from the lower 64-bits of an XMM register. This changes the loading folding table to use the single i64mem memory form for folding both cases. But we need to use TB_NO_REVERSE to prevent a duplicate entry in the unfolding table.

llvm-svn: 287622

7 years ago[AVX-512] Add support for commuting VPERMT2(B/W/D/Q/PS/PD) to/from VPERMI2(B/W/D...
Craig Topper [Tue, 22 Nov 2016 04:57:34 +0000 (04:57 +0000)]
[AVX-512] Add support for commuting VPERMT2(B/W/D/Q/PS/PD) to/from VPERMI2(B/W/D/Q/PS/PD).

Summary:
The index and one of the table operands can be swapped by changing the opcode to the other version. Neither of these operands are the one that can load from memory so this can't be used to increase memory folding opportunities.

We need to handle the unmasked forms and the kz forms. Since the load operand isn't being commuted we can commute the load and broadcast instructions too.

Reviewers: igorb, delena, Ayal, Farhana, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 287621

7 years agoInline small function. NFC.
Rui Ueyama [Tue, 22 Nov 2016 04:33:01 +0000 (04:33 +0000)]
Inline small function. NFC.

llvm-svn: 287620

7 years agoMC: ensure that we have a section before accessing it
Saleem Abdulrasool [Tue, 22 Nov 2016 04:32:54 +0000 (04:32 +0000)]
MC: ensure that we have a section before accessing it

We would attempt to access the symbol section without ensuring that the symbol
was not absolute.  When the assembler referenced relocation is not evaluated to
the absolute, but when we record the relocation, we would query the section.
Because the symbol is absolute, it does not have a section associated with it,
triggering an assertion.  Just be more careful about the access of the section.

Addresses PR31064!

llvm-svn: 287619

7 years ago[analyzer] Fix a crash on accessing a field within a literal-initialized union.
Artem Dergachev [Tue, 22 Nov 2016 04:29:23 +0000 (04:29 +0000)]
[analyzer] Fix a crash on accessing a field within a literal-initialized union.

Because in case of unions we currently default-bind compound values in the
store, this quick fix avoids the crash for this case.

Patch by Ilya Palachev and independently by Alexander Shaposhnikov!

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

llvm-svn: 287618

7 years agoDo not save unused pointers to In<ELFT>.
Rui Ueyama [Tue, 22 Nov 2016 04:28:39 +0000 (04:28 +0000)]
Do not save unused pointers to In<ELFT>.

llvm-svn: 287617

7 years agoRemove default definition no one uses.
Rui Ueyama [Tue, 22 Nov 2016 04:17:12 +0000 (04:17 +0000)]
Remove default definition no one uses.

llvm-svn: 287616

7 years agoConvert MipsOptionsSection to SyntheticSection.
Rui Ueyama [Tue, 22 Nov 2016 04:13:09 +0000 (04:13 +0000)]
Convert MipsOptionsSection to SyntheticSection.

llvm-svn: 287615

7 years agoConvert MipsReginfoSection to SyntheticSection.
Rui Ueyama [Tue, 22 Nov 2016 03:57:08 +0000 (03:57 +0000)]
Convert MipsReginfoSection to SyntheticSection.

llvm-svn: 287614

7 years agoConvert MipsAbiFlagsSection to SyntheticSection.
Rui Ueyama [Tue, 22 Nov 2016 03:57:06 +0000 (03:57 +0000)]
Convert MipsAbiFlagsSection to SyntheticSection.

llvm-svn: 287613

7 years ago[AVX-512] Add support for changing the element size of PALIGNR/VALIGND/VALIGNQ shuffl...
Craig Topper [Tue, 22 Nov 2016 03:51:53 +0000 (03:51 +0000)]
[AVX-512] Add support for changing the element size of PALIGNR/VALIGND/VALIGNQ shuffles if they feed a vselect with a different type

Summary:
Shuffle lowering widens the element size of a shuffle if elements are contiguous. This is sometimes help because wider element types have more shuffle options. If the shuffle is one of the arguments to a vselect this shuffle widening can introduce a bitcast between the vselect and the shuffle. This will prevent isel from selecting a masked operation. If the shuffle can be written equally efficiently with a different element size to match the vselect type we should change the shuffle type to allow masking.

This patch does this conversion for all VALIGND/VALIGNQ sizes. It also supports turning 128-bit PALIGNR into VALIGND/VALIGNQ. This fixes the case shown in PR31018.

I plan to add support for more operations in future patches.

Reviewers: RKSimon, zvi, delena

Subscribers: llvm-commits

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

llvm-svn: 287612

7 years agoObject: Make SymbolicFile::symbol_{begin,end}() virtual and remove unnecessary wrappers.
Peter Collingbourne [Tue, 22 Nov 2016 03:38:40 +0000 (03:38 +0000)]
Object: Make SymbolicFile::symbol_{begin,end}() virtual and remove unnecessary wrappers.

llvm-svn: 287611

7 years ago[ADT] Add initializer list support to SmallPtrSet so that sets can be
Chandler Carruth [Tue, 22 Nov 2016 03:27:43 +0000 (03:27 +0000)]
[ADT] Add initializer list support to SmallPtrSet so that sets can be
easily initialized with some initial values.

llvm-svn: 287610

7 years agoTurn on LLDB_EDITLINE_USE_WCHAR on FreeBSD
Ed Maste [Tue, 22 Nov 2016 02:25:41 +0000 (02:25 +0000)]
Turn on LLDB_EDITLINE_USE_WCHAR on FreeBSD

llvm-svn: 287609

7 years ago[AMDGPU] Fix multiple vreg definitions in si-lower-control-flow
Stanislav Mekhanoshin [Tue, 22 Nov 2016 01:42:34 +0000 (01:42 +0000)]
[AMDGPU] Fix multiple vreg definitions in si-lower-control-flow

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

llvm-svn: 287608

7 years agoRemove redundant assignment.
Rui Ueyama [Tue, 22 Nov 2016 01:36:19 +0000 (01:36 +0000)]
Remove redundant assignment.

llvm-svn: 287607

7 years agoConvert BuildId a derived class of SyntheticSection.
Rui Ueyama [Tue, 22 Nov 2016 01:31:32 +0000 (01:31 +0000)]
Convert BuildId a derived class of SyntheticSection.

Some synthetic sections are not derived calsses of SyntehticSection.
They are derived directly from InputSection. For consistencly, we should
use SyntheticSection.

llvm-svn: 287606

7 years agoRemove a parameter from getOutputLoc and rename for readability. NFC.
Rui Ueyama [Tue, 22 Nov 2016 01:10:34 +0000 (01:10 +0000)]
Remove a parameter from getOutputLoc and rename for readability. NFC.

llvm-svn: 287605

7 years agoAnalysis: gep inbounds (gep inbounds (...)) is inbounds.
Peter Collingbourne [Tue, 22 Nov 2016 01:03:40 +0000 (01:03 +0000)]
Analysis: gep inbounds (gep inbounds (...)) is inbounds.

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

llvm-svn: 287604

7 years agoMerge BuildId subclasses.
Rui Ueyama [Tue, 22 Nov 2016 00:54:15 +0000 (00:54 +0000)]
Merge BuildId subclasses.

We had five different BuildId subclasses for five different types
of build-ids. They can simply be merged to a single class.

llvm-svn: 287603

7 years agoFix -Asserts build, and add some more test cases.
Peter Collingbourne [Tue, 22 Nov 2016 00:43:30 +0000 (00:43 +0000)]
Fix -Asserts build, and add some more test cases.

llvm-svn: 287602

7 years agoSema, CodeGen: Ensure that an implicit copy ctor is available more often under the...
Peter Collingbourne [Tue, 22 Nov 2016 00:21:43 +0000 (00:21 +0000)]
Sema, CodeGen: Ensure that an implicit copy ctor is available more often under the Microsoft C++ ABI.

This is needed because whether the constructor is deleted can control whether
we pass structs by value directly.

To fix this properly we probably want a more direct way for CodeGen to ask
whether the constructor was deleted.

Fixes PR31049.

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

llvm-svn: 287600

7 years agoIndicate in AST dump whether special member functions are defaulted and trivial.
Richard Smith [Mon, 21 Nov 2016 23:43:54 +0000 (23:43 +0000)]
Indicate in AST dump whether special member functions are defaulted and trivial.

llvm-svn: 287599

7 years agoFix a bug caught by adding LLVM_NODISCARD to StringRef.
Zachary Turner [Mon, 21 Nov 2016 23:18:13 +0000 (23:18 +0000)]
Fix a bug caught by adding LLVM_NODISCARD to StringRef.

llvm-svn: 287598

7 years agoAdd the new Args / entry-access API.
Zachary Turner [Mon, 21 Nov 2016 23:18:07 +0000 (23:18 +0000)]
Add the new Args / entry-access API.

The long-term goal here is to get rid of the functions
GetArgumentAtIndex() and GetQuoteCharAtIndex(), instead
replacing them with operator based access and range-based for
enumeration.  There are a lot of callsites, though, so the
changes will be done incrementally, starting with this one.

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

llvm-svn: 287597

7 years agoRemove LLVM_NODISCARD in one more place.
Zachary Turner [Mon, 21 Nov 2016 23:17:15 +0000 (23:17 +0000)]
Remove LLVM_NODISCARD in one more place.

llvm-svn: 287596

7 years agoRemove useless newlines.
Rui Ueyama [Mon, 21 Nov 2016 23:17:09 +0000 (23:17 +0000)]
Remove useless newlines.

llvm-svn: 287595

7 years agoRemove LLVM_NODISCARD from two more StringRef members.
Zachary Turner [Mon, 21 Nov 2016 23:02:28 +0000 (23:02 +0000)]
Remove LLVM_NODISCARD from two more StringRef members.

This should be everything.

llvm-svn: 287594

7 years agoDAG: Ignore call site attributes when emitting target intrinsic
Matt Arsenault [Mon, 21 Nov 2016 22:56:42 +0000 (22:56 +0000)]
DAG: Ignore call site attributes when emitting target intrinsic

A target intrinsic may be defined as possibly reading memory,
but the call site may have additional knowledge that it doesn't read
memory. The intrinsic lowering will expect the pessimistic
assumption of the intrinsic definition, so the chain should
still be used.

llvm-svn: 287593

7 years ago[AArch64LoadStoreOptimizer] Don't treat write to XZR/WZR as a clobber.
Geoff Berry [Mon, 21 Nov 2016 22:51:10 +0000 (22:51 +0000)]
[AArch64LoadStoreOptimizer] Don't treat write to XZR/WZR as a clobber.

Summary:
When searching for load/store instructions to pair/merge don't treat
writes to WZR/XZR as clobbers since they don't change the value read
from WZR/XZR (which is always 0).

Reviewers: mcrosier, junbuml, jmolloy, t.p.northover

Subscribers: aemerson, llvm-commits, rengolin

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

llvm-svn: 287592

7 years ago[CodeGenPrepare] Don't sink non-cheap addrspacecasts.
Justin Lebar [Mon, 21 Nov 2016 22:49:15 +0000 (22:49 +0000)]
[CodeGenPrepare] Don't sink non-cheap addrspacecasts.

Summary:
Previously, CGP would unconditionally sink addrspacecast instructions,
even going so far as to sink them into a loop.

Now we check that the cast is "cheap", as defined by TLI.

We introduce a new "is-cheap" function to TLI rather than using
isNopAddrSpaceCast because some GPU platforms want the ability to ask
for non-nop casts to be sunk.

Reviewers: arsenm, tra

Subscribers: jholewinski, wdng, llvm-commits

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

llvm-svn: 287591

7 years ago[CodeGenPrepare] Rewrite a loop in terms of llvm::none_of. NFC.
Justin Lebar [Mon, 21 Nov 2016 22:49:11 +0000 (22:49 +0000)]
[CodeGenPrepare] Rewrite a loop in terms of llvm::none_of.  NFC.

Reviewers: arsenm

Subscribers: wdng, llvm-commits

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

llvm-svn: 287590

7 years agoRemove LLVM_NODISCARD from getAsInteger().
Zachary Turner [Mon, 21 Nov 2016 22:47:23 +0000 (22:47 +0000)]
Remove LLVM_NODISCARD from getAsInteger().

llvm-svn: 287589

7 years ago[LoopReroll] Make root-finding more aggressive.
Eli Friedman [Mon, 21 Nov 2016 22:35:34 +0000 (22:35 +0000)]
[LoopReroll] Make root-finding more aggressive.

Allow using an instruction other than a mul or phi as the base for
root-finding. For example, the included testcase includes a loop
which requires using a getelementptr as the base for root-finding.

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

llvm-svn: 287588

7 years agoFix attribute list syntax.
Zachary Turner [Mon, 21 Nov 2016 22:29:38 +0000 (22:29 +0000)]
Fix attribute list syntax.

llvm-svn: 287587

7 years agoRemove LLVM_NODISCARD from StringRef.
Zachary Turner [Mon, 21 Nov 2016 22:19:25 +0000 (22:19 +0000)]
Remove LLVM_NODISCARD from StringRef.

This is a bit too aggressive of a warning, as it is forces
ANY function which returns a StringRef to have its return
value checked.  While useful on classes like llvm::Error which
are designed to require checking, this is not the case for
StringRef, and it is perfectly reasonable to have a function
return a StringRef for which the return value is not checked.

Move LLVM_NODISCARD to each of the individual member functions
where it makes sense instead.

llvm-svn: 287586

7 years ago[InstCombine] canonicalize min/max constant to select's false value
Sanjay Patel [Mon, 21 Nov 2016 22:04:14 +0000 (22:04 +0000)]
[InstCombine] canonicalize min/max constant to select's false value

This is a first step towards canonicalization and improved folding/codegen
for integer min/max as discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html

Here, we're just matching the simplest min/max patterns and adjusting the
icmp predicate while swapping the select operands.

I've included FIXME tests in test/Transforms/InstCombine/select_meta.ll
so it's easier to see how this might be extended (corresponds to the TODO
comment in the code). That's also why I'm using matchSelectPattern()
rather than a simpler check; once the backend is patched, we can just
remove some of the restrictions to allow the obfuscated min/max patterns
in the FIXME tests to be matched.

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

llvm-svn: 287585

7 years agoLSR debug fix.
Evgeny Stupachenko [Mon, 21 Nov 2016 21:55:03 +0000 (21:55 +0000)]
LSR debug fix.

Summary:
Dump instruction instead of address.
Reviewers: hfinkel

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

From: Evgeny Stupachenko <evstupac@gmail.com>
llvm-svn: 287584

7 years agoreassociate-deadinst.ll: avoid accidental match on path
Hubert Tong [Mon, 21 Nov 2016 21:53:01 +0000 (21:53 +0000)]
reassociate-deadinst.ll: avoid accidental match on path

Pipe from stdin to avoid accidentally matching on the path.

llvm-svn: 287583

7 years agofix formatting; NFC
Sanjay Patel [Mon, 21 Nov 2016 21:48:36 +0000 (21:48 +0000)]
fix formatting; NFC

llvm-svn: 287582

7 years ago[asan] Specialize the initialization-bug.cc testcase for Darwin (it needs a deploymen...
Kuba Mracek [Mon, 21 Nov 2016 21:48:25 +0000 (21:48 +0000)]
[asan] Specialize the initialization-bug.cc testcase for Darwin (it needs a deployment target of 10.11+)

The ODR detection in initialization-bug.cc now works on Darwin (due to the recently enabled "live globals" on-by-default), but only if the deployment target is 10.11 or higher. Let's adjust the testcases.

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

llvm-svn: 287581

7 years agoAdd a test for vcall on a null ptr.
Ivan Krasin [Mon, 21 Nov 2016 21:23:56 +0000 (21:23 +0000)]
Add a test for vcall on a null ptr.

Summary:
Turns out that in the case of -fsanitize=null and a virtual call,
the type check was generated *after* reading from vtable, which
causes a non-interpretable segfault. The check has been moved up
in https://reviews.llvm.org/D26559 and this CL adds a test for this case.

Reviewers: pcc

Subscribers: cfe-commits, kubabrecka

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

llvm-svn: 287578

7 years ago[asan] Un-XFAIL Windows global dead stripping test cases
Reid Kleckner [Mon, 21 Nov 2016 20:40:56 +0000 (20:40 +0000)]
[asan] Un-XFAIL Windows global dead stripping test cases

Test update for r287576

llvm-svn: 287577

7 years ago[asan] Make ASan compatible with linker dead stripping on Windows
Reid Kleckner [Mon, 21 Nov 2016 20:40:37 +0000 (20:40 +0000)]
[asan] Make ASan compatible with linker dead stripping on Windows

Summary:
This is similar to what was done for Darwin in rL264645 /
http://reviews.llvm.org/D16737, but it uses COFF COMDATs to achive the
same result instead of relying on new custom linker features.

As on MachO, this creates one metadata global per instrumented global.
The metadata global is placed in the custom .ASAN$GL section, which the
ASan runtime will iterate over during initialization. There are no other
references to the metadata, so normal linker dead stripping would
discard it. However, the metadata is put in a COMDAT group with the
instrumented global, so that it will be discarded if and only if the
instrumented global is discarded.

I didn't update the ASan ABI version check since this doesn't affect
non-Windows platforms, and the WinASan ABI isn't really stable yet.

Implementing this for ELF will require extending LLVM IR and MC a bit so
that we can use non-COMDAT section groups.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits

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

llvm-svn: 287576

7 years ago[MemorySSA] Fix unit tests broken by D26704
Mandeep Singh Grang [Mon, 21 Nov 2016 20:39:08 +0000 (20:39 +0000)]
[MemorySSA] Fix unit tests broken by D26704

Summary:
D26704 fixed the non-determinism in codegen by sorting basic blocks before
iteration so as to have a defined iteration order. As a result we need to fix
the names (numbers) of the temporaries in the following unit tests:
  test/Transforms/Util/MemorySSA/multi-edges.ll
  test/Transforms/Util/MemorySSA/multiple-backedges-hal.ll

Reviewers: dberlin, david2050, mgrang

Subscribers: llvm-commits

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

llvm-svn: 287575

7 years ago[mips] Add tests for half precision floating point support.
Simon Dardis [Mon, 21 Nov 2016 20:34:10 +0000 (20:34 +0000)]
[mips] Add tests for half precision floating point support.

These should have been part of r287349.

llvm-svn: 287574

7 years ago[mips] seq macro support
Simon Dardis [Mon, 21 Nov 2016 20:30:41 +0000 (20:30 +0000)]
[mips] seq macro support

This patch adds the seq macro.

This partially resolves PR/30381.

Thanks to Sean Bruno for reporting the issue!

Reviewers: zoran.jovanovic, vkalintiris, seanbruno

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

llvm-svn: 287573

7 years agoUpdate comment for r287566
Hongbin Zheng [Mon, 21 Nov 2016 20:27:55 +0000 (20:27 +0000)]
Update comment for r287566

llvm-svn: 287572

7 years agoCheck proper live range in extendPHIRanges
Krzysztof Parzyszek [Mon, 21 Nov 2016 20:24:12 +0000 (20:24 +0000)]
Check proper live range in extendPHIRanges

The function extendPHIRanges checks the main range of the original live
interval, even when dealing with a subrange. This could also lead to an
assert when the subrange is not live at the extension point, but the
main range is. To avoid this, check the corresponding subrange of the
original live range, instead of always checking the main range.

Review (as a part of a bigger set of changes):
https://reviews.llvm.org/D26359

llvm-svn: 287571

7 years ago[TLI] Fix breakage introduced by D21739.
Marcin Koscielnicki [Mon, 21 Nov 2016 20:20:39 +0000 (20:20 +0000)]
[TLI] Fix breakage introduced by D21739.

The initialize function has an early return for AMDGPU targets.  If taken,
the ShouldExtI32* initialization code will not be executed, resulting in
invalid values in the corresponding fields.  Fix this by moving the code
to the top of the function.

llvm-svn: 287570

7 years agoUse the correct page size.
Rafael Espindola [Mon, 21 Nov 2016 20:20:04 +0000 (20:20 +0000)]
Use the correct page size.

Config->MaxPageSize is what we use for the segment alignment, so that
is the one that we have to use for placing the header.

llvm-svn: 287569

7 years agoFix format
Hongbin Zheng [Mon, 21 Nov 2016 20:17:00 +0000 (20:17 +0000)]
Fix format

llvm-svn: 287568

7 years ago[AsmPrinter] Enable codeview for windows-itanium
Shoaib Meenai [Mon, 21 Nov 2016 20:13:32 +0000 (20:13 +0000)]
[AsmPrinter] Enable codeview for windows-itanium

Enable codeview emission for windows-itanium targets. Co-opt an existing
test (which is derived from a C source file and should therefore be
identical across the Itanium and MS ABIs).

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

llvm-svn: 287567

7 years agoSplit ScopInfo::addScopStmt into two versions. NFC
Hongbin Zheng [Mon, 21 Nov 2016 20:09:40 +0000 (20:09 +0000)]
Split ScopInfo::addScopStmt into two versions. NFC

One for adding statement for region, another one for BB

llvm-svn: 287566

7 years agoFix address computation for headers.
Rafael Espindola [Mon, 21 Nov 2016 19:59:33 +0000 (19:59 +0000)]
Fix address computation for headers.

If the linker script has SECTIONS, the address computation is now
always done in LinkerScript::assignAddresses, like for any other
section.

Before fixHeaders would do a tentative computation that
assignAddresses would sometimes override.

This patch also splits the cases where assignAddresses needs to add
the headers to the first PT_LOAD and the address computation. The net
effect is that we no longer create an empty page for no reason in the
included test case, which matches bfd behavior.

llvm-svn: 287565

7 years agoMove a function definition to SyntheticSections.cpp.
Rui Ueyama [Mon, 21 Nov 2016 19:46:04 +0000 (19:46 +0000)]
Move a function definition to SyntheticSections.cpp.

This should have been moved along with r287554.

llvm-svn: 287564

7 years ago[MemorySSA] Fix for non-determinism in codegen
Mandeep Singh Grang [Mon, 21 Nov 2016 19:33:02 +0000 (19:33 +0000)]
[MemorySSA] Fix for non-determinism in codegen

This patch fixes the non-determinism caused due to iterating SmallPtrSet's
which was uncovered due to the experimental "reverse iteration order " patch:
https://reviews.llvm.org/D26718

The following unit tests failed because of the undefined order of iteration.
LLVM :: Transforms/Util/MemorySSA/cyclicphi.ll
LLVM :: Transforms/Util/MemorySSA/many-dom-backedge.ll
LLVM :: Transforms/Util/MemorySSA/many-doms.ll
LLVM :: Transforms/Util/MemorySSA/phi-translation.ll

Reviewers: dberlin, mgrang

Subscribers: dberlin, llvm-commits, david2050

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

llvm-svn: 287563

7 years agoMinor change
Hongbin Zheng [Mon, 21 Nov 2016 19:26:10 +0000 (19:26 +0000)]
Minor change

llvm-svn: 287562

7 years ago[VectorLegalizer] Remove EVT::getSizeInBits code duplications. NFCI.
Simon Pilgrim [Mon, 21 Nov 2016 18:24:44 +0000 (18:24 +0000)]
[VectorLegalizer] Remove EVT::getSizeInBits code duplications. NFCI.

We were calling SVT.getSizeInBits() several times in a row - just call it once and reuse the result.

llvm-svn: 287556

7 years agoDo plumbing work for CodeView debug info.
Rui Ueyama [Mon, 21 Nov 2016 17:22:35 +0000 (17:22 +0000)]
Do plumbing work for CodeView debug info.

Previously, we discarded .debug$ sections. This patch adds them to
files so that PDB.cpp can access them.

This patch also adds a debug option, /dumppdb, to dump debug info
fed to createPDB so that we can verify that valid data has been passed.

llvm-svn: 287555

7 years ago[ELF] Convert Version*** sections to input sections
Eugene Leviant [Mon, 21 Nov 2016 16:59:33 +0000 (16:59 +0000)]
[ELF] Convert Version*** sections to input sections

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

llvm-svn: 287554

7 years ago[CodeGenPrep] Skip merging empty case blocks
Jun Bum Lim [Mon, 21 Nov 2016 16:47:28 +0000 (16:47 +0000)]
[CodeGenPrep] Skip merging empty case blocks

Summary: Merging an empty case block into the header block of switch could cause
ISel to add COPY instructions in the header of switch, instead of the case
block, if the case block is used as an incoming block of a PHI. This could
potentially increase dynamic instructions, especially when the switch is in a
loop. I added a test case which was reduced from the benchmark I was targetting.

Reviewers: t.p.northover, mcrosier, manmanren, wmi, davidxl

Subscribers: qcolombet, danielcdh, hfinkel, mcrosier, llvm-commits

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

llvm-svn: 287553

7 years agoSet task->td_dephash to NULL after free
Jonathan Peyton [Mon, 21 Nov 2016 16:24:59 +0000 (16:24 +0000)]
Set task->td_dephash to NULL after free

llvm-svn: 287552

7 years agoFix for D25504 - segfault because of double free()-ing in shutdown code.
Jonathan Peyton [Mon, 21 Nov 2016 16:18:57 +0000 (16:18 +0000)]
Fix for D25504 - segfault because of double free()-ing in shutdown code.

Paul Osmialowski pointed out a double free bug in shutdown code.  This patch
Moves the freeing of the implicit task to above the freeing of all fast memory
to prevent the double-free issue.

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

llvm-svn: 287551

7 years agoclang-tidy: improve my test for readability-redundant-declaration
Daniel Marjamaki [Mon, 21 Nov 2016 16:08:17 +0000 (16:08 +0000)]
clang-tidy: improve my test for readability-redundant-declaration

llvm-svn: 287550

7 years ago[ELF] Convert EhFrameHeader to input section
Eugene Leviant [Mon, 21 Nov 2016 15:52:10 +0000 (15:52 +0000)]
[ELF] Convert EhFrameHeader to input section

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

llvm-svn: 287549

7 years agosmall fixup which enables the issuing of the aforementioned instruction (w/o operands...
Coby Tayree [Mon, 21 Nov 2016 15:50:56 +0000 (15:50 +0000)]
small fixup which enables the issuing of the aforementioned instruction (w/o operands), on MS/Intel syntax.

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

llvm-svn: 287548

7 years ago[ELF] Better error reporting for linker scripts
Eugene Leviant [Mon, 21 Nov 2016 15:49:56 +0000 (15:49 +0000)]
[ELF] Better error reporting for linker scripts

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

llvm-svn: 287547

7 years agoclang-tidy: Attempt to fix build bot failure with mismatching size_t platform type.
Daniel Marjamaki [Mon, 21 Nov 2016 15:46:40 +0000 (15:46 +0000)]
clang-tidy: Attempt to fix build bot failure with mismatching size_t platform type.

llvm-svn: 287546

7 years agoFix known zero bits for addrspacecast.
Yaxun Liu [Mon, 21 Nov 2016 15:42:31 +0000 (15:42 +0000)]
Fix known zero bits for addrspacecast.

Currently LLVM assumes that a pointer addrspacecasted to a different addr space is equivalent to trunc or zext bitwise, which is not true. For example, in amdgcn target, when a null pointer is addrspacecasted from addr space 4 to 0, its value is changed from i64 0 to i32 -1.

This patch teaches LLVM not to assume known bits of addrspacecast instruction to its operand.

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

llvm-svn: 287545

7 years ago[include-fixer plugin] Make the plugin emit proper fixits in case multiple errors...
Benjamin Kramer [Mon, 21 Nov 2016 15:28:50 +0000 (15:28 +0000)]
[include-fixer plugin] Make the plugin emit proper fixits in case multiple errors are found.

The standalone tool only fixes the first one and we managed to bake that
assumption into the code :(

Also fix a crash when no header is found at all.

llvm-svn: 287544

7 years ago[X86][SSE] Add SSE reciprocal estimate tests
Simon Pilgrim [Mon, 21 Nov 2016 15:28:21 +0000 (15:28 +0000)]
[X86][SSE] Add SSE reciprocal estimate tests

llvm-svn: 287543

7 years agoFix remote-linux regression due to stringRef changes
Omair Javaid [Mon, 21 Nov 2016 15:18:58 +0000 (15:18 +0000)]
Fix remote-linux regression due to stringRef changes

This is to fix a regression in remote-linux lldb-server connections.

We were wrongly passing a copy of uri and expecting a stringRef back.

llvm-svn: 287542

7 years ago[SelectionDAG] Add ComputeNumSignBits support for CONCAT_VECTORS opcode
Simon Pilgrim [Mon, 21 Nov 2016 14:36:19 +0000 (14:36 +0000)]
[SelectionDAG] Add ComputeNumSignBits support for CONCAT_VECTORS opcode

llvm-svn: 287541

7 years agoreadability-redundant-declaration: Fix crash
Daniel Marjamaki [Mon, 21 Nov 2016 14:29:53 +0000 (14:29 +0000)]
readability-redundant-declaration: Fix crash

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

llvm-svn: 287540

7 years ago[llvm-cov] Avoid 0% when reporting something that's 0/0
Alex Lorenz [Mon, 21 Nov 2016 14:00:04 +0000 (14:00 +0000)]
[llvm-cov] Avoid 0% when reporting something that's 0/0

This commit makes llvm-cov avoid showing 0% (0/0) coverage for things
like file function coverage, etc. in reports and HTML output. This can happen
for files like headers that have macros but no functions. This commit makes
llvm-cov report - (0/0) instead.

rdar://29246480

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

llvm-svn: 287539

7 years ago[ELF] Attempt to fix Windows buidbot
Eugene Leviant [Mon, 21 Nov 2016 13:57:50 +0000 (13:57 +0000)]
[ELF] Attempt to fix Windows buidbot

llvm-svn: 287538

7 years agoChange the way how we print out line numbers.
Rui Ueyama [Mon, 21 Nov 2016 13:49:57 +0000 (13:49 +0000)]
Change the way how we print out line numbers.

LLD's error messages contain line numbers, function names or section names.
Currently they are formatter as follows.

  foo.c (32): symbol 'foo' not found
  foo.c (function bar): symbol 'foo' not found
  foo.c (.text+0x1234): symbol 'foo' not found

This patch changes them so that they are consistent with Clang's output.

  foo.c:32: symbol 'foo' not found
  foo.c:(function bar): symbol 'foo' not found
  foo.c:(.text+0x1234): symbol 'foo' not found

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

llvm-svn: 287537