OSDN Git Service

android-x86/external-llvm.git
6 years ago[X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.
Craig Topper [Fri, 11 May 2018 04:33:18 +0000 (04:33 +0000)]
[X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332079 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-objcopy] Update remove-section.test
Alexander Shaposhnikov [Fri, 11 May 2018 04:30:57 +0000 (04:30 +0000)]
[llvm-objcopy] Update remove-section.test

Verify that the input binary is not getting modified
and add an invocation which uses -remove-section instead of -R.

Test plan: make check-all

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332078 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Coroutines] PR34897: Fix incorrect elisions
Brian Gesiak [Fri, 11 May 2018 03:12:28 +0000 (03:12 +0000)]
[Coroutines] PR34897: Fix incorrect elisions

Summary:
https://bugs.llvm.org/show_bug.cgi?id=34897 demonstrates an incorrect
coroutine frame allocation elision in the coro-elide pass. The elision
is performed on the basis that the SSA variables from all llvm.coro.begin
are directly referenced in subsequent llvm.coro.destroy instructions.

However, this ignores the fact that the function may exit through paths
that do not run these destroy instructions. In the sample program from
PR34897, for example, the llvm.coro.destroy instruction is only
executed in exception handling code. When the coroutine function exits
normally, llvm.coro.destroy is not called. Eliding the allocation in
this case causes a subsequent reference to the coroutine handle from
outside of the function to access freed memory.

To fix the issue, when finding an llvm.coro.destroy for each llvm.coro.begin,
only consider llvm.coro.destroy that are executed along non-exceptional paths.

Test Plan:
1. Download the sample program from
   https://bugs.llvm.org/show_bug.cgi?id=34897, compile it with
   `clang++ -fcoroutines-ts -stdlib=libc++ -std=c++1z -O2`, and run it.
   It should print `"run1\ncheck1\nrun2\ncheck2"` and then exit
   successfully.
2. Compile https://godbolt.org/g/mCKfnr and confirm it is still
   optimized to a single instruction, 'return 1190'.
3. `check-llvm`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: andrewrk, lewissbaker, EricWF, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332077 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Support] Add docs for 'openFileFor{Write,Read}'
Brian Gesiak [Fri, 11 May 2018 01:47:27 +0000 (01:47 +0000)]
[Support] Add docs for 'openFileFor{Write,Read}'

Summary:
Add documentation for the LLVM Support functions `openFileForWrite` and
`openFileForRead`. The `openFileForRead` parameter `RealPath`, in
particular, I think warranted some explanation.

In addition, make the behavior of the functions more consistent across
platforms. Prior to this patch, Windows would set or not set the result
file descriptor based on the nature of the error, whereas Unix would
consistently set it to `-1` if the open failed. Make Windows
consistently set it to `-1` as well.

Test Plan:
1. `ninja check-llvm`
2. `ninja docs-llvm-html`

Reviewers: zturner, rnk, danielmartin, scanon

Reviewed By: danielmartin, scanon

Subscribers: scanon, danielmartin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332075 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[sanitizer-coverage] don't instrument a function if it's entry block ends with 'unrea...
Kostya Serebryany [Fri, 11 May 2018 01:09:39 +0000 (01:09 +0000)]
[sanitizer-coverage] don't instrument a function if it's entry block ends with 'unreachable'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332072 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRegister NetBSD/i386 in AddressSanitizer.cpp
Kamil Rytarowski [Fri, 11 May 2018 00:58:01 +0000 (00:58 +0000)]
Register NetBSD/i386 in AddressSanitizer.cpp

Summary:
Ship kNetBSD_ShadowOffset32 set to 1ULL << 30.

This is prepared for the amd64 kernel runtime.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, joerg, kcc

Reviewed By: vitalybuka

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332069 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Add tests for cases where we don't recognize type promoted rotate idioms.
Craig Topper [Fri, 11 May 2018 00:46:09 +0000 (00:46 +0000)]
[InstCombine] Add tests for cases where we don't recognize type promoted rotate idioms.

These rotates take the form

(x << (n & mask)) | (x >> (-n & mask)) where mask is bitwidth - 1.

If x has been promoted to a wider type than its original bit width due to type promotion we fail to narrower it and therefore don't recognize it as a rotate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332068 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSupport Unsupported Tests in xunit output
Chris Matthews [Fri, 11 May 2018 00:25:43 +0000 (00:25 +0000)]
Support Unsupported Tests in xunit output

We were reporting  "Unsupported" tests in xunit as passes, however since
they are not run, it make more sense to mark them as skipped. The Junit
xml standard has support for that, so lets use it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332065 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRefactor xunit test case builder to not use as much str addition
Chris Matthews [Fri, 11 May 2018 00:25:42 +0000 (00:25 +0000)]
Refactor xunit test case builder to not use as much str addition

String concatenation in python is slow.  Refactor to not concatenate the
possibly large strings of test output and instead write them directly
to the output file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332064 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SampleFDO] Don't treat warm callsite with inline instance in the profile as cold
Wei Mi [Thu, 10 May 2018 23:02:27 +0000 (23:02 +0000)]
[SampleFDO] Don't treat warm callsite with inline instance in the profile as cold

We found current sampleFDO had a performance issue when triaging a regression.
For a callsite with inline instance in the profile, even if hot callsite inliner
cannot inline it, it may still execute enough times and should not be treated as
cold in regular inliner later. However, currently if such callsite is not inlined
by hot callsite inliner, and the BB where the callsite locates doesn't get
samples from other instructions inside of it, the callsite will have no profile
metadata annotated. In regular inliner cost analysis, if the callsite has no
profile annotated and its caller has profile information, it will be treated as
cold.

The fix changes the isCallsiteHot check and chooses to compare
CallsiteTotalSamples with hot cutoff value computed by ProfileSummaryInfo.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332058 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[STLExtras] Add distance() for ranges, pred_size(), and succ_size()
Vedant Kumar [Thu, 10 May 2018 23:01:54 +0000 (23:01 +0000)]
[STLExtras] Add distance() for ranges, pred_size(), and succ_size()

This commit adds a wrapper for std::distance() which works with ranges.
As it would be a common case to write `distance(predecessors(BB))`, this
also introduces `pred_size()` and `succ_size()` helpers to make that
easier to write.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332057 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LIT] Move xunit tests tests into their own location, and and add failures
Chris Matthews [Thu, 10 May 2018 22:51:28 +0000 (22:51 +0000)]
[LIT] Move xunit tests tests into their own location, and and add failures

Failures will increase coverage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332056 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Replace an 'if' that should always be true with an assert.
Craig Topper [Thu, 10 May 2018 22:45:28 +0000 (22:45 +0000)]
[InstCombine] Replace an 'if' that should always be true with an assert.

The bitwidth of the operation should always be wider than the result width of the truncate since we don't recurse through any width changing operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332055 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Initial Disassembler.
Sam Clegg [Thu, 10 May 2018 22:16:44 +0000 (22:16 +0000)]
[WebAssembly] Initial Disassembler.

This implements a new table-gen emitter to create tables for
a wasm disassembler, and a dissassembler to use them.

Comes with 2 tests, that tests a few instructions manually. Is also able to
disassemble large .wasm files with objdump reasonably.

Not working so well, to be addressed in followups:
- objdump appears to be passing an incorrect starting point.
- since the disassembler works an instruction at a time, and it is
  disassembling stack instruction, it has no idea of pseudo register assignments.
  These registers are required for the instruction printing code that follows.
  For now, all such registers appear in the output as $0.

Patch by Wouter van Oortmerssen

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332052 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add new patterns for masked scalar load/store to match clang's codegen from...
Craig Topper [Thu, 10 May 2018 21:49:16 +0000 (21:49 +0000)]
[X86] Add new patterns for masked scalar load/store to match clang's codegen from r331958.

Clang's codegen now uses 128-bit masked load/store intrinsics in IR. The backend will widen to 512-bits on AVX512F targets.

So this patch adds patterns to detect codegen's widening and patterns for AVX512VL that don't get widened.

We may be able to drop some of the old patterns, but I leave that for a future patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332049 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[InstCombine] snprintf optimizations"
Martin Storsjo [Thu, 10 May 2018 21:23:36 +0000 (21:23 +0000)]
Revert "[InstCombine] snprintf optimizations"

This reverts commit SVN r331889, which could trigger failed
assertions for cases where the snprintf function is declared
with a vaguely differing signature (e.g. being defined as
static inline), see PR37408.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332043 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/GlobalISel: Implement select() for G_BITCAST s32 <--> <2 x s16>
Tom Stellard [Thu, 10 May 2018 21:20:10 +0000 (21:20 +0000)]
AMDGPU/GlobalISel: Implement select() for G_BITCAST s32 <--> <2 x s16>

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332042 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LLVM-C] Consolidate llgo's DIBuilder Bindings
Robert Widmann [Thu, 10 May 2018 21:10:06 +0000 (21:10 +0000)]
[LLVM-C] Consolidate llgo's DIBuilder Bindings

Summary: Move and correct LLVMDIBuilderCreateTypedef.  This is the last API in DIBuilderBindings.h, so it is being removed and the C API will now be re-exported from IRBindings.h.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332041 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU/GlobalISel: Enable TableGen'd instruction selector
Tom Stellard [Thu, 10 May 2018 20:53:06 +0000 (20:53 +0000)]
AMDGPU/GlobalISel: Enable TableGen'd instruction selector

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, mgorny, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332039 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add folds for minnum(-a, -b) --> -maxnum(a, b)
Sanjay Patel [Thu, 10 May 2018 20:03:13 +0000 (20:03 +0000)]
[InstCombine] add folds for minnum(-a, -b) --> -maxnum(a, b)

This is similar to what we do for integer min/max with 'not'
ops (rL321882).

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=37404
https://bugs.llvm.org/show_bug.cgi?id=37405

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332031 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DWARF] Fixing a bug in DWARF v5 string offsets tables where the length encoded the...
Wolfgang Pieb [Thu, 10 May 2018 20:02:34 +0000 (20:02 +0000)]
[DWARF] Fixing a bug in DWARF v5 string offsets tables where the length encoded the contribution
length excluding the table header. Instead it must encode the contribution length minus the length
field itself.

Reviewer: JDevliegehere

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332030 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Moving overflow computation logic from InstCombine to ValueTracking...
Omer Paparo Bivas [Thu, 10 May 2018 19:46:19 +0000 (19:46 +0000)]
[InstCombine] Moving overflow computation logic from InstCombine to ValueTracking; NFC

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

Change-Id: Ifabcbe431a2169743b3cc310f2a34fd706f13f02

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332026 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] add minnum/maxnum tests (PR37404, PR37405); NFC
Sanjay Patel [Thu, 10 May 2018 19:21:08 +0000 (19:21 +0000)]
[InstCombine] add minnum/maxnum tests (PR37404, PR37405); NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332025 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Initialize HasPTWRITE member of X86Subtarget
Gabor Buella [Thu, 10 May 2018 19:15:10 +0000 (19:15 +0000)]
[X86] Initialize HasPTWRITE member of X86Subtarget

This was missing from r331961.
Caught by sanitizer bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332024 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Convert/Merge more instregex patterns to reduce InstrRW compile time.
Simon Pilgrim [Thu, 10 May 2018 19:08:06 +0000 (19:08 +0000)]
[X86] Convert/Merge more instregex patterns to reduce InstrRW compile time.

Use instrs lists or merge multiple instregex patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332022 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd regression test for r331976
George Burgess IV [Thu, 10 May 2018 18:37:54 +0000 (18:37 +0000)]
Add regression test for r331976

In general, it's difficult to poke the ConstantExpr code in CFLAA, since
LLVM is so great at eagerly reducing ConstantExprs. :)

Sadly, this only shows a functional difference from before the patch
because CFLAA has some special logic around taking loads of non-pointers
into account. Namely, with the broken select behavior, CFLAA will
completely fail to take note of @g3. Since CFLAA doesn't have any record
about @g3 when we do an alias query for @g3 and %a, it conservatively
answers MayAlias. When we properly take @g3 into account with the new
select logic, we get NoAlias for this query.

I suspect that the aforementioned "special logic" isn't completely
correct, but this test-case should prevent future wonky aliasing results
from appearing for these flavors of ConstantExprs, so I think it's still
worth having.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332017 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CGP] Split large data structres to sink more GEPs
Haicheng Wu [Thu, 10 May 2018 18:27:36 +0000 (18:27 +0000)]
[CGP] Split large data structres to sink more GEPs

Accessing the members of a large data structures needs a lot of GEPs which
usually have large offsets due to the size of the underlying data structure. If
the offsets are too large to fit into the r+i addressing mode, these GEPs cannot
be sunk to their users' blocks and many extra registers are needed then to carry
the values of these GEPs.

This patch tries to split a large data struct starting from %base like the
following.

Before:
BB0:
  %base     =

BB1:
  %gep0     = gep %base, off0
  %gep1     = gep %base, off1
  %gep2     = gep %base, off2

BB2:
  %load1    = load %gep0
  %load2    = load %gep1
  %load3    = load %gep2

After:
BB0:
  %base     =
  %new_base = gep %base, off0

BB1:
  %new_gep0 = %new_base
  %new_gep1 = gep %new_base, off1 - off0
  %new_gep2 = gep %new_base, off2 - off0

BB2:
  %load1    = load i32, i32* %new_gep0
  %load2    = load i32, i32* %new_gep1
  %load3    = load i32, i32* %new_gep2

In the above example, the struct is split into two parts. The first part still
starts from %base and the second part starts from %new_base. After the
splitting, %new_gep1 and %new_gep2 have smaller offsets and then can be sunk to
BB2 and folded into their users.

The algorithm to split data structure is simple and very similar to the work of
merging SExts. First, it collects GEPs that have large offsets when iterating
the blocks. Second, it splits the underlying data structures and updates the
collected GEPs to use smaller offsets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332015 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LLVM-C] Add Accessors for Common DIType and DILocation Properties
Robert Widmann [Thu, 10 May 2018 18:23:55 +0000 (18:23 +0000)]
[LLVM-C] Add Accessors for Common DIType and DILocation Properties

Summary:
- Adds getters for the line, column, and scope of a DILocation
- Adds getters for the name, size in bits, offset in bits, alignment in bits, line, and flags of a DIType

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332014 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LLVM-C] Move DIBuilder Bindings For Temporary MDNodes
Robert Widmann [Thu, 10 May 2018 18:09:53 +0000 (18:09 +0000)]
[LLVM-C] Move DIBuilder Bindings For Temporary MDNodes

Summary: Move LLVMTemporaryMDNode and LLVMMetadataReplaceAllUsesWith to the C bindings and add LLVMDeleteTemporaryMDNode for deleting non-RAUW'ed temporary nodes.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332010 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAsembly] Update default triple in test files to wasm32-unknown-unkown.
Sam Clegg [Thu, 10 May 2018 17:49:11 +0000 (17:49 +0000)]
[WebAsembly] Update default triple in test files to wasm32-unknown-unkown.

Summary: The final -wasm component has been the default for some time now.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332007 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][Znver1] Remove unnecessary SchedWritePMULLD InstRW overrides.
Simon Pilgrim [Thu, 10 May 2018 17:42:26 +0000 (17:42 +0000)]
[X86][Znver1] Remove unnecessary SchedWritePMULLD InstRW overrides.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332006 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Create section start symbols automatically for all sections
Sam Clegg [Thu, 10 May 2018 17:38:35 +0000 (17:38 +0000)]
[WebAssembly] Create section start symbols automatically for all sections

These symbols only get included in the output symbols table if
they are used in a relocation.

This behaviour matches more closely the ELF object writer.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332005 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM/LoopUnswitch] Avoid pointlessly creating an exit block set.
Chandler Carruth [Thu, 10 May 2018 17:33:20 +0000 (17:33 +0000)]
[PM/LoopUnswitch] Avoid pointlessly creating an exit block set.

This code can just test whether blocks are *in* the loop, which we
already have a dedicated set tracking in the loop itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332004 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][SNB] Fix typo in PEXTRDmr instregex, was missing VPEXTRDmr.
Simon Pilgrim [Thu, 10 May 2018 17:30:49 +0000 (17:30 +0000)]
[X86][SNB] Fix typo in PEXTRDmr instregex, was missing VPEXTRDmr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332002 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Split WriteVecALU/WriteVecLogic/WriteShuffle/WriteVarShuffle/WritePSADBW/WriteP...
Simon Pilgrim [Thu, 10 May 2018 17:06:09 +0000 (17:06 +0000)]
[X86] Split WriteVecALU/WriteVecLogic/WriteShuffle/WriteVarShuffle/WritePSADBW/WritePHAdd scheduler classes

Split off XMM classes from the default (MMX) classes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331999 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] regenerate full checks; NFC
Sanjay Patel [Thu, 10 May 2018 17:05:38 +0000 (17:05 +0000)]
[InstCombine] regenerate full checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331998 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Accept 32-bit offsets for ld/sd/lld commands
Simon Atanasyan [Thu, 10 May 2018 16:01:36 +0000 (16:01 +0000)]
[mips] Accept 32-bit offsets for ld/sd/lld commands

This is a follow up to the rL330983. The patch teaches ld, sd, and lld
commands accept 32-bit memory offsets by replacing `mem_simm16` operand
to `mem_simmptr`. In fact, these commands should accept 64-bit offsets,
but so large offsets require another command expanding and will be
supported by a separate patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331997 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Accept 32-bit offsets for lh and lhu commands
Simon Atanasyan [Thu, 10 May 2018 16:01:18 +0000 (16:01 +0000)]
[mips] Accept 32-bit offsets for lh and lhu commands

This is a follow up to the rL330983. The patch teaches lh and lhu
commands accepts 32-bit memory offsets by replacing `mem_simm16` operand
to `mem_simmptr`.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331996 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-objcopy] Add tests for help messages
Alexander Shaposhnikov [Thu, 10 May 2018 15:56:04 +0000 (15:56 +0000)]
[llvm-objcopy] Add tests for help messages

This diff slightly reorganizes the tests  and improves
the test coverage of help messages / error reports.

Test plan: make check-all

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331993 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] fix fmaxnum/fminnum with nnan
Sanjay Patel [Thu, 10 May 2018 15:40:49 +0000 (15:40 +0000)]
[x86] fix fmaxnum/fminnum with nnan

With nnan, there's no need for the masked merge / blend
sequence (that probably costs much more than the min/max
instruction).

Somewhere between clang 5.0 and 6.0, we started producing
these intrinsics for fmax()/fmin() in C source instead of
libcalls or fcmp/select. The backend wasn't prepared for
that, so we regressed perf in those cases.

Note: it's possible that other targets have similar problems
as seen here.

Noticed while investigating PR37403 and related bugs:
https://bugs.llvm.org/show_bug.cgi?id=37403

The IR FMF propagation cases still don't work. There's
a proposal that might fix those cases in D46563.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331992 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DSE] Teach the pass about partial overwrite of atomic memory intrinsics
Daniel Neilson [Thu, 10 May 2018 15:12:49 +0000 (15:12 +0000)]
[DSE] Teach the pass about partial overwrite of atomic memory intrinsics

Summary:
This change teaches DSE that the atomic memory intrinsics can be overwriten
partially in the same way as the non-atomic forms. Specifically, that the
atomic memcpy & memset can be shortened at the end and that the atomic memset
can be shortened at the beginning, if they partially overwritten
by later stores.

Reviewers: mkazantsev, skatkov, apilipenko, efriedma, rsmith, spatel, filcab, sanjoy

Reviewed By: efriedma

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331991 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PR37339] Fix assertion in FunctionComparator::cmpInlineAsm
whitequark [Thu, 10 May 2018 15:05:47 +0000 (15:05 +0000)]
[PR37339] Fix assertion in FunctionComparator::cmpInlineAsm

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

InlineAsm is only uniqued if the FunctionTypes are exactly the
same, while cmpTypes() for example considers all pointer types
in the default address space to be the same. For this reason
the end of cmpInlineAsm() can be reached.

This patch replaces the unreachable assertion with a check that
the function types are not identical.

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

Reviewers: jfb

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331990 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] fix test names; NFC
Sanjay Patel [Thu, 10 May 2018 14:58:47 +0000 (14:58 +0000)]
[x86] fix test names; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331989 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] add tests for maxnum/minnum intrinsics with nnan; NFC
Sanjay Patel [Thu, 10 May 2018 14:48:42 +0000 (14:48 +0000)]
[x86] add tests for maxnum/minnum intrinsics with nnan; NFC

Clang 6.0 was updated to create these intrinsics rather than
libcalls or fcmp/select, but the backend wasn't prepared to
handle that optimally.

This bug is not the primary reason for PR37403:
https://bugs.llvm.org/show_bug.cgi?id=37403
...but it's probably more important for x86 perf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331988 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDon't redefine a bunch of defines from llvm-config.h in config.h.
Nico Weber [Thu, 10 May 2018 14:45:05 +0000 (14:45 +0000)]
Don't redefine a bunch of defines from llvm-config.h in config.h.

r210144 made config.h include llvm-config.h and deduplicated defines. Then
rL239987 later added back some of the duplication.
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150914/300329.html
suggests this was done for the configure/make build, which no longer exists.

No intended behavior change.

https://reviews.llvm.org/D46288

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331987 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DWARF] Remove unused member and fix(?) the unit-tests on big endian hosts
James Henderson [Thu, 10 May 2018 14:36:24 +0000 (14:36 +0000)]
[DWARF] Remove unused member and fix(?) the unit-tests on big endian hosts

I can't verified the fix on a big endian host, so I'm not 100% certain it
will work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331986 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAG] Avoid using deleted node in rebuildSetCC
Nirav Dave [Thu, 10 May 2018 14:28:54 +0000 (14:28 +0000)]
[DAG] Avoid using deleted node in rebuildSetCC

Summary:
The combine in rebuildSetCC may be combined to another
node leaving our references stale. Keep a handle on
it to avoid stale references.

Fixes PR36602.

Reviewers: dbabokin, RKSimon, eli.friedman, davide

Subscribers: hiraditya, uabelho, JesperAntonsson, qcolombet, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331985 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DWARF] DwarfGenerator.h LineTable: explicitly mark DG as unused
Roman Lebedev [Thu, 10 May 2018 14:16:45 +0000 (14:16 +0000)]
[DWARF] DwarfGenerator.h LineTable: explicitly mark DG as unused

Just want to unbreak the build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331984 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DWARF] dwarfgen::LineTable::writeData(): pacify -Wcovered-switch-default
Roman Lebedev [Thu, 10 May 2018 14:16:41 +0000 (14:16 +0000)]
[DWARF] dwarfgen::LineTable::writeData(): pacify -Wcovered-switch-default

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331983 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DWARF] DWARFDebugLineTest: fix a few more signed/unsigned mismatch warnings
Roman Lebedev [Thu, 10 May 2018 14:16:37 +0000 (14:16 +0000)]
[DWARF] DWARFDebugLineTest: fix a few more signed/unsigned mismatch warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331982 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix signed/unsigned comparison warning and print format
James Henderson [Thu, 10 May 2018 12:15:43 +0000 (12:15 +0000)]
Fix signed/unsigned comparison warning and print format

The print format was causing at least 2 unit-test failures from r331971.

The signed/unsigned comparison warnings only appeared to affect two lines but
it was unclear whether it might just pop up on other lines, so I have been
explicit in all the literals in the tests.

There were other bot unit-test failures that I am still investigating.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331978 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CFLGraph] Fixed Select instruction handling
David Bolvansky [Thu, 10 May 2018 11:47:36 +0000 (11:47 +0000)]
[CFLGraph] Fixed Select instruction handling

Summary:
Operand 0 is the condition, not the true value.

Use op 1 and op 2 as the correct values.

Reviewers: george.burgess.iv, nlopes, efriedma

Reviewed By: george.burgess.iv

Subscribers: craig.topper, rjmccall, lebedev.ri, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331976 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Only propagate known leading zeros from udiv input to output.
Benjamin Kramer [Thu, 10 May 2018 11:45:18 +0000 (11:45 +0000)]
[InstCombine] Only propagate known leading zeros from udiv input to output.

Put in a conservatively correct estimate for now. Avoids miscompiling
clang in FDO mode. This is really tricky to trigger in reality as
basically all interesting cases will be folded away by computeKnownBits
earlier, I was unable to find a reasonably small test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331975 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DWARF] Rework debug line parsing to use llvm::Error and callbacks
James Henderson [Thu, 10 May 2018 10:51:33 +0000 (10:51 +0000)]
[DWARF] Rework debug line parsing to use llvm::Error and callbacks

Reviewed by: dblaikie, JDevlieghere, espindola

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

Summary:
The .debug_line parser previously reported errors by printing to stderr and
return false. This is not particularly helpful for clients of the library code,
as it prevents them from handling the errors in a manner based on the calling
context. This change switches to using llvm::Error and callbacks to indicate
what problems were detected during parsing, and has updated clients to handle
the errors in a location-specific manner. In general, this means that they
continue to do the same thing to external users. Below, I have outlined what
the known behaviour changes are, relating to this change.

There are two levels of "errors" in the new error mechanism, to broadly
distinguish between different fail states of the parser, since not every
failure will prevent parsing of the unit, or of subsequent unit. Malformed
table errors that prevent reading the remainder of the table (reported by
returning them) and other minor issues representing problems with parsing that
do not prevent attempting to continue reading the table (reported by calling a
specified callback funciton). The only example of this currently is when the
last sequence of a unit is unterminated. However, I think it would be good to
change the handling of unrecognised opcodes to report as minor issues as well,
rather than just printing to the stream if --verbose is used (this would be a
subsequent change however).

I have substantially extended the DwarfGenerator to be able to handle
custom-crafted .debug_line sections, allowing for comprehensive unit-testing
of the parser code. For now, I am just adding unit tests to cover the basic
error reporting, and positive cases, and do not currently intend to test every
part of the parser, although the framework should be sufficient to do so at a
later point.

Known behaviour changes:
  - The dump function in DWARFContext now does not attempt to read subsequent
  tables when searching for a specific offset, if the unit length field of a
  table before the specified offset is a reserved value.
  - getOrParseLineTable now returns a useful Error if an invalid offset is
  encountered, rather than simply a nullptr.
  - The parse functions no longer use `WithColor::warning` directly to report
  errors, allowing LLD to call its own warning function.
  - The existing parse error messages have been updated to not specifically
  include "warning" in their message, allowing consumers to determine what
  severity the problem is.
  - If the line table version field appears to have a value less than 2, an
  informative error is returned, instead of just false.
  - If the line table unit length field uses a reserved value, an informative
  error is returned, instead of just false.
  - Dumping of .debug_line.dwo sections is now implemented the same as regular
  .debug_line sections.
  - Verbose dumping of .debug_line[.dwo] sections now prints the prologue, if
  there is a prologue error, just like non-verbose dumping.

As a helper for the generator code, I have re-added emitInt64 to the
AsmPrinter code. This previously existed, but was removed way back in r100296,
presumably because it was dead at the time.

This change also requires a change to LLD, which will be committed separately.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331971 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[mips] Correct the predicates of cvt.fmt.fmt instructions
Simon Dardis [Thu, 10 May 2018 10:42:30 +0000 (10:42 +0000)]
[mips] Correct the predicates of cvt.fmt.fmt instructions

Reviewers: atanasyan, smaksimovic, abeserminji

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331969 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] ptwrite intrinsic
Gabor Buella [Thu, 10 May 2018 07:26:05 +0000 (07:26 +0000)]
[X86] ptwrite intrinsic

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper, RKSimon

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331961 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix tests added in r331924 so that they work on Windows.
Douglas Yung [Thu, 10 May 2018 03:06:42 +0000 (03:06 +0000)]
Fix tests added in r331924 so that they work on Windows.

The test needed to check for the optional executable extension (llvm-objcopy.EXE).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331952 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SCEV] Add missed Test for rL331949.
Serguei Katkov [Thu, 10 May 2018 01:42:59 +0000 (01:42 +0000)]
[SCEV] Add missed Test for rL331949.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331950 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSCEV] Do not use induction in isKnownPredicate for simplification umax.
Serguei Katkov [Thu, 10 May 2018 01:40:43 +0000 (01:40 +0000)]
SCEV] Do not use induction in isKnownPredicate for simplification umax.

During simplification umax we trigger isKnownPredicate twice. As a first attempt it
tries the induction. To do that it tries to get post increment of SCEV.
Re-writing the SCEV may result in simplification of umax. If the SCEV contains a lot
of umax operations this recursion becomes very slow.

The added test demonstrates the slow behavior.

To resolve this we use only simple ways to check whether the predicate is known.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331949 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Reorder an if condition to put a cheap check in front of a computeKnown...
Craig Topper [Thu, 10 May 2018 00:53:25 +0000 (00:53 +0000)]
[InstCombine] Reorder an if condition to put a cheap check in front of a computeKnownBits call. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331948 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Use APInt::getBitsSetFrom to shortern a line and fix an 80 columns...
Craig Topper [Thu, 10 May 2018 00:53:22 +0000 (00:53 +0000)]
[InstCombine] Use APInt::getBitsSetFrom to shortern a line and fix an 80 columns violation. NFC

Fix a similar line in the same function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331947 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LIT] Add the missing file
Chris Matthews [Thu, 10 May 2018 00:08:39 +0000 (00:08 +0000)]
[LIT] Add the missing file

I forgot to commit this file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331946 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRefactor test incase results are backwards
Chris Matthews [Thu, 10 May 2018 00:06:17 +0000 (00:06 +0000)]
Refactor test incase results are backwards

Looks like results can come in either way in this file.  Loosen the ordering constraints.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331945 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Inscombine] fix a signedness warning which broke -Werror builds
Philip Reames [Thu, 10 May 2018 00:05:29 +0000 (00:05 +0000)]
[Inscombine] fix a signedness warning which broke -Werror builds

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331944 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LIT] Handle xml characters in test names
Chris Matthews [Wed, 9 May 2018 23:48:32 +0000 (23:48 +0000)]
[LIT] Handle xml characters in test names

Lit creates malformed xml when the test case has an & in the name.

Escape those correctly.

This also adds a test case which I will add other nasty encoding issues to in some followup commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331942 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NVPTX] Added a feature to use short pointers for const/local/shared AS.
Artem Belevich [Wed, 9 May 2018 23:46:19 +0000 (23:46 +0000)]
[NVPTX] Added a feature to use short pointers for const/local/shared AS.

Const/local/shared address spaces are all < 4GB and we can always use
32-bit pointers to access them. This has substantial performance impact
on kernels that uses shared memory for intermediary results.

The feature is disabled by default.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331941 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PhaseOrdering] remove stale comments; NFC
Sanjay Patel [Wed, 9 May 2018 23:10:46 +0000 (23:10 +0000)]
[PhaseOrdering] remove stale comments; NFC

Forgot to update this with rL331937.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331939 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AggressiveInstCombine] convert a chain of 'and-shift' bits into masked compare
Sanjay Patel [Wed, 9 May 2018 23:08:15 +0000 (23:08 +0000)]
[AggressiveInstCombine] convert a chain of 'and-shift' bits into masked compare

This is a follow-up to D45986. As suggested there, we should match the "all-bits-set"
pattern in addition to "any-bits-set".

This was a little more complicated than I thought it would be initially because the
"and 1" instruction can be anywhere in the chain. Hopefully, the code comments make
that logic understandable, but if you see a way to simplify or improve that, it's
most appreciated.

This transforms patterns that emerge from bitfield tests as seen in PR37098:
https://bugs.llvm.org/show_bug.cgi?id=37098

I think it would also help reduce the large test from:
D46336
D46595
but we need something to reassociate that case to the forms we're expecting here first.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331937 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Widen guards with conditions between
Philip Reames [Wed, 9 May 2018 22:56:32 +0000 (22:56 +0000)]
[InstCombine] Widen guards with conditions between

The previous handling for guard widening in InstCombine was extremely restrictive. In particular, it didn't handle the common case where we had two guards separated by a single icmp. Handle this by scanning through a small fixed window of instructions to find the next guard if needed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331935 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits...
Benjamin Kramer [Wed, 9 May 2018 22:27:34 +0000 (22:27 +0000)]
[InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits that are zero in the divisor

This is safe as long as the udiv is not exact. The pattern is not common in
C++ code, but comes up all the time in code generated by XLA's GPU backend.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331933 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Add support for SETCCCARRY instead of SETCCE
Amaury Sechet [Wed, 9 May 2018 22:15:51 +0000 (22:15 +0000)]
[ARM] Add support for SETCCCARRY instead of SETCCE

Summary: As per title. SETCCE is deprecated and will eventually be removed.

Reviewers: rogfer01, efriedma, rengolin, javed.absar

Subscribers: kristof.beyls, chrib, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331929 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GlobalISel][Legalizer] Widening the second src op of shifts bug fix
Roman Tereshin [Wed, 9 May 2018 21:43:30 +0000 (21:43 +0000)]
[GlobalISel][Legalizer] Widening the second src op of shifts bug fix

The second source operand of G_SHL, G_ASHR, and G_LSHR must preserve its
value as a (small) unsigned integer, therefore its incorrect to widen it
in any way but by zero extending it.

G_SHL was using G_ANYEXT and G_ASHR - G_SEXT (which is correct for their
destination and first source operands, but not the "number of bits to
shift" operand).

Generally, shifts aren't as similar to regular binary operations as it
might seem, for instance, they aren't commutative nor associative and
the second source operand usually requires a special treatment.

Reviewers: bogner, javed.absar, aivchenk, rovka

Reviewed By: bogner

Subscribers: igorb, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331926 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-objcopy] Add --strip-symbol (-N) option
Paul Semel [Wed, 9 May 2018 21:36:54 +0000 (21:36 +0000)]
[llvm-objcopy] Add --strip-symbol (-N) option

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331924 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU] Support horizontal vectorization of min/max.
Farhana Aleen [Wed, 9 May 2018 21:18:34 +0000 (21:18 +0000)]
[AMDGPU] Support horizontal vectorization of min/max.

Author: FarhanaAleen

Reviewed By: rampitec

Subscribers: AMDGPU

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331920 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Ignore any_extend in mul24 combine
Matt Arsenault [Wed, 9 May 2018 21:11:35 +0000 (21:11 +0000)]
AMDGPU: Ignore any_extend in mul24 combine

If a multiply is truncated, SimplifyDemandedBits
sometimes turns a zero_extend of the inputs into an
any_extend, which makes the known bits computation unhelpful.
Ignore these and compute known bits for the underlying value,
since we insert the correct extend type after.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331919 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Add patterns for vector shift-and-accumulate
Krzysztof Parzyszek [Wed, 9 May 2018 21:10:41 +0000 (21:10 +0000)]
[Hexagon] Add patterns for vector shift-and-accumulate

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331918 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Handle partial shift reduction for variable shifts
Matt Arsenault [Wed, 9 May 2018 20:52:54 +0000 (20:52 +0000)]
AMDGPU: Handle partial shift reduction for variable shifts

If the variable shift amount has known bits, we can still reduce
the shift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331917 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Partially shrink 64-bit shifts if reduced to 16-bit
Matt Arsenault [Wed, 9 May 2018 20:52:43 +0000 (20:52 +0000)]
AMDGPU: Partially shrink 64-bit shifts if reduced to 16-bit

This is an extension of an existing combine to reduce wider
shls if the result fits in the final result type. This
introduces the same combine, but reduces the shift to a middle
sized type to avoid the slow 64-bit shift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331916 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Fix Broadwell's Shuffle256 schedule classes load latency values.
Simon Pilgrim [Wed, 9 May 2018 19:27:48 +0000 (19:27 +0000)]
[X86] Fix Broadwell's Shuffle256 schedule classes load latency values.

Allows us to remove some unnecessary InstRW overrides.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331913 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Merge instregex patterns to reduce InstrRW compile time.
Simon Pilgrim [Wed, 9 May 2018 19:04:15 +0000 (19:04 +0000)]
[X86] Merge instregex patterns to reduce InstrRW compile time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331911 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Add combine for trunc of bitcast from build_vector
Matt Arsenault [Wed, 9 May 2018 18:37:39 +0000 (18:37 +0000)]
AMDGPU: Add combine for trunc of bitcast from build_vector

If the truncate is only accessing the first element of the vector,
we can use the original source value.

This helps with some combine ordering issues after operations are
lowered to integer operations between bitcasts of build_vector.
In particular it stops unnecessarily materializing the unused
top half of a vector in some cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331909 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Check the end of the correct container (fix typo)
Krzysztof Parzyszek [Wed, 9 May 2018 18:33:59 +0000 (18:33 +0000)]
[Hexagon] Check the end of the correct container (fix typo)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331907 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Stop special casing constant indexes of extract_vector_elt
Matt Arsenault [Wed, 9 May 2018 18:29:26 +0000 (18:29 +0000)]
AMDGPU: Stop special casing constant indexes of extract_vector_elt

The same result folds out of the dynamic expansion logic if the
index is constant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331906 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-rc] Handle C preprocessor output
Martin Storsjo [Wed, 9 May 2018 18:21:03 +0000 (18:21 +0000)]
[llvm-rc] Handle C preprocessor output

When preprocessing resource scripts (which can easily be done outside
of llvm-rc), included headers can leave behind C declarations (despite
preprocessing with -DRC_INVOKED), that can't be parsed by a resource
compiler.

This is handled in all of rc.exe, by parsing the preprocessor output
line markers and ignoring content from files named *.h and *.c,
documented at [1].

In addition to this filtering, strip out any other preprocessor directive
that is left behind (like pragmas) which also can't be handled by the
tokenizer.

The added test uses both standard #line markers (supported by rc.exe) and
GNU style extended line markers, thus this test doesn't pass with rc.exe,
but passes with GNU windres. (Windres on the other hand doesn't filter
out files named *.c, only *.h.)

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

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa381033(v=vs.85).aspx

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331903 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-rc] Add support for the RCDATA resource type
Martin Storsjo [Wed, 9 May 2018 18:20:56 +0000 (18:20 +0000)]
[llvm-rc] Add support for the RCDATA resource type

This is the same as any other user defined resource, but with
a specific allocated resource type number.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331902 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields
Martin Storsjo [Wed, 9 May 2018 18:20:49 +0000 (18:20 +0000)]
[llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields

-1 is commonly used as ID for controls that one don't want to
refer to later. For DIALOG resources, the IDs are 16 bit numbers,
and -1 gets interpreted as UINT32_MAX earlier, which then later is
too large to write into a uint16_t.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331901 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago Reapplying r331819 [GlobalISel][Legalizer] More concise and faster widenScalar...
Roman Tereshin [Wed, 9 May 2018 17:28:18 +0000 (17:28 +0000)]
Reapplying r331819 [GlobalISel][Legalizer] More concise and faster widenScalar, NFC

    The commit was a suspect for clang-cmake-aarch64-global-isel and
    clang-cmake-aarch64-quick bot failures, proved to be innocent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331898 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agollvm-mca: Add missing includes
David Blaikie [Wed, 9 May 2018 17:28:10 +0000 (17:28 +0000)]
llvm-mca: Add missing includes

Move the header include in the primary source file to the top to
validate that it doesn't depend on any other inclusions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331897 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAGCombiner] In visitBITCAST when trying to constant fold the bitcast, only call...
Craig Topper [Wed, 9 May 2018 17:14:27 +0000 (17:14 +0000)]
[DAGCombiner] In visitBITCAST when trying to constant fold the bitcast, only call getBitcast if its an fp->int or int->fp conversion even when before legalize ops.

Previously if !LegalOperations we would blindly call getBitcast and hope that getNode would constant fold it. But if the conversion is between a vector and a scalar, getNode has no simplification.

This means we would just get back the original N. We would then return that N which would make the caller of visitBITCAST think that we used CombineTo and did our own worklist management. This prevents target specific optimizations from being called for vector/scalar bitcasts until after legal operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331896 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] snprintf optimizations
David Bolvansky [Wed, 9 May 2018 16:09:31 +0000 (16:09 +0000)]
[InstCombine] snprintf optimizations

Reviewers: spatel, efriedma, majnemer, rja, bkramer

Reviewed By: rja, bkramer

Subscribers: rja, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331889 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAGCombine] Change store merge candidates check cut off to 1024.
Amara Emerson [Wed, 9 May 2018 15:53:06 +0000 (15:53 +0000)]
[DAGCombine] Change store merge candidates check cut off to 1024.

The previous value of 8192 resulted in severe compile time hits in
some pathological cases.

rdar://39781410

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331888 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Fix sanitizer error about using -1u in variable of enum type
Krzysztof Parzyszek [Wed, 9 May 2018 15:44:40 +0000 (15:44 +0000)]
[Hexagon] Fix sanitizer error about using -1u in variable of enum type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331887 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LV] Change MaxVectorSize bound to 256 in assertion, NFC otherwise
Krzysztof Parzyszek [Wed, 9 May 2018 15:18:12 +0000 (15:18 +0000)]
[LV] Change MaxVectorSize bound to 256 in assertion, NFC otherwise

It's possible to have a vector of 256 bytes in HVX code on Hexagon
(vector pair in 128-byte mode).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331885 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAPFloat/x87: Fix string conversion for "unnormal" values (pr35860)
Pavel Labath [Wed, 9 May 2018 15:13:45 +0000 (15:13 +0000)]
APFloat/x87: Fix string conversion for "unnormal" values (pr35860)

Summary:
Unnormal values are a feature of some very old x87 processors. We handle
them correctly for the most part -- the only exception was an unnormal
value whose significand happened to be zero. In this case the APFloat
was still initialized as normal number (category = fcNormal), but a
subsequent toString operation would assert because the math would
produce nonsensical values for the zero significand.

During review, it was decided that the correct way to fix this is to
treat all unnormal values as NaNs (as that is what any >=386 processor
will do).

The issue was discovered because LLDB would crash when trying to print
some "long double" values.

Reviewers: skatkov, scanon, gottesmm

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331884 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Simplify MCCodeEmitter, move data to tables
Krzysztof Parzyszek [Wed, 9 May 2018 15:02:04 +0000 (15:02 +0000)]
[Hexagon] Simplify MCCodeEmitter, move data to tables

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331883 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LV] Add lit testcase for bitcast problem. NFC
Karl-Johan Karlsson [Wed, 9 May 2018 13:34:57 +0000 (13:34 +0000)]
[LV] Add lit testcase for bitcast problem. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331878 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Support/Path] Make handling of paths like "///" consistent
Pavel Labath [Wed, 9 May 2018 13:21:16 +0000 (13:21 +0000)]
[Support/Path] Make handling of paths like "///" consistent

Summary:
Various path functions were not treating paths consisting of slashes
alone consistently. For example, the iterator-based accessors decomposed the
path "///" into two elements: "/" and ".". This is not too bad, but it
is different from the behavior specified by posix:
```
A pathname that contains ***at least one non-slash character*** and that
ends with one or more trailing slashes shall be resolved as if a single
dot character ( '.' ) were appended to the pathname.
```
More importantly, this was different from how we treated the same path
in the filename+parent_path functions, which decomposed this path into
"." and "". This was completely wrong as it lost the information that
this was an absolute path which referred to the root directory.

This patch fixes this behavior by making sure all functions treat paths
consisting of (back)slashes alone the same way as "/". I.e., the
iterator-based functions will just report one component ("/"), and the
filename+parent_path will decompose them into "/" and "".

A slightly controversial topic here may be the treatment of "//". Posix
says that paths beginning with "//" may have special meaning and indeed
we have code which parses paths like "//net/foo/bar" specially. However,
as we were already not being consistent in parsing the "//" string
alone, and any special parsing for it would complicate the code further,
I chose to treat it the same way as longer sequences of slashes (which
are guaranteed to be the same as "/").

Another slight change of behavior is in the parsing of paths like
"//net//". Previously the last component of this path was ".". However,
as in our parsing the "//net" part in this path was the same as the
"drive" part in "c:\" and the next slash was the "root directory", it
made sense to treat "//net//" the same way as "//net/" (i.e., not to add
the extra "." component at the end).

Reviewers: zturner, rnk, dblaikie, Bigcheese

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331876 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Improve cost of vector division by constant
Adhemerval Zanella [Wed, 9 May 2018 12:48:22 +0000 (12:48 +0000)]
[AArch64] Improve cost of vector division by constant

With custom lowering for vector MULLH{S,U}, it is now profitable to
vectorize a divide by constant loop for the custom types (v16i8, v8i16,
and v4i32).  The cost if based on TargetLowering::Build{S,U}DIV which
uses a multiply by constant plus adjustment to express a divide by
constant.

Both {u,s}mull{2} are expressed as Instruction::Mul and shifts by
Instruction::AShr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331873 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove 'abi-breaking-checks' lit feature.
Nico Weber [Wed, 9 May 2018 12:39:39 +0000 (12:39 +0000)]
Remove 'abi-breaking-checks' lit feature.

Its only two uses were removed in r311730.
Effectively reverts r304851 (but that code has removed around a bit since then).
https://reviews.llvm.org/D46619

clang side done in r331871.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331872 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "DWARFVerifier: Check "completeness" of .debug_names section"
Pavel Labath [Wed, 9 May 2018 12:26:19 +0000 (12:26 +0000)]
Revert "DWARFVerifier: Check "completeness" of .debug_names section"

The new verifier check has found an error in the
debug-names-name-collisions.ll test on the PS4 bot:

error: Name Index @ 0x0: Entry @ 0xdc: mismatched Name of DIE @ 0x23: index - _ZN3foo3fooE; debug_info - foo.

Reverting while I investigate whether this is a bug in the verifier or
the generator.

This reverts commit r331868.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331869 91177308-0d34-0410-b5e6-96231b3b80d8