OSDN Git Service

android-x86/external-llvm.git
7 years ago[llvm-pdbdump] Allow printing only a portion of a stream.
Zachary Turner [Fri, 28 Apr 2017 00:43:38 +0000 (00:43 +0000)]
[llvm-pdbdump] Allow printing only a portion of a stream.

When dumping raw data from a stream, you might know the offset
of a certain record you're interested in, as well as how long
that record is.  Previously, you had to dump the entire stream
and wade through the bytes to find the interesting record.

This patch allows you to specify an offset and length on the
command line, and it will only dump the requested range.

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

7 years ago[WebAssembly] Add some tests for wasm MC layer
Sam Clegg [Fri, 28 Apr 2017 00:36:36 +0000 (00:36 +0000)]
[WebAssembly] Add some tests for wasm MC layer

Subscribers: jfb, dschuff

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

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

7 years ago[SROA] Fix nondeterminism exposed by Simon's r299221.
Davide Italiano [Thu, 27 Apr 2017 23:09:01 +0000 (23:09 +0000)]
[SROA] Fix nondeterminism exposed by Simon's r299221.

Use a SmallSetSetVector instead of a SmallPtrSet as iterating
over the latter is not stable ('<' relies on addresses).

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

7 years agoFix a few pedantic warnings.
Frederich Munch [Thu, 27 Apr 2017 22:10:57 +0000 (22:10 +0000)]
Fix a few pedantic warnings.

Reviewers: zturner, hansw, hans

Reviewed By: hans

Subscribers: hans, llvm-commits

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

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

7 years ago[InstCombine] fix matcher to bind to specific operand (PR32830)
Sanjay Patel [Thu, 27 Apr 2017 21:55:03 +0000 (21:55 +0000)]
[InstCombine] fix matcher to bind to specific operand (PR32830)

Matching any random value would be very wrong:
https://bugs.llvm.org/show_bug.cgi?id=32830

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

7 years agoSpecify something that's true in practice
Sanjoy Das [Thu, 27 Apr 2017 20:55:07 +0000 (20:55 +0000)]
Specify something that's true in practice

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

7 years ago[asan] Fix dead stripping of globals on Linux.
Evgeniy Stepanov [Thu, 27 Apr 2017 20:27:27 +0000 (20:27 +0000)]
[asan] Fix dead stripping of globals on Linux.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

This is a second re-land of r298158. This time, this feature is
limited to -fdata-sections builds.

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

7 years ago[asan] Put ctor/dtor in comdat.
Evgeniy Stepanov [Thu, 27 Apr 2017 20:27:23 +0000 (20:27 +0000)]
[asan] Put ctor/dtor in comdat.

When possible, put ASan ctor/dtor in comdat.

The only reason not to is global registration, which can be
TU-specific. This is not the case when there are no instrumented
globals. This is also limited to ELF targets, because MachO does
not have comdat, and COFF linkers may GC comdat constructors.

The benefit of this is a lot less __asan_init() calls: one per DSO
instead of one per TU. It's also necessary for the upcoming
gc-sections-for-globals change on Linux, where multiple references to
section start symbols trigger quadratic behaviour in gold linker.

This is a second re-land of r298756. This time with a flag to disable
the whole thing to avoid a bug in the gold linker:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19002

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

7 years ago[X86][SSE] Add tests for broadcast from larger vector loads
Simon Pilgrim [Thu, 27 Apr 2017 20:19:00 +0000 (20:19 +0000)]
[X86][SSE] Add tests for broadcast from larger vector loads

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

7 years ago[llvm-readobj] Dump COFF Resources section.
Zachary Turner [Thu, 27 Apr 2017 19:38:38 +0000 (19:38 +0000)]
[llvm-readobj] Dump COFF Resources section.

This patch dumps the raw bytes of the .rsrc sections that
are present in COFF object and executable files.  Subsequent
patches will parse this information and dump in a more human
readable format.

Differential Revision: https://reviews.llvm.org/D32463
Patch By: Eric Beckmann

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

7 years ago[PM/LoopUnswitch] Introduce a new, simpler loop unswitch pass.
Chandler Carruth [Thu, 27 Apr 2017 18:45:20 +0000 (18:45 +0000)]
[PM/LoopUnswitch] Introduce a new, simpler loop unswitch pass.

Currently, this pass only focuses on *trivial* loop unswitching. At that
reduced problem it remains significantly better than the current loop
unswitch:
- Old pass is worse than cubic complexity. New pass is (I think) linear.
- New pass is much simpler in its design by focusing on full unswitching. (See
  below for details on this).
- New pass doesn't carry state for thresholds between pass iterations.
- New pass doesn't carry state for correctness (both miscompile and
  infloop) between pass iterations.
- New pass produces substantially better code after unswitching.
- New pass can handle more trivial unswitch cases.
- New pass doesn't recompute the dominator tree for the entire function
  and instead incrementally updates it.

I've ported all of the trivial unswitching test cases from the old pass
to the new one to make sure that major functionality isn't lost in the
process. For several of the test cases I've worked to improve the
precision and rigor of the CHECKs, but for many I've just updated them
to handle the new IR produced.

My initial motivation was the fact that the old pass carried state in
very unreliable ways between pass iterations, and these mechansims were
incompatible with the new pass manager. However, I discovered many more
improvements to make along the way.

This pass makes two very significant assumptions that enable most of these
improvements:

1) Focus on *full* unswitching -- that is, completely removing whatever
   control flow construct is being unswitched from the loop. In the case
   of trivial unswitching, this means removing the trivial (exiting)
   edge. In non-trivial unswitching, this means removing the branch or
   switch itself. This is in opposition to *partial* unswitching where
   some part of the unswitched control flow remains in the loop. Partial
   unswitching only really applies to switches and to folded branches.
   These are very similar to full unrolling and partial unrolling. The
   full form is an effective canonicalization, the partial form needs
   a complex cost model, cannot be iterated, isn't canonicalizing, and
   should be a separate pass that runs very late (much like unrolling).

2) Leverage LLVM's Loop machinery to the fullest. The original unswitch
   dates from a time when a great deal of LLVM's loop infrastructure was
   missing, ineffective, and/or unreliable. As a consequence, a lot of
   complexity was added which we no longer need.

With these two overarching principles, I think we can build a fast and
effective unswitcher that fits in well in the new PM and in the
canonicalization pipeline. Some of the remaining functionality around
partial unswitching may not be relevant today (not many test cases or
benchmarks I can find) but if they are I'd like to add support for them
as a separate layer that runs very late in the pipeline.

Purely to make reviewing and introducing this code more manageable, I've
split this into first a trivial-unswitch-only pass and in the next patch
I'll add support for full non-trivial unswitching against a *fixed*
threshold, exactly like full unrolling. I even plan to re-use the
unrolling thresholds, as these are incredibly similar cost tradeoffs:
we're cloning a loop body in order to end up with simplified control
flow. We should only do that when the total growth is reasonably small.

One of the biggest changes with this pass compared to the previous one
is that previously, each individual trivial exiting edge from a switch
was unswitched separately as a branch. Now, we unswitch the entire
switch at once, with cases going to the various destinations. This lets
us unswitch multiple exiting edges in a single operation and also avoids
numerous extremely bad behaviors, where we would introduce 1000s of
branches to test for thousands of possible values, all of which would
take the exact same exit path bypassing the loop. Now we will use
a switch with 1000s of cases that can be efficiently lowered into
a jumptable. This avoids relying on somehow forming a switch out of the
branches or getting horrible code if that fails for any reason.

Another significant change is that this pass actively updates the CFG
based on unswitching. For trivial unswitching, this is actually very
easy because of the definition of loop simplified form. Doing this makes
the code coming out of loop unswitch dramatically more friendly. We
still should run loop-simplifycfg (at the least) after this to clean up,
but it will have to do a lot less work.

Finally, this pass makes much fewer attempts to simplify instructions
based on the unswitch. Something like loop-instsimplify, instcombine, or
GVN can be used to do increasingly powerful simplifications based on the
now dominating predicate. The old simplifications are things that
something like loop-instsimplify should get today or a very, very basic
loop-instcombine could get. Keeping that logic separate is a big
simplifying technique.

Most of the code in this pass that isn't in the old one has to do with
achieving specific goals:
- Updating the dominator tree as we go
- Unswitching all cases in a switch in a single step.

I think it is still shorter than just the trivial unswitching code in
the old pass despite having this functionality.

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

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

7 years ago[GlobalOpt] Correctly update metadata when localizing a global.
Eli Friedman [Thu, 27 Apr 2017 18:39:08 +0000 (18:39 +0000)]
[GlobalOpt] Correctly update metadata when localizing a global.

Just calling dropAllReferences leaves pointers to the ConstantExpr
behind, so we would eventually crash with a null pointer dereference.

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

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

7 years agoMemory intrinsic value profile optimization: Improve debug output (NFC)
Teresa Johnson [Thu, 27 Apr 2017 18:25:22 +0000 (18:25 +0000)]
Memory intrinsic value profile optimization: Improve debug output (NFC)

Summary:
Misc improvements to debug output. Fix a couple typos and also dump the
value profile before we make any profitability checks.

Reviewers: davidxl

Subscribers: llvm-commits

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

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

7 years agoLimit disabling of warnings emitted from r301571 by checking __GNUC__.
Frederich Munch [Thu, 27 Apr 2017 18:05:29 +0000 (18:05 +0000)]
Limit disabling of warnings emitted from r301571 by checking __GNUC__.

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

7 years agoFix warnings from test added in r301562 on Windows (when built without exceptions).
Frederich Munch [Thu, 27 Apr 2017 17:33:50 +0000 (17:33 +0000)]
Fix warnings from test added in r301562 on Windows (when built without exceptions).

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

7 years agoSync with changes from r300825 in clang.
Vassil Vassilev [Thu, 27 Apr 2017 17:23:53 +0000 (17:23 +0000)]
Sync with changes from r300825 in clang.

Generate the better include paths. Instead of #include <llvm_header.h> doxygen
produces #include "llvm/Folder/llvm_header.h"

Patch by Yuka Takahashi (D32342)!

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

7 years agoUse a pointer type for target frame indices during statepoint lowering
Sanjoy Das [Thu, 27 Apr 2017 17:17:16 +0000 (17:17 +0000)]
Use a pointer type for target frame indices during statepoint lowering

Summary:
The type of the target frame index is intptr, not the type of the value we're
going to store into it.  Without this change we crash in the attached test case
when trying to type-legalize a TargetFrameIndex.

Patchpoint lowering types the target frame index as intptr as well.

Reviewers: reames, bogner, arsenm

Subscribers: arsenm, mcrosier, llvm-commits

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

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

7 years agocmake: Touch $GIT_DIR/logs/HEAD if it does not already exist.
Peter Collingbourne [Thu, 27 Apr 2017 17:04:05 +0000 (17:04 +0000)]
cmake: Touch $GIT_DIR/logs/HEAD if it does not already exist.

Apparently some git tools (such as "repo") may not create this file.
Patch by Quentin Neill.

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

7 years agoRefactor DynamicLibrary so searching for a symbol will have a defined order and
Frederich Munch [Thu, 27 Apr 2017 16:55:24 +0000 (16:55 +0000)]
Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv
Native: getenv("TEST") -> NULL // called ucrt.dll, getenv

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

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

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

7 years ago[PartialInlining]: Improve partial inlining to handle complex conditions
Xinliang David Li [Thu, 27 Apr 2017 16:34:00 +0000 (16:34 +0000)]
[PartialInlining]: Improve partial inlining to handle complex conditions

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

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

7 years ago[CodeView] Isolate Debug Info Fragments into standalone classes.
Zachary Turner [Thu, 27 Apr 2017 16:12:16 +0000 (16:12 +0000)]
[CodeView] Isolate Debug Info Fragments into standalone classes.

Previously parsing of these were all grouped together into a
single master class that could parse any type of debug info
fragment.

With writing forthcoming, the complexity of each individual
fragment is enough to warrant them having their own classes so
that reading and writing of each fragment type can be grouped
together, but isolated from the code for reading and writing
other fragment types.

In doing so, I found a place where parsing code was duplicated
for the FileChecksums fragment, across llvm-readobj and the
CodeView library, and one of the implementations had a bug.
Now that the codepaths are merged, the bug is resolved.

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

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

7 years ago[Support] Make BinaryStreamArray extractors stateless.
Zachary Turner [Thu, 27 Apr 2017 16:11:47 +0000 (16:11 +0000)]
[Support] Make BinaryStreamArray extractors stateless.

Instead, we now pass a context memeber through the extraction
process.

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

7 years agoRename some PDB classes.
Zachary Turner [Thu, 27 Apr 2017 16:11:19 +0000 (16:11 +0000)]
Rename some PDB classes.

We have a lot of very similarly named classes related to
dealing with module debug info.  This patch has NFC, it just
renames some classes to be more descriptive (albeit slightly
more to type).  The mapping from old to new class names is as
follows:

   Old          |        New
ModInfo         | DbiModuleDescriptor
ModuleSubstream | ModuleDebugFragment
ModStream       | ModuleDebugStream

With the corresponding Builder classes renamed accordingly.

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

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

7 years ago[x86] add minimal tests for potential size-changing vsel transforms; NFC
Sanjay Patel [Thu, 27 Apr 2017 16:10:20 +0000 (16:10 +0000)]
[x86] add minimal tests for potential size-changing vsel transforms; NFC

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

7 years ago[AMDGPU] DPP: add support for GFX9
Sam Kolton [Thu, 27 Apr 2017 15:42:38 +0000 (15:42 +0000)]
[AMDGPU] DPP: add support for GFX9

Reviewers: artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

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

7 years agoFix typo and place comment close to its target
Krzysztof Parzyszek [Thu, 27 Apr 2017 14:38:21 +0000 (14:38 +0000)]
Fix typo and place comment close to its target

Patch by Wei-Ren Chen.

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

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

7 years agoFixing a malformed RST table to get the documentation bot back to green.
Aaron Ballman [Thu, 27 Apr 2017 14:33:01 +0000 (14:33 +0000)]
Fixing a malformed RST table to get the documentation bot back to green.

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

7 years agoFixed assert message to correctly refer to MRMSrcReg4VOp3Frm/MRMSrcMeg4VOp3Frm.
Simon Pilgrim [Thu, 27 Apr 2017 14:25:04 +0000 (14:25 +0000)]
Fixed assert message to correctly refer to MRMSrcReg4VOp3Frm/MRMSrcMeg4VOp3Frm.

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

7 years ago[mips][microMIPS] Adding code size reduction pass for MicroMIPS
Zoran Jovanovic [Thu, 27 Apr 2017 13:10:48 +0000 (13:10 +0000)]
[mips][microMIPS] Adding code size reduction pass for MicroMIPS
Author: milena.vujosevic.janicic
Reviewers: sdardis
The code implements size reduction pass for MicroMIPS.
Load and store instructions are examined and transformed, if possible.
lw32 instruction is transformed into 16-bit instruction lwsp
sw32 instruction is transformed into 16-bit instruction swsp
Arithmetic instrcutions are examined and transformed, if possible.
addu32 instruction is transformed into 16-bit instruction addu16
subu32 instruction is transformed into 16-bit instruction subu16
Differential Revision: https://reviews.llvm.org/D15144

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

7 years ago[SystemZ] Remove incorrect assert in SystemZTTIImpl
Jonas Paulsson [Thu, 27 Apr 2017 11:01:18 +0000 (11:01 +0000)]
[SystemZ]  Remove incorrect assert in SystemZTTIImpl

In getCmpSelInstrCost(), CondTy may actually be scalar while ValTy is a
vector when LoopVectorizer is the caller. Therefore the assert that CondTy
must be a vector type if ValTy is was wrong and is now removed.

Review: Ulrich Weigand

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

7 years ago[ARM] GlobalISel: Fix extended stack operands
Diana Picus [Thu, 27 Apr 2017 10:23:30 +0000 (10:23 +0000)]
[ARM] GlobalISel: Fix extended stack operands

Fix a crash when trying to extend a value passed as a sign- or
zero-extended stack parameter. The cause of the crash was that we were
setting the size of the loaded value to 32 bits, and then tyring to
extend again to 32 bits.

This patch addresses the issue by also introducing a G_TRUNC after the
load. This will leave the unused bits to their original values set by
the caller, while being consistent about the types. For values that are
not extended, we just use a smaller load.

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

7 years ago2 tests that were lost in rL301390
Andrew V. Tischenko [Thu, 27 Apr 2017 10:20:35 +0000 (10:20 +0000)]
2 tests that were lost in rL301390

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

7 years ago[llvm-dwarfdump] - Change format for .gdb_index dump.
George Rimar [Thu, 27 Apr 2017 10:00:13 +0000 (10:00 +0000)]
[llvm-dwarfdump] - Change format for .gdb_index dump.

It is useful to output size of ranges when address ranges
section of .gdb_index is dumped.

It helps to compare outputs produced by different linkers,
for example. In that case address ranges can look very different,
when they are the same at fact. Difference comes from different
low address because of different address of .text.

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

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

7 years ago[GlobalISel][X86] handle not symmetric G_COPY
Igor Breger [Thu, 27 Apr 2017 08:02:03 +0000 (08:02 +0000)]
[GlobalISel][X86] handle not symmetric G_COPY

Summary: handle not symmetric G_COPY

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, llvm-commits, kristof.beyls

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

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

7 years ago[CodeGen][NFC] Rename 'Src' to 'Val'.
Clement Courbet [Thu, 27 Apr 2017 07:22:30 +0000 (07:22 +0000)]
[CodeGen][NFC] Rename 'Src' to 'Val'.

'Src' looks like it was borrowed from memcpy, 'Val' makes more sense for
memset and is consistent with naming within the function.

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

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

7 years agoUse accessors for ValueHandleBase::V; NFC
Sanjoy Das [Thu, 27 Apr 2017 06:02:18 +0000 (06:02 +0000)]
Use accessors for ValueHandleBase::V; NFC

This changes code that touches ValueHandleBase::V to go through
getValPtr and (newly added) setValPtr.  This functionality will be
used later, but also seemed like a generally good cleanup.

I also renamed the field to Val, but that's just to make it obvious
that I fixed all the uses.

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

7 years ago[Metadata] Fix typos in comments. NFC
Craig Topper [Thu, 27 Apr 2017 05:48:29 +0000 (05:48 +0000)]
[Metadata] Fix typos in comments. NFC

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

7 years ago[InstCombine] Use APInt bit counting methods to avoid a temporary APInt. NFC
Craig Topper [Thu, 27 Apr 2017 04:51:25 +0000 (04:51 +0000)]
[InstCombine] Use APInt bit counting methods to avoid a temporary APInt. NFC

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

7 years agoMake StringSaver::save less ambiguous.
Rui Ueyama [Thu, 27 Apr 2017 03:45:33 +0000 (03:45 +0000)]
Make StringSaver::save less ambiguous.

Previously, an expression such as Saver.save(std::string("foo") + "bar")
didn't compile because there is an ambiguity as to whether the argument
is of const Twine& or StringRef.

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

7 years agoAMDGPU: Fix assert in scheduler
Konstantin Zhuravlyov [Thu, 27 Apr 2017 03:22:44 +0000 (03:22 +0000)]
AMDGPU: Fix assert in scheduler

Assert is triggered if DBG_VALUE is first instruction in BB

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

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

7 years ago[Support] Fix overflow in SLEB128 decoding.
Ahmed Bougacha [Thu, 27 Apr 2017 02:09:44 +0000 (02:09 +0000)]
[Support] Fix overflow in SLEB128 decoding.

decodeULEB128 was fixed in r216268, but decodeSLEB128 always had the
same issue, which is now exposed in r301369.

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

7 years ago[Support] clang-format LEB128.h. NFC.
Ahmed Bougacha [Thu, 27 Apr 2017 02:09:42 +0000 (02:09 +0000)]
[Support] clang-format LEB128.h. NFC.

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

7 years agoDisable GVN Hoist due to still more bugs being found in it. There is
Chandler Carruth [Thu, 27 Apr 2017 00:28:03 +0000 (00:28 +0000)]
Disable GVN Hoist due to still more bugs being found in it. There is
also a discussion about exactly what we should do prior to re-enabling
it.

The current bug is http://llvm.org/PR32821 and the discussion about this
is in the review thread for r300200.

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

7 years agoTurn DISubprogram into a variable-length node.
Adrian Prantl [Wed, 26 Apr 2017 23:59:52 +0000 (23:59 +0000)]
Turn DISubprogram into a variable-length node.

DISubprogram currently has 10 pointer operands, several of which are
often nullptr. This patch reduces the amount of memory allocated by
DISubprogram by rearranging the operands such that containing type,
template params, and thrown types come last, and are only allocated
when they are non-null (or followed by non-null operands).

This patch also eliminates the entirely unused DisplayName operand.

This saves up to 4 pointer operands per DISubprogram. (I tried
measuring the effect on peak memory usage on an LTO link of an X86
llc, but the results were very noisy).

This reapplies r301498 with an attempted workaround for g++.

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

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

7 years agoRevert "Turn DISubprogram into a variable-length node."
Adrian Prantl [Wed, 26 Apr 2017 23:49:30 +0000 (23:49 +0000)]
Revert "Turn DISubprogram into a variable-length node."

This reverts commit r301498 while investigating bot breakage.

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

7 years agoTurn DISubprogram into a variable-length node.
Adrian Prantl [Wed, 26 Apr 2017 23:44:54 +0000 (23:44 +0000)]
Turn DISubprogram into a variable-length node.

DISubprogram currently has 10 pointer operands, several of which are
often nullptr. This patch reduces the amount of memory allocated by
DISubprogram by rearranging the operands such that containing type,
template params, and thrown types come last, and are only allocated
when they are non-null (or followed by non-null operands).

This patch also eliminates the entirely unused DisplayName operand.

This saves up to 4 pointer operands per DISubprogram. (I tried
measuring the effect on peak memory usage on an LTO link of an X86
llc, but the results were very noisy).

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

7 years agoMachineFrameInfo.h: Remove unnecessary forward declarations; NFC
Matthias Braun [Wed, 26 Apr 2017 23:37:04 +0000 (23:37 +0000)]
MachineFrameInfo.h: Remove unnecessary forward declarations; NFC

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

7 years agoLanai: Remove unnecessary canRealignStack() override; NFC
Matthias Braun [Wed, 26 Apr 2017 23:37:01 +0000 (23:37 +0000)]
Lanai: Remove unnecessary canRealignStack() override; NFC

It was doing the same as the base implementation and was irritating me
when I was searching for backends that have custom behavior for
canRealignStack.

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

7 years agoMachineFrameInfo: Move implementation to an own file; NFC
Matthias Braun [Wed, 26 Apr 2017 23:36:58 +0000 (23:36 +0000)]
MachineFrameInfo: Move implementation to an own file; NFC

Move implementation of the MachineFrameInfo class into
MachineFrameInfo.cpp

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

7 years agoRevert r301487: Replace HashString algorithm with xxHash64
Rui Ueyama [Wed, 26 Apr 2017 23:15:10 +0000 (23:15 +0000)]
Revert r301487: Replace HashString algorithm with xxHash64

This reverts commit r301487 to make buildbots green.

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

7 years agoAdd support for DW_TAG_thrown_type.
Adrian Prantl [Wed, 26 Apr 2017 22:56:44 +0000 (22:56 +0000)]
Add support for DW_TAG_thrown_type.

For Swift we would like to be able to encode the error types that a
function may throw, so the debugger can display them alongside the
function's return value when finish-ing a function.

DWARF defines DW_TAG_thrown_type (intended to be used for C++ throw()
declarations) that is a perfect fit for this purpose. This patch wires
up support for DW_TAG_thrown_type in LLVM by adding a list of thrown
types to DISubprogram.

To offset the cost of the extra pointer, there is a follow-up patch
that turns DISubprogram into a variable-length node.

rdar://problem/29481673

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

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

7 years agoReplace HashString algorithm with xxHash64
Rui Ueyama [Wed, 26 Apr 2017 22:45:04 +0000 (22:45 +0000)]
Replace HashString algorithm with xxHash64

The previous algorithm processed one character at a time, which is very
painful on a modern CPU. Replace it with xxHash64, which both already
exists in the codebase and is fairly fast.

Patch from Scott Smith!

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

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

7 years ago[MC] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Wed, 26 Apr 2017 22:31:39 +0000 (22:31 +0000)]
[MC] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

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

7 years ago[LibCallsShrinkWrap] Remove an unnecessary class member variable.
Davide Italiano [Wed, 26 Apr 2017 21:28:40 +0000 (21:28 +0000)]
[LibCallsShrinkWrap] Remove an unnecessary class member variable.

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

7 years ago[LibCallsShrinkWrap] More descriptive assertion messages.
Davide Italiano [Wed, 26 Apr 2017 21:21:02 +0000 (21:21 +0000)]
[LibCallsShrinkWrap] More descriptive assertion messages.

Fix a typo while I'm here.

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

7 years ago[LibCallsShrinkWrap] Remove some temporary cl::opt(s).
Davide Italiano [Wed, 26 Apr 2017 21:19:05 +0000 (21:19 +0000)]
[LibCallsShrinkWrap] Remove some temporary cl::opt(s).

The pass has been on and working for a while.

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

7 years ago[LibCallsShrinkWrap] Teach the pass how to preserve the dominator.
Davide Italiano [Wed, 26 Apr 2017 21:05:40 +0000 (21:05 +0000)]
[LibCallsShrinkWrap] Teach the pass how to preserve the dominator.

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

7 years agoKill the old Simplify* APIs, leave SimplifyInstruction for the moment
Daniel Berlin [Wed, 26 Apr 2017 20:56:17 +0000 (20:56 +0000)]
Kill the old Simplify* APIs, leave SimplifyInstruction for the moment

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

7 years agoNewGVN: Use new SimplifyQuery based API
Daniel Berlin [Wed, 26 Apr 2017 20:56:14 +0000 (20:56 +0000)]
NewGVN: Use new SimplifyQuery based API

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

7 years agoPHITransAddr: Use new SimplifyQuery based API.
Daniel Berlin [Wed, 26 Apr 2017 20:56:13 +0000 (20:56 +0000)]
PHITransAddr: Use new SimplifyQuery based API.

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

7 years agoInstCombine: Use the new SimplifyQuery versions of Simplify*. Use AssumptionCache...
Daniel Berlin [Wed, 26 Apr 2017 20:56:07 +0000 (20:56 +0000)]
InstCombine: Use the new SimplifyQuery versions of Simplify*. Use AssumptionCache, DominatorTree, TargetLibraryInfo everywhere.

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

7 years ago[DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)
Sanjay Patel [Wed, 26 Apr 2017 20:26:46 +0000 (20:26 +0000)]
[DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)

Besides better codegen, the motivation is to be able to canonicalize this pattern
in IR (currently we don't) knowing that the backend is prepared for that.

This may also allow removing code for special constant cases in
DAGCombiner::foldSelectOfConstants() that was added in D30180.

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

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

7 years ago[AMDGPU][MC] Added arg checks for vmcnt, expcnt, lgkmcnt helpers
Dmitry Preobrazhensky [Wed, 26 Apr 2017 17:55:50 +0000 (17:55 +0000)]
[AMDGPU][MC] Added arg checks for vmcnt, expcnt, lgkmcnt helpers

Summary of changes:
- corrected vmcnt, expcnt, lgkmcnt helpers to checks their argument for truncation;
- added saturated versions of these helpers.

See bug 32711 for details: https://bugs.llvm.org//show_bug.cgi?id=32711

Reviewers: artem.tamazov, vpykhtin

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

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

7 years agoLTO: Mark undefined module asm symbols as used.
Peter Collingbourne [Wed, 26 Apr 2017 17:53:39 +0000 (17:53 +0000)]
LTO: Mark undefined module asm symbols as used.

Marking them as used causes them to be considered visible outside of LTO. This
prevents the symbols from being internalized or discarded, either by GlobalDCE
or by summary-based dead stripping in ThinLTO.

This change makes it unnecessary to add these symbols to llvm.compiler.used
in the backend, as the symbols are kept alive by virtue of being external,
so remove the backend code that handles that.

Fixes PR32798.

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

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

7 years agoCorrelatedValuePropagation: Rename a variable for consistency
Daniel Berlin [Wed, 26 Apr 2017 17:41:46 +0000 (17:41 +0000)]
CorrelatedValuePropagation: Rename a variable for consistency

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

7 years ago[ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits
Craig Topper [Wed, 26 Apr 2017 16:39:58 +0000 (16:39 +0000)]
[ValueTracking] Introduce a KnownBits struct to wrap the two APInts for computeKnownBits

This patch introduces a new KnownBits struct that wraps the two APInt used by computeKnownBits. This allows us to treat them as more of a unit.

Initially I've just altered the signatures of computeKnownBits and InstCombine's simplifyDemandedBits to pass a KnownBits reference instead of two separate APInt references. I'll do similar to the SelectionDAG version of computeKnownBits/simplifyDemandedBits as a separate patch.

I've added a constructor that allows initializing both APInts to the same bit width with a starting value of 0. This reduces the repeated pattern of initializing both APInts. Once place default constructed the APInts so I added a default constructor for those cases.

Going forward I would like to add more methods that will work on the pairs. For example trunc, zext, and sext occur on both APInts together in several places. We should probably add a clear method that can be used to clear both pieces. Maybe a method to check for conflicting information. A method to return (Zero|One) so we don't write it out everywhere. Maybe a method for (Zero|One).isAllOnesValue() to determine if all bits are known. I'm sure there are many other methods we can come up with.

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

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

7 years agoReverts commit r301424, r301425 and r301426
Sanjoy Das [Wed, 26 Apr 2017 16:37:05 +0000 (16:37 +0000)]
Reverts commit r301424, r301425 and r301426

Commits were:

"Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts"
"Add a new WeakVH value handle; NFC"
"Rename WeakVH to WeakTrackingVH; NFC"

The changes assumed pointers are 8 byte aligned on all architectures.

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

7 years ago[LV] Handle external uses of floating-point induction variables
Matthew Simpson [Wed, 26 Apr 2017 16:23:02 +0000 (16:23 +0000)]
[LV] Handle external uses of floating-point induction variables

Reference: https://bugs.llvm.org/show_bug.cgi?id=32758
Differential Revision: https://reviews.llvm.org/D32445

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

7 years agoUse WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts
Sanjoy Das [Wed, 26 Apr 2017 16:21:02 +0000 (16:21 +0000)]
Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts

Summary:
In cases where an instruction (a call site, say) is RAUW'ed with some
other value (this is possible via the `returned` attribute, amongst
other things), we want the slot in UnknownInsts to point to the
original Instruction we wanted to track, not the value it got replaced
by.

Fixes PR32587.

Reviewers: davide

Subscribers: mcrosier, llvm-commits

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

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

7 years agoAdd a new WeakVH value handle; NFC
Sanjoy Das [Wed, 26 Apr 2017 16:20:59 +0000 (16:20 +0000)]
Add a new WeakVH value handle; NFC

Summary:
WeakVH nulls itself out if the value it was tracking gets deleted, but
it does not track RAUW.

Reviewers: dblaikie, davide

Subscribers: mcrosier, llvm-commits

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

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

7 years agoRename WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Wed, 26 Apr 2017 16:20:52 +0000 (16:20 +0000)]
Rename WeakVH to WeakTrackingVH; NFC

Summary:
I plan to use WeakVH to mean "nulls itself out on deletion, but does
not track RAUW" in a subsequent commit.

Reviewers: dblaikie, davide

Reviewed By: davide

Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle

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

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

7 years ago[globalisel][tablegen] Fix vector element size
Igor Breger [Wed, 26 Apr 2017 15:59:05 +0000 (15:59 +0000)]
[globalisel][tablegen] Fix vector element size

Summary: Fix vector element size.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: rovka, llvm-commits, kristof.beyls

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

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

7 years ago[sampleprof] Drop test dependency on the string hash func (NFC)
Vedant Kumar [Wed, 26 Apr 2017 15:39:53 +0000 (15:39 +0000)]
[sampleprof] Drop test dependency on the string hash func (NFC)

The SampleProfWriter emits function information in an order determined
by the string hash function. The situation is a bit brittle, because
changing the hash function can break the tests.

Instead of sorting the function samples to get a relaible ordering (that
might be too expensive), make the tests not depend on a particular
ordering of function samples.

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

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

7 years ago[AMDGPU][MC] Added check for truncation of SOPK imm operand
Dmitry Preobrazhensky [Wed, 26 Apr 2017 15:34:19 +0000 (15:34 +0000)]
[AMDGPU][MC] Added check for truncation of SOPK imm operand

See bug 30827: https://bugs.llvm.org//show_bug.cgi?id=30827

Reviewers: artem.tamazov, vpykhtin

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

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

7 years ago[AVR] Remove an unused local variable
Dylan McKay [Wed, 26 Apr 2017 14:47:27 +0000 (14:47 +0000)]
[AVR] Remove an unused local variable

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

7 years ago[x86] change tests to use sext, not zext; NFC
Sanjay Patel [Wed, 26 Apr 2017 14:35:54 +0000 (14:35 +0000)]
[x86] change tests to use sext, not zext; NFC

These are intended to exercise D31944, so we need sexts.

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

7 years agoFix unused-variable warning caused by r301407.
Haojian Wu [Wed, 26 Apr 2017 14:31:05 +0000 (14:31 +0000)]
Fix unused-variable warning caused by r301407.

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

7 years ago[TargetLowering] fix isConstTrueVal to account for build vector truncation
Sanjay Patel [Wed, 26 Apr 2017 14:05:42 +0000 (14:05 +0000)]
[TargetLowering] fix isConstTrueVal to account for build vector truncation

Build vectors have magical truncation powers, so we have things like this:

v4i1 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>
v4i16 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>

If we don't truncate the splat node returned by getConstantSplatNode(), then we won't find
truth when ZeroOrNegativeOneBooleanContent is the rule.

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

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

7 years agoConvert LoopRotation to use SimplifyQuery version of SimplifyInstruction. Add Assumpt...
Daniel Berlin [Wed, 26 Apr 2017 13:52:18 +0000 (13:52 +0000)]
Convert LoopRotation to use SimplifyQuery version of SimplifyInstruction. Add AssumptionCache, DominatorTree, TLI if available.

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

7 years agoConvert SimplifyInstructions to use the SimplifyQuery version of SimplifyInstruction
Daniel Berlin [Wed, 26 Apr 2017 13:52:16 +0000 (13:52 +0000)]
Convert SimplifyInstructions to use the SimplifyQuery version of SimplifyInstruction

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

7 years agoConvert CVP to use SimplifyQuery version of SimplifyInstruction. Add AssumptionCache...
Daniel Berlin [Wed, 26 Apr 2017 13:52:13 +0000 (13:52 +0000)]
Convert CVP to use SimplifyQuery version of SimplifyInstruction. Add AssumptionCache, DominatorTree, TLI if available.

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

7 years agoFix signed multiplication with overflow fallback.
Ranjeet Singh [Wed, 26 Apr 2017 13:41:43 +0000 (13:41 +0000)]
Fix signed multiplication with overflow fallback.

For targets that don't have ISD::MULHS or ISD::SMUL_LOHI for the type
and the double width type is illegal, then the two operands are
sign extended to twice their size then multiplied to check for overflow.
The extended upper halves were mismatched causing an incorrect result.
This fixes the mismatch.

A test was added for ARM V6-M where the bug was detected.

Patch by James Duley.

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

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

7 years ago[DAG] add FIXME comments for splat detection; NFC
Sanjay Patel [Wed, 26 Apr 2017 13:27:57 +0000 (13:27 +0000)]
[DAG] add FIXME comments for splat detection; NFC

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

7 years ago[X86] Added pointer math zext test case (PR22970)
Simon Pilgrim [Wed, 26 Apr 2017 13:03:00 +0000 (13:03 +0000)]
[X86] Added pointer math zext test case (PR22970)

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

7 years ago[X86][SSE] Add test case for repeated vector insertions of the same element (PR15298)
Simon Pilgrim [Wed, 26 Apr 2017 12:23:32 +0000 (12:23 +0000)]
[X86][SSE] Add test case for repeated vector insertions of the same element (PR15298)

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

7 years agoSimplify the CFG after loop pass cleanup.
Filipe Cabecinhas [Wed, 26 Apr 2017 12:02:41 +0000 (12:02 +0000)]
Simplify the CFG after loop pass cleanup.

Summary:
Otherwise we might end up with some empty basic blocks or
single-entry-single-exit basic blocks.

This fixes PR32085

Reviewers: chandlerc, danielcdh

Subscribers: mehdi_amini, RKSimon, llvm-commits

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

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

7 years ago[mips] Fix test mips64fpldst.ll with machine verifier enabled
Sagar Thakur [Wed, 26 Apr 2017 11:40:12 +0000 (11:40 +0000)]
[mips] Fix test mips64fpldst.ll with machine verifier enabled

Removed micro mips register classes for gp initialization because gp initialization uses pure mips64 instruction. Even when compiling for micro mips, gp initialization can be done with pure mips64 instructions.

Reviewed by Simon Dardis
Differential: D32286

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

7 years ago[X86] Add missing mayLoad/mayStore attributes to some X86 instructions (Continue)
Ayman Musa [Wed, 26 Apr 2017 11:34:09 +0000 (11:34 +0000)]
[X86] Add missing mayLoad/mayStore attributes to some X86 instructions (Continue)

Complete the patch committed in rL300190.

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

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

7 years ago[mips] Rework a portion of MipsCC interface. (NFC)
Simon Dardis [Wed, 26 Apr 2017 11:10:38 +0000 (11:10 +0000)]
[mips] Rework a portion of MipsCC interface. (NFC)

r299766 contained a "conditional move or jump depends on uninitialized value"
fault, identified by valgrind. This occurred as MipsFastISel::finishCall(..)
used CCState over MipsCCState. The latter is required for the TableGen'd calling
convention logic due to reliance on pre-analyzing type information to lower call
results/returns of vectors correctly.

This change modifies the MipsCC AnalyzeCallResult to be useful with both the
SelectionDAG and FastISel lowering logic.

Reviewers: slthakur

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

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

7 years agoPR31007 and PR27884 will be closed: a possibility to compile constants like 0bH is...
Andrew V. Tischenko [Wed, 26 Apr 2017 09:56:59 +0000 (09:56 +0000)]
PR31007 and PR27884 will be closed: a possibility to compile constants like 0bH is now supported in MS asm.

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

7 years ago[X86][SSE2] Fix asm string for movq (Move Quadword) instruction.
Ayman Musa [Wed, 26 Apr 2017 07:08:44 +0000 (07:08 +0000)]
[X86][SSE2] Fix asm string for movq (Move Quadword) instruction.

Replace "mov{d|q}" with "movq".

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

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

7 years ago[InstCombine] Add test cases for opportunities to improve knownbits handling for...
Craig Topper [Wed, 26 Apr 2017 05:59:19 +0000 (05:59 +0000)]
[InstCombine] Add test cases for opportunities to improve knownbits handling for cttz and ctlz intrinsics.

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

7 years agoRemove tailing whitespaces.
Michael Liao [Wed, 26 Apr 2017 05:27:20 +0000 (05:27 +0000)]
Remove tailing whitespaces.

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

7 years agoInstructionSimplify: Use braced initializer list for SimplifyQuery creation
Daniel Berlin [Wed, 26 Apr 2017 04:10:02 +0000 (04:10 +0000)]
InstructionSimplify: Use braced initializer list for SimplifyQuery creation

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

7 years agoInstructionSimplify: Have SimplifyFPBinOp pass FastMathFlags by value, like we do...
Daniel Berlin [Wed, 26 Apr 2017 04:10:00 +0000 (04:10 +0000)]
InstructionSimplify: Have SimplifyFPBinOp pass FastMathFlags by value, like we do everywhere else

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

7 years agoInstructionSimplify: End our long national nightmare of ever-growing Simplify* arguments.
Daniel Berlin [Wed, 26 Apr 2017 04:09:56 +0000 (04:09 +0000)]
InstructionSimplify: End our long national nightmare of ever-growing Simplify* arguments.

Summary:
Expose the internal query structure, start using it.

Note: This is the most minimal change possible i could create.  I have
trivial followups, like fixing the one use of const FastMathFlags &,
the renaming of CtxI to be consistent, etc.

This should be NFC.

Reviewers: majnemer, davide

Subscribers: llvm-commits

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

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

7 years ago[XRay][tools] Remove wayward semicolon (NFC)
Dean Michael Berris [Wed, 26 Apr 2017 03:49:49 +0000 (03:49 +0000)]
[XRay][tools] Remove wayward semicolon (NFC)

Follow-up to D29320.

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

7 years ago[XRay][tools] Fixup definition for stat division.
Dean Michael Berris [Wed, 26 Apr 2017 01:35:23 +0000 (01:35 +0000)]
[XRay][tools] Fixup definition for stat division.

Copy-pasta error.

Follow-up to D29320.

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

7 years ago[AMDGPU] Garbage collect dead code. NFCI.
Davide Italiano [Wed, 26 Apr 2017 01:00:52 +0000 (01:00 +0000)]
[AMDGPU] Garbage collect dead code. NFCI.

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

7 years ago[Support] Avoid UB in sys::fs::perms::operator~. NFC.
Ahmed Bougacha [Wed, 26 Apr 2017 00:48:28 +0000 (00:48 +0000)]
[Support] Avoid UB in sys::fs::perms::operator~. NFC.

This was exposed in r297945 and r301220: the intermediate complement
is a 32-bit value, and casting it to 'perms' invokes UB.

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