OSDN Git Service

android-x86/external-llvm.git
6 years ago[DAG] reduce code duplication; NFCI
Sanjay Patel [Fri, 11 May 2018 20:08:23 +0000 (20:08 +0000)]
[DAG] reduce code duplication; NFCI

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

6 years ago[InstCombine] Handle atomic memset in the same way as regular memset
Daniel Neilson [Fri, 11 May 2018 20:04:50 +0000 (20:04 +0000)]
[InstCombine] Handle atomic memset in the same way as regular memset

Summary:
This change adds handling of the atomic memset intrinsic to the
code path that simplifies the regular memset. In practice this means
that we will now also expand a small constant-length atomic memset
into a single unordered atomic store.

Reviewers: apilipenko, skatkov, mkazantsev, anna, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

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

6 years agoMove standard library inclusions to after internal inclusions.
David Blaikie [Fri, 11 May 2018 19:21:40 +0000 (19:21 +0000)]
Move standard library inclusions to after internal inclusions.

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

6 years ago[DAGCombiner] Set the right SDLoc on extended SETCC uses (7/N)
Vedant Kumar [Fri, 11 May 2018 18:40:10 +0000 (18:40 +0000)]
[DAGCombiner] Set the right SDLoc on extended SETCC uses (7/N)

ExtendSetCCUses updates SETCC nodes which use a load (OriginalLoad) to
reflect a simplification to the load (ExtLoad).

Based on my reading, ExtendSetCCUses may create new nodes to extend a
constant attached to a SETCC. It also creates fresh SETCC nodes which
refer to any updated operands.

ISTM that the location applied to the new constant and SETCC nodes
should be the same as the location of the ExtLoad.

This was suggested by Adrian in https://reviews.llvm.org/D45995.

Part of: llvm.org/PR37262

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

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

6 years ago[DAGCombiner] Set the right SDLoc on a newly-created sextload (6/N)
Vedant Kumar [Fri, 11 May 2018 18:40:08 +0000 (18:40 +0000)]
[DAGCombiner] Set the right SDLoc on a newly-created sextload (6/N)

This teaches tryToFoldExtOfLoad to set the right location on a
newly-created extload. With that in place, the logic for performing a
certain ([s|z]ext (load ...)) combine becomes identical for sexts and
zexts, and we can get rid of one copy of the logic.

The test case churn is due to dependencies on IROrders inherited from
the wrong SDLoc.

Part of: llvm.org/PR37262

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

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

6 years ago[DAGCombiner] Factor out duplicated logic for an extload combine, NFC (5/N)
Vedant Kumar [Fri, 11 May 2018 18:40:02 +0000 (18:40 +0000)]
[DAGCombiner] Factor out duplicated logic for an extload combine, NFC (5/N)

Part of the logic for combining (zext (load ...)) and (sext (load ...))
is duplicated. This creates problems because bugs in one version have to
be fixed again in the other version.

To address this, as a first step, I've extracted the duplicate logic
into a helper. I'll fix the debug location bug in the helper and
eliminate the copy of its logic in a followup.

Part of: llvm.org/PR37262

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

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

6 years ago[LIT] replace output escapes wit a cdata block
Chris Matthews [Fri, 11 May 2018 18:38:02 +0000 (18:38 +0000)]
[LIT] replace output escapes wit a cdata block

CDATA blocks don't need to have XML stuff escaped. Makes sense to wrap
output in them instead of escaping.

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

6 years agomake add_llvm_fuzzer calls slightly more consisten with other cmake
Nico Weber [Fri, 11 May 2018 17:58:52 +0000 (17:58 +0000)]
make add_llvm_fuzzer calls slightly more consisten with other cmake

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

6 years ago[InstCombine] snprintf optimizations
David Bolvansky [Fri, 11 May 2018 17:50:49 +0000 (17:50 +0000)]
[InstCombine] snprintf optimizations

Reviewers: spatel, efriedma, majnemer, rja, bkramer

Reviewed By: rja, bkramer

Subscribers: mstorsjo, rja, llvm-commits

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

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

6 years ago[X86][BtVer2] Model ymm move as double pumped instructions
Simon Pilgrim [Fri, 11 May 2018 17:38:36 +0000 (17:38 +0000)]
[X86][BtVer2] Model ymm move as double pumped instructions

We still need to handle mmx/xmm moves as 'decode-only' no-pipe instructions

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

6 years ago[RISCV] Support .option rvc and norvc assembler directives
Alex Bradbury [Fri, 11 May 2018 17:30:28 +0000 (17:30 +0000)]
[RISCV] Support .option rvc and norvc assembler directives

These directives allow the 'C' (compressed) extension to be enabled/disabled
within a single file.

Differential Revision: https://reviews.llvm.org/D45864
Patch by Kito Cheng

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

6 years ago[Analysis] Validate the return type of s(n)printf like libcalls
Martin Storsjo [Fri, 11 May 2018 16:53:56 +0000 (16:53 +0000)]
[Analysis] Validate the return type of s(n)printf like libcalls

If the sprintf function is static (as on mingw-w64, where many stdio
functions are static inline wrappers), earlier optimization passes
could optimize out the return value altogether, and make it void,
which could break optimizations of this libcall that touch the
return value.

This fixes the issue discussed in PR37408 for the sprintf function.

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

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

6 years ago[X86][MMX] Tag MMX Move/Load/Store as WriteVec schedule classes
Simon Pilgrim [Fri, 11 May 2018 16:38:59 +0000 (16:38 +0000)]
[X86][MMX] Tag MMX Move/Load/Store as WriteVec schedule classes

Fixes an issue on SLM/Btver2 where we had instructions were being treated as scalar loads/stores

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

6 years ago[AArch64] Fix performPostLD1Combine to check for constant lane index.
Geoff Berry [Fri, 11 May 2018 16:25:06 +0000 (16:25 +0000)]
[AArch64] Fix performPostLD1Combine to check for constant lane index.

Summary:
performPostLD1Combine in AArch64ISelLowering looks for vector
insert_vector_elt of a loaded value which it can optimize into a single
LD1LANE instruction.  The code checking for the pattern was not checking
if the lane index was a constant which could cause two problems:

- an assert when lowering the LD1LANE ISD node since it assumes an
  constant operand

- an assert in isel if the lane index value depends on the
  post-incremented base register

Both of these issues are avoided by simply checking that the lane index
is a constant.

Fixes bug 35822.

Reviewers: t.p.northover, javed.absar

Subscribers: rengolin, kristof.beyls, mcrosier, llvm-commits

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

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

6 years ago[mips] Rename Filler to MipsDelaySlotFiller and initialize the pass
Simon Dardis [Fri, 11 May 2018 16:13:53 +0000 (16:13 +0000)]
[mips] Rename Filler to MipsDelaySlotFiller and initialize the pass

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

6 years agoUse iteration instead of recursion in CFIInserter
Sanjoy Das [Fri, 11 May 2018 15:54:46 +0000 (15:54 +0000)]
Use iteration instead of recursion in CFIInserter

Summary: This recursive step can overflow the stack.

Reviewers: djokov, petarj

Subscribers: mcrosier, jlebar, bixia, llvm-commits

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

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

6 years ago[Reassociate] Prevent infinite loops when processing PHIs.
Davide Italiano [Fri, 11 May 2018 15:45:36 +0000 (15:45 +0000)]
[Reassociate] Prevent infinite loops when processing PHIs.

Phi nodes can reside in live blocks but one of their incoming
arguments can come from a dead block. Dead blocks and reassociate
don't play nice together. In fact, reassociate performs an RPO
as a first step to avoid processing dead blocks.

The reason why Reassociate might not fixpoint when examining
dead blocks is that the following:

  %xor0 = xor i16 %xor1, undef
  %xor1 = xor i16 %xor0, undef

is perfectly valid LLVM IR (if it appears in a dead block),
so the worklist algorithm keeps pushing the two instructions for
reexamination. Note that this is not Reassociate fault, at least
not entirely. It's llvm that has a weird definition of dominance.

Fixes PR37390.

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

6 years agoRemove unused SyncExecutor and make it clearer that the whole file is only used if...
Nico Weber [Fri, 11 May 2018 15:25:38 +0000 (15:25 +0000)]
Remove unused SyncExecutor and make it clearer that the whole file is only used if LLVM_ENABLE_THREADS

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

6 years ago[mips] Enable disassembly of fused (negative) multiply add/sub instructions
Simon Dardis [Fri, 11 May 2018 15:21:40 +0000 (15:21 +0000)]
[mips] Enable disassembly of fused (negative) multiply add/sub instructions

Reviewers: atanasyan, smaksimovic, abeserminji

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

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

6 years ago[X86][SLM] Vector stores only use the MEC port.
Simon Pilgrim [Fri, 11 May 2018 15:16:15 +0000 (15:16 +0000)]
[X86][SLM] Vector stores only use the MEC port.

Confirmed by both Agner and Intel's AOM - the IEC/FPC are not required for pure load/stores (even if its a partial update).

Can't fix WriteStore until all RMW instructions are cleaned up though....

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

6 years ago[X86] Split WriteF/WriteVec Move/Load/Store scheduler classes by vector width
Simon Pilgrim [Fri, 11 May 2018 14:30:54 +0000 (14:30 +0000)]
[X86] Split WriteF/WriteVec Move/Load/Store scheduler classes by vector width

Fixes a SNB issue that was missing vlddqu/vmovntdqa ymm instructions

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

6 years ago[InstCombine] Unify handling of atomic memtransfer with non-atomic memtransfer
Daniel Neilson [Fri, 11 May 2018 14:30:02 +0000 (14:30 +0000)]
[InstCombine] Unify handling of atomic memtransfer with non-atomic memtransfer

Summary:
This change reworks the handling of atomic memcpy within the instcombine pass.
Previously, a constant length atomic memcpy would be lowered into loads & stores
as long as no more than 16 load/store pairs are created. This is quite different
from the lowering done for a non-atomic memcpy; which only ever lowers into a single
load/store pair of no more than 8 bytes. Larger constant-sized memcpy calls are
expanded to load/stores in later passes, such as SelectionDAG lowering.

In this change the behaviour for atomic memcpy is unified with non-atomic memcpy;
atomic memcpy is now treated in the same was as non-atomic memcpy has always been.
We leave it to later passes to lower longer-length atomic memcpy calls.

Due to the structure of the pass's handling of memtransfer intrinsics, this change
also gives us handling of atomic memmove that we did not previously have.

Reviewers: apilipenko, skatkov, mkazantsev, anna, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

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

6 years ago[X86] Added scheduler helper classes to split move/load/store by size
Simon Pilgrim [Fri, 11 May 2018 12:46:54 +0000 (12:46 +0000)]
[X86] Added scheduler helper classes to split move/load/store by size

Nothing uses this yet but this will allow us to specialize MMX/XMM/YMM/ZMM vector moves.

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

6 years ago[APFloat] Set losesInfo on no-op convert
Sven van Haastregt [Fri, 11 May 2018 09:45:42 +0000 (09:45 +0000)]
[APFloat] Set losesInfo on no-op convert

losesInfo would be left unset when no conversion needs to be done.  A
caller such as InstCombine's fitsInFPType would then branch on an
uninitialized value.

Caught using valgrind on an out-of-tree target.

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

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

6 years ago[IRTests] Verify PDT instead of DT
Jakub Kuderski [Fri, 11 May 2018 09:30:29 +0000 (09:30 +0000)]
[IRTests] Verify PDT instead of DT

Summary: Fix two typos which result in verifying wrong data structures (DT) instead of PDT in DominatorTreeBatchUpdatesTest.

Reviewers: davide, kuhar, grosser, dberlin

Reviewed By: davide, kuhar, dberlin

Subscribers: llvm-commits

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

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

6 years agoAMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI
Tom Stellard [Fri, 11 May 2018 05:44:16 +0000 (05:44 +0000)]
AMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI

Reviewers: arsenm, nhaehnle

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

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

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

6 years ago[llvm-strip] Add support for -remove-section
Alexander Shaposhnikov [Fri, 11 May 2018 05:27:06 +0000 (05:27 +0000)]
[llvm-strip] Add support for -remove-section

This diff adds support for -remove-section to llvm-strip.

Test plan: make check-all

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

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

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