oota-llvm.git
8 years agoFix build after r255319.
Hans Wennborg [Fri, 11 Dec 2015 00:58:32 +0000 (00:58 +0000)]
Fix build after r255319.

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

8 years agoFix a spurious if.
Eric Christopher [Fri, 11 Dec 2015 00:51:59 +0000 (00:51 +0000)]
Fix a spurious if.

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

8 years ago[LazyValueInfo] Stop inserting overdefined values into ValueCache to
Akira Hatanaka [Fri, 11 Dec 2015 00:49:47 +0000 (00:49 +0000)]
[LazyValueInfo] Stop inserting overdefined values into ValueCache to
reduce memory usage.

Previously, LazyValueInfoCache inserted overdefined lattice values into
both ValueCache and OverDefinedCache. This wasn't necessary and was
causing LazyValueInfo to use an excessive amount of memory in some cases.

This patch changes LazyValueInfoCache to insert overdefined values only
into OverDefinedCache. The memory usage decreases by 70 to 75% when one
of the files in llvm is compiled.

rdar://problem/11388615

Differential revision: http://reviews.llvm.org/D15391

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

8 years ago[PPC]: Peephole optimize small accesss to aligned globals.
Kyle Butt [Fri, 11 Dec 2015 00:47:36 +0000 (00:47 +0000)]
[PPC]: Peephole optimize small accesss to aligned globals.

Access to aligned globals gives us a chance to peephole optimize nonzero
offsets. If a struct is 4 byte aligned, then accesses to bytes 0-3 won't
overflow the available displacement. For example:
        addis 3, 2, b4v@toc@ha
        addi 4, 3, b4v@toc@l
        lbz 5, b4v@toc@l(3) ; This is the result of the current peephole
        lbz 6, 1(4)         ; optimizer
        lbz 7, 2(4)
        lbz 8, 3(4)
If b4v is 4-byte aligned, we can skip using register 4 because we know
that b4v@toc@l+{1,2,3} won't overflow 32K, and instead generate:
        addis 3, 2, b4v@toc@ha
        lbz 4, b4v@toc@l(3)
        lbz 5, b4v@toc@l+1(3)
        lbz 6, b4v@toc@l+2(3)
        lbz 7, b4v@toc@l+3(3)
Saving a register and an addition.
Larger alignments allow larger structures/arrays to be optimized.

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

8 years agoCheck in the script for building Win snapshots
Hans Wennborg [Fri, 11 Dec 2015 00:43:42 +0000 (00:43 +0000)]
Check in the script for building Win snapshots

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

8 years ago[ProfileData] clang-format TextInstrProfReader::hasFormat. NFC.
Vedant Kumar [Fri, 11 Dec 2015 00:40:05 +0000 (00:40 +0000)]
[ProfileData] clang-format TextInstrProfReader::hasFormat. NFC.

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

8 years ago[X86][SSE] Update the cost table for integer-integer conversions on SSE2/SSE4.1.
Cong Hou [Fri, 11 Dec 2015 00:31:39 +0000 (00:31 +0000)]
[X86][SSE] Update the cost table for integer-integer conversions on SSE2/SSE4.1.

Previously in the conversion cost table there are no entries for integer-integer
conversions on SSE2. This will result in imprecise costs for certain vectorized
operations. This patch adds those entries for SSE2 and SSE4.1. The cost numbers
are counted from the result of running llc on the new test case in this patch.

Differential revision: http://reviews.llvm.org/D15132

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

8 years agoFormat fix (NFC)
Xinliang David Li [Thu, 10 Dec 2015 23:48:05 +0000 (23:48 +0000)]
Format fix (NFC)

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

8 years agos/need/needs
Eric Christopher [Thu, 10 Dec 2015 22:29:26 +0000 (22:29 +0000)]
s/need/needs

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

8 years agoFix (bitcast (fabs x)), (bitcast (fneg x)) and (bitcast (fcopysign cst,
Eric Christopher [Thu, 10 Dec 2015 22:09:06 +0000 (22:09 +0000)]
Fix (bitcast (fabs x)), (bitcast (fneg x)) and (bitcast (fcopysign cst,
x)) combines for ppc_fp128, since signbit computation is more
complicated.

Discussion thread:
http://lists.llvm.org/pipermail/llvm-dev/2015-November/092863.html

Patch by Tim Shen!

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

8 years agoAttempt to fix the ReST compilation to html of the C API docs.
Eric Christopher [Thu, 10 Dec 2015 22:04:11 +0000 (22:04 +0000)]
Attempt to fix the ReST compilation to html of the C API docs.

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

8 years agoMore non-ascii quote characters.
Eric Christopher [Thu, 10 Dec 2015 21:47:38 +0000 (21:47 +0000)]
More non-ascii quote characters.

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

8 years agoClarify some of the wording on adding a new subcomponent to the
Eric Christopher [Thu, 10 Dec 2015 21:46:24 +0000 (21:46 +0000)]
Clarify some of the wording on adding a new subcomponent to the
C API.

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

8 years agoFix non-ascii quotes.
Eric Christopher [Thu, 10 Dec 2015 21:38:56 +0000 (21:38 +0000)]
Fix non-ascii quotes.

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

8 years agoAdd C API guidelines to the developer policy to match discussions
Eric Christopher [Thu, 10 Dec 2015 21:33:53 +0000 (21:33 +0000)]
Add C API guidelines to the developer policy to match discussions
on the llvm mailing lists.

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

8 years agoPPC: Teach FMA mutate to respect register classes.
Kyle Butt [Thu, 10 Dec 2015 21:28:40 +0000 (21:28 +0000)]
PPC: Teach FMA mutate to respect register classes.

This was causing bad code gen and assembly that won't assemble, as
mixed altivec and vsx code would end up with a vsx high register
assigned to an altivec instruction, which won't work. Constraining the
classes allows the optimization to proceed.

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

8 years ago[CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with -fprofile-instr...
Chris Bieneman [Thu, 10 Dec 2015 21:19:07 +0000 (21:19 +0000)]
[CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with -fprofile-instr-generate

This is the first step in supporting PGO data generation via CMake. I've marked the option as advanced and experimental until it is fleshed out further.

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

8 years ago[LibFuzzer] Introducing FUZZER_FLAG_UNSIGNED and using it for seeding.
Mike Aizatsky [Thu, 10 Dec 2015 20:41:53 +0000 (20:41 +0000)]
[LibFuzzer] Introducing FUZZER_FLAG_UNSIGNED and using it for seeding.

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

done

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

8 years agoEarlyCSE: add tests
JF Bastien [Thu, 10 Dec 2015 20:24:34 +0000 (20:24 +0000)]
EarlyCSE: add tests

Summary: As a follow-up to rL255054 I wasn't able to convince myself that the code did what I thought, so I wrote more tests.

Reviewers: reames

Subscribers: llvm-commits

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

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

8 years agoAdd a forward declaration (NFC)
Xinliang David Li [Thu, 10 Dec 2015 20:13:41 +0000 (20:13 +0000)]
Add a forward declaration (NFC)

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

8 years agoDelete a duplicate branch in IfConversion.cpp. NFC.
Cong Hou [Thu, 10 Dec 2015 19:57:22 +0000 (19:57 +0000)]
Delete a duplicate branch in IfConversion.cpp. NFC.

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

8 years ago[DAGCombiner] Fix PR25763 - vector comparison constant folding + sign-extension
Simon Pilgrim [Thu, 10 Dec 2015 19:47:06 +0000 (19:47 +0000)]
[DAGCombiner] Fix PR25763 - vector comparison constant folding + sign-extension

PR25763 demonstrated an issue with D14683 - vector comparison constant folding only works for i1 results, so we need to split off the sign-extension of the result to the required type. Luckily this can be done with the existing type legalization code.

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

8 years ago[DSE] Disable non-local DSE to see if the bots go green.
Chad Rosier [Thu, 10 Dec 2015 19:23:02 +0000 (19:23 +0000)]
[DSE] Disable non-local DSE to see if the bots go green.

I see a few bots timing out, so I'm speculatively disabling r255247.

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

8 years agoFix another case where the linkage was not set.
Rafael Espindola [Thu, 10 Dec 2015 18:44:26 +0000 (18:44 +0000)]
Fix another case where the linkage was not set.

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

8 years ago[PGO] Use %t as the temporary profdata filename in the test cases.
Rong Xu [Thu, 10 Dec 2015 18:24:44 +0000 (18:24 +0000)]
[PGO] Use %t as the temporary profdata filename in the test cases.

Using %t rather %T/<specific_name> as the temporary profdata filename.

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

8 years agoVerifier: Avoid quadratic checking of aggregates for bad bitcasts
Duncan P. N. Exon Smith [Thu, 10 Dec 2015 17:56:06 +0000 (17:56 +0000)]
Verifier: Avoid quadratic checking of aggregates for bad bitcasts

Avoid O(N^2) behaviour when checking for bad bitcasts in `ConstantExpr`s
buried inside of aggregate initializers to `GlobalVariable`s.  I've:
- centralized the "visited" set for recursing through `ConstantExpr`s so
  that expressions are only visited once per Verifier run,
- removed the duplicate logic for the stack visit, and
- avoided recursing into other `GlobalValue`s.

This recovers roughly a 100x time difference in clang compiles of a
particular input file (filled with large cross-referencing tables) that
depends on whether `-disable-llvm-verifier` is on.  This slowdown was
caused by r187506, which introduced these checks.

Now, avoiding `-disable-llvm-verifier` only causes a 2x slowdown for
this case.

(Interestingly, dumping the textual IR for this file starts at least
50GB of global variable initializers (I don't know the total, since I
killed the dump)...)

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

8 years ago[DeadStoreElimination] Use range-based loops. NFC.
Chad Rosier [Thu, 10 Dec 2015 17:27:18 +0000 (17:27 +0000)]
[DeadStoreElimination] Use range-based loops. NFC.

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

8 years ago[ProfileData] Add unit test infrastructure for sample profile reader/writer
Nathan Slingerland [Thu, 10 Dec 2015 17:21:42 +0000 (17:21 +0000)]
[ProfileData] Add unit test infrastructure for sample profile reader/writer

Summary:
Adds support for in-memory round-trip of sample profile data along with basic
round trip unit tests. This will also make it easier to include unit tests for
future changes to sample profiling.

Reviewers: davidxl, dnovillo, silvas

Subscribers: llvm-commits

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

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

8 years agoFix fptosi, fptoui from f16 vectors to i8, i16 vectors
Pirama Arumuga Nainar [Thu, 10 Dec 2015 17:16:49 +0000 (17:16 +0000)]
Fix fptosi, fptoui from f16 vectors to i8, i16 vectors

Summary:
Convert f16 vectors to corresponding f32 vectors before doing the
conversion to int.

Add tests for v4f16, v8f16.

Reviewers: ab, jmolloy

Subscribers: llvm-commits, srhines

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

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

8 years ago[InstCombine] fold bitcasts around an extractelement (3rd try)
Sanjay Patel [Thu, 10 Dec 2015 17:09:28 +0000 (17:09 +0000)]
[InstCombine] fold bitcasts around an extractelement (3rd try)

This is a redo of r255137 (reverted at r255227) which was a redo of
r255124 (reverted at r255126) with a fixed check for a scalar source
type and an added test for the failure that caused the revert.

Original commit message:

Example:
  bitcast (extractelement (bitcast <2 x float> %X to <2 x i32>), 1) to float
    --->
  extractelement <2 x float> %X, i32 1

This is part of fixing PR25543:
https://llvm.org/bugs/show_bug.cgi?id=25543

The next step will be to generalize this fold:
trunc ( lshr ( bitcast X) ) -> extractelement (X)

Ie, I'm hoping to replace the existing transform of:
bitcast ( trunc ( lshr ( bitcast X)))
added by:
http://reviews.llvm.org/rL112232

with 2 less specific transforms to catch the case in the bug report.

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

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

8 years ago[ThinLTO] Debug message cleanup (NFC)
Teresa Johnson [Thu, 10 Dec 2015 16:39:07 +0000 (16:39 +0000)]
[ThinLTO] Debug message cleanup (NFC)

Added some missing spaces between the module identifier and the start of
the debug message. Also added a ":" after the module identifier to make
this look a little nicer.

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

8 years agoAvoid undefined behavior when vector is empty.
Rafael Espindola [Thu, 10 Dec 2015 16:35:06 +0000 (16:35 +0000)]
Avoid undefined behavior when vector is empty.

Found by ubsan.

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

8 years agoremove duplicated comments and don't repeat function names in comments; NFC
Sanjay Patel [Thu, 10 Dec 2015 16:34:21 +0000 (16:34 +0000)]
remove duplicated comments and don't repeat function names in comments; NFC

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

8 years ago[ThinLTO] Release files in gold plugin during combined index (take 2)
Teresa Johnson [Thu, 10 Dec 2015 16:11:23 +0000 (16:11 +0000)]
[ThinLTO] Release files in gold plugin during combined index (take 2)

Ensure we release the files even when they don't hold a function index
summary section, by restructuring the control flow a little bit.

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

8 years ago[WebAssembly] Tighten up several CHECK tests.
Dan Gohman [Thu, 10 Dec 2015 14:52:34 +0000 (14:52 +0000)]
[WebAssembly] Tighten up several CHECK tests.

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

8 years agoSlit lib/Linker in two.
Rafael Espindola [Thu, 10 Dec 2015 14:19:35 +0000 (14:19 +0000)]
Slit lib/Linker in two.

A linker normally has two stages: symbol resolution and "moving stuff".

In lib/Linker there is the complication of lazy linking some globals,
but it was still far more mixed than it needed to.

This splits the linker into a lower level IRMover and the linker proper.
The IRMover just takes a list of globals to move and a callback that
lets the user control what is lazy linked.

The main motivation is that now tools/gold (and soon lld) can use their
own symbol resolution to instruct IRMover what to do.

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

8 years ago[WebAssembly] Make WebAssemblyStoreResults only return true when it has a change.
Dan Gohman [Thu, 10 Dec 2015 14:17:36 +0000 (14:17 +0000)]
[WebAssembly] Make WebAssemblyStoreResults only return true when it has a change.

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

8 years ago[WebAssembly] Fix WebAssemblyPeephole to set Changed to true when making changes.
Dan Gohman [Thu, 10 Dec 2015 14:16:34 +0000 (14:16 +0000)]
[WebAssembly] Fix WebAssemblyPeephole to set Changed to true when making changes.

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

8 years ago[WebAssembly] Declare that WebAssemblyPeephole does not modify the CFG.
Dan Gohman [Thu, 10 Dec 2015 14:12:04 +0000 (14:12 +0000)]
[WebAssembly] Declare that WebAssemblyPeephole does not modify the CFG.

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

8 years ago[WebAssembly] Remove an unneeded getAnalysisUsage override.
Dan Gohman [Thu, 10 Dec 2015 14:10:04 +0000 (14:10 +0000)]
[WebAssembly] Remove an unneeded getAnalysisUsage override.

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

8 years ago[DeadStoreElimination] Add support for non-local DSE.
Chad Rosier [Thu, 10 Dec 2015 13:51:43 +0000 (13:51 +0000)]
[DeadStoreElimination] Add support for non-local DSE.

We extend the search for redundant stores to predecessor blocks that
unconditionally lead to the block BB with the current store instruction.  That
also includes single-block loops that unconditionally lead to BB, and
if-then-else blocks where then- and else-blocks unconditionally lead to BB.

http://reviews.llvm.org/D13363
Patch by Ivan Baev <ibaev@codeaurora.org>!

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

8 years agoBitcasts between FP and INT values using direct moves
Nemanja Ivanovic [Thu, 10 Dec 2015 13:35:28 +0000 (13:35 +0000)]
Bitcasts between FP and INT values using direct moves

This patch corresponds to review:
http://reviews.llvm.org/D15286

LLVM IR frequently contains bitcast operations between floating point and
integer values of the same width. Doing this through memory operations is
quite expensive on PPC. This patch allows the use of direct register moves
between FPRs and GPRs for lowering bitcasts.

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

8 years agoMacro debug info support in LLVM IR
Amjad Aboud [Thu, 10 Dec 2015 12:56:35 +0000 (12:56 +0000)]
Macro debug info support in LLVM IR
Introduced DIMacro and DIMacroFile debug info metadata in the LLVM IR to support macros.

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

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

8 years ago[LLE] Use the PredicatedScalarEvolution interface to query SCEVs for dependences
Silviu Baranga [Thu, 10 Dec 2015 11:07:18 +0000 (11:07 +0000)]
[LLE] Use the PredicatedScalarEvolution interface to query SCEVs for dependences

Summary:
LAA uses the PredicatedScalarEvolution interface, so it can produce
forward/backward dependences having SCEVs that are AddRecExprs only after being
transformed by PredicatedScalarEvolution.

Use PredicatedScalarEvolution to get the expected expressions.

Reviewers: anemet

Subscribers: llvm-commits, sanjoy

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

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

8 years ago[PostRA scheduling] Allow a target to do scheduling when it wants post RA.
Jonas Paulsson [Thu, 10 Dec 2015 09:10:07 +0000 (09:10 +0000)]
[PostRA scheduling] Allow a target to do scheduling when it wants post RA.

SystemZ needs to do its scheduling after branch relaxation, which can
only happen after block placement, and therefore the standard
PostRAScheduler point in the pass sequence is too early.

TargetMachine::targetSchedulesPostRAScheduling() is a new method that
signals on returning true that target will insert the final scheduling
pass on its own.

Reviewed by Hal Finkel

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

8 years agoRevert r255137.
Akira Hatanaka [Thu, 10 Dec 2015 08:00:52 +0000 (08:00 +0000)]
Revert r255137.

This commit broke apple's internal bot.

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

8 years agoAdd arg_begin() and arg_end() to CallInst and InvokeInst; NFCI
Sanjoy Das [Thu, 10 Dec 2015 06:39:02 +0000 (06:39 +0000)]
Add arg_begin() and arg_end() to CallInst and InvokeInst; NFCI

 - This simplifies the CallSite class, arg_begin / arg_end are now
   simple wrapper getters.

 - In several places, we were creating CallSite instances solely to call
   arg_begin and arg_end.  With this change, that's no longer required.

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

8 years ago[X86] Fix a couple cases were bitwise and logical operations were being mixed. NFC
Craig Topper [Thu, 10 Dec 2015 06:09:41 +0000 (06:09 +0000)]
[X86] Fix a couple cases were bitwise and logical operations were being mixed. NFC

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

8 years ago[OPENMP] Make -fopenmp to turn on OpenMP support by default.
Alexey Bataev [Thu, 10 Dec 2015 05:45:58 +0000 (05:45 +0000)]
[OPENMP] Make -fopenmp to turn on OpenMP support by default.
Patch turns on OpenMP support in clang by default after fixing OpenMP buildbots.
Differential Revision: http://reviews.llvm.org/D13802

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

8 years ago[WebAssembly] Implement mixed-type ISD::FCOPYSIGN.
Dan Gohman [Thu, 10 Dec 2015 04:55:31 +0000 (04:55 +0000)]
[WebAssembly] Implement mixed-type ISD::FCOPYSIGN.

ISD::FCOPYSIGN permits its operands to have differing types, and DAGCombiner
uses this. Add some def : Pat rules to expand this out into an explicit
conversion and a normal copysign operation.

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

8 years ago[WebAssembly] Implement fma.
Dan Gohman [Thu, 10 Dec 2015 04:52:33 +0000 (04:52 +0000)]
[WebAssembly] Implement fma.

It is lowered to a libcall for now, but this is expected to change in the future.

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

8 years agoAMDGPU/SI: Fix warning introduced by r255204
Tom Stellard [Thu, 10 Dec 2015 03:10:46 +0000 (03:10 +0000)]
AMDGPU/SI: Fix warning introduced by r255204

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

8 years agoAMDGPU/SI: Emit constant arrays in the .text section
Tom Stellard [Thu, 10 Dec 2015 02:13:01 +0000 (02:13 +0000)]
AMDGPU/SI: Emit constant arrays in the .text section

Summary:
This allows us to remove the END_OF_TEXT_LABEL hack we had been using
and simplifies the fixups used to compute the address of constant
arrays.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

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

8 years agoAMDGPU/SI: Add support for sgpr and vgpr inline assembly constraints
Tom Stellard [Thu, 10 Dec 2015 02:12:53 +0000 (02:12 +0000)]
AMDGPU/SI: Add support for sgpr and vgpr inline assembly constraints

Summary: The 's' constraint represents sgprs and the 'v' constraint represents vgprs.

Reviewers: arsenm, echristo

Subscribers: arsenm, llvm-commits

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

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

8 years ago[WebAssembly] Fix legalization of f32->f64 EXTLOAD.
Dan Gohman [Thu, 10 Dec 2015 02:07:53 +0000 (02:07 +0000)]
[WebAssembly] Fix legalization of f32->f64 EXTLOAD.

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

8 years ago[WebAssembly] Update known test failures
Derek Schuff [Thu, 10 Dec 2015 01:09:40 +0000 (01:09 +0000)]
[WebAssembly] Update known test failures

We can now select sign_extend_inreg

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

8 years agoRegisterPressure: Factor out liveness dead-def detection logic; NFCI
Matthias Braun [Thu, 10 Dec 2015 01:04:15 +0000 (01:04 +0000)]
RegisterPressure: Factor out liveness dead-def detection logic; NFCI

Detecting additional dead-defs without a dead flag that are only visible
through liveness information should be part of the register operand
collection not intertwined with the register pressure update logic.

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

8 years ago[WebAssembly] Also legalize sign_extend_inreg of i32->i64.
Dan Gohman [Thu, 10 Dec 2015 01:00:19 +0000 (01:00 +0000)]
[WebAssembly] Also legalize sign_extend_inreg of i32->i64.

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

8 years ago[WebAssembly] Update test failure expectations
Derek Schuff [Thu, 10 Dec 2015 00:56:18 +0000 (00:56 +0000)]
[WebAssembly] Update test failure expectations

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

8 years agoPeepholeOptimizer: Ignore dead implicit defs
Dan Gohman [Thu, 10 Dec 2015 00:37:51 +0000 (00:37 +0000)]
PeepholeOptimizer: Ignore dead implicit defs

Target-specific instructions may have uninteresting physreg clobbers,
for target-specific reasons. The peephole pass doesn't need to concern
itself with such defs, as long as they're implicit and marked as dead.

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

8 years ago[WebAssembly] Fix legalization of shift operators with illegal types.
Dan Gohman [Thu, 10 Dec 2015 00:26:26 +0000 (00:26 +0000)]
[WebAssembly] Fix legalization of shift operators with illegal types.

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

8 years ago[WebAssembly] Fix copy+pastos.
Dan Gohman [Thu, 10 Dec 2015 00:22:40 +0000 (00:22 +0000)]
[WebAssembly] Fix copy+pastos.

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

8 years ago[WebAssembly] Implement anyext.
Dan Gohman [Thu, 10 Dec 2015 00:17:35 +0000 (00:17 +0000)]
[WebAssembly] Implement anyext.

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

8 years ago[X86] Enable shrink-wrapping by default, but keep it disabled for stack frames
Quentin Colombet [Wed, 9 Dec 2015 23:08:18 +0000 (23:08 +0000)]
[X86] Enable shrink-wrapping by default, but keep it disabled for stack frames
without a frame pointer when unwind may happen.
This is a workaround for a bug in the way we emit the CFI directives for
frameless unwind information. See PR25614.

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

8 years agouse range-based for loops; NFCI
Sanjay Patel [Wed, 9 Dec 2015 22:45:45 +0000 (22:45 +0000)]
use range-based for loops; NFCI

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

8 years agoSynchronize the logic for deciding to link a gv.
Rafael Espindola [Wed, 9 Dec 2015 22:44:00 +0000 (22:44 +0000)]
Synchronize the logic for deciding to link a gv.

We were deciding to not link an available_externally gv over a
declaration, but then copying over the body anyway.

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

8 years ago[PGO] Rename the profdata filename to avoid the conflict b/w tests.
Rong Xu [Wed, 9 Dec 2015 21:27:59 +0000 (21:27 +0000)]
[PGO] Rename the profdata filename to avoid the conflict b/w tests.

Two tests diag_mismatch.ll and diag_no_funcprofdata.ll generates the same
profdata filename which can conflict in current test runs. This patch
renames them to have different names.

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

8 years agoIR: Make ConstantDataArray::getFP actually return a ConstantDataArray
Justin Bogner [Wed, 9 Dec 2015 21:21:07 +0000 (21:21 +0000)]
IR: Make ConstantDataArray::getFP actually return a ConstantDataArray

The ConstantDataArray::getFP(LLVMContext &, ArrayRef<uint16_t>)
overload has had a typo in it since it was written, where it will
create a Vector instead of an Array. This obviously doesn't work at
all, but it turns out that until r254991 there weren't actually any
callers of this overload. Fix the typo and add some test coverage.

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

8 years ago[ThinLTO] Release files read when creating combined index in gold plugin
Teresa Johnson [Wed, 9 Dec 2015 21:11:42 +0000 (21:11 +0000)]
[ThinLTO] Release files read when creating combined index in gold plugin

This wasn't causing an issue since at HEAD we exit the linker completely
after creating the combined index.

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

8 years ago[Float2Int] Don't operate on vector instructions
Reid Kleckner [Wed, 9 Dec 2015 21:08:18 +0000 (21:08 +0000)]
[Float2Int] Don't operate on vector instructions

This fixes a crash bug. It's also not clear if we'd want to do this
transform for vectors.

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

8 years ago[llvm-dwp] Sink debug_types.dwo emission into the code parsing the type signatures...
David Blaikie [Wed, 9 Dec 2015 21:02:33 +0000 (21:02 +0000)]
[llvm-dwp] Sink debug_types.dwo emission into the code parsing the type signatures (NFC)

This is a preliminary change towards deduplicating type units based on
their signatures. Next change will skip emission of types when their
signature has already been seen.

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

8 years agoDon't assign a temporary string to a StringRef.
Rafael Espindola [Wed, 9 Dec 2015 20:41:10 +0000 (20:41 +0000)]
Don't assign a temporary string to a StringRef.

Should fix the windows debug and asan bots.

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

8 years agoUse WeakVH to keep track of calls with operand bundles in CloneCodeInfo
Sanjoy Das [Wed, 9 Dec 2015 20:33:52 +0000 (20:33 +0000)]
Use WeakVH to keep track of calls with operand bundles in CloneCodeInfo

`CloneAndPruneIntoFromInst` can DCE instructions after cloning them into
the new function, and so an AssertingVH is too strong.  This change
switches CloneCodeInfo to use a std::vector<WeakVH>.

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

8 years agoDelete trailing whitespace; NFC
Sanjoy Das [Wed, 9 Dec 2015 20:33:45 +0000 (20:33 +0000)]
Delete trailing whitespace; NFC

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

8 years agoDelay context construction to when/if it is needed in gold plugin (NFC)
Teresa Johnson [Wed, 9 Dec 2015 19:49:40 +0000 (19:49 +0000)]
Delay context construction to when/if it is needed in gold plugin (NFC)

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

8 years agoclang-format order of gold-plugin includes (NFC)
Teresa Johnson [Wed, 9 Dec 2015 19:45:55 +0000 (19:45 +0000)]
clang-format order of gold-plugin includes (NFC)

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

8 years ago[ThinLTO] FunctionImport pass can take a const index pointer (NFC)
Teresa Johnson [Wed, 9 Dec 2015 19:39:47 +0000 (19:39 +0000)]
[ThinLTO] FunctionImport pass can take a const index pointer (NFC)

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

8 years ago[InstCombine] fold bitcasts around an extractelement (2nd try)
Sanjay Patel [Wed, 9 Dec 2015 18:57:16 +0000 (18:57 +0000)]
[InstCombine] fold bitcasts around an extractelement (2nd try)

This is a redo of r255124 (reverted at r255126) with an added check for a
scalar destination type and an added test for the failure seen in Clang's
test/CodeGen/vector.c. The extra test shows a different missing optimization.

Original commit message:

Example:
  bitcast (extractelement (bitcast <2 x float> %X to <2 x i32>), 1) to float
    --->
  extractelement <2 x float> %X, i32 1

This is part of fixing PR25543:
https://llvm.org/bugs/show_bug.cgi?id=25543

The next step will be to generalize this fold:
trunc ( lshr ( bitcast X) ) -> extractelement (X)

Ie, I'm hoping to replace the existing transform of:
bitcast ( trunc ( lshr ( bitcast X)))
added by:
http://reviews.llvm.org/rL112232

with 2 less specific transforms to catch the case in the bug report.

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

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

8 years agoRevert "Revert r253253 and r253126: "Don't recompute LCSSA after loop-unrolling when...
Michael Zolotukhin [Wed, 9 Dec 2015 18:20:28 +0000 (18:20 +0000)]
Revert "Revert r253253 and r253126: "Don't recompute LCSSA after loop-unrolling when possible.""

The bug in IndVarSimplify was fixed in r254976, r254977, so I'm
reapplying the original patch for avoiding redundant LCSSA recomputation.

This reverts commit ffe3b434e505e403146aff00be0c177bb6d13466.

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

8 years ago[PGO] Resubmit "MST based PGO instrumentation infrastructure" (r254021)
Rong Xu [Wed, 9 Dec 2015 18:08:16 +0000 (18:08 +0000)]
[PGO] Resubmit "MST based PGO instrumentation infrastructure" (r254021)

This new patch fixes a few bugs that exposed in last submit. It also improves
the test cases.
--Original Commit Message--
This patch implements a minimum spanning tree (MST) based instrumentation for
PGO. The use of MST guarantees minimum number of CFG edges getting
instrumented. An addition optimization is to instrument the less executed
edges to further reduce the instrumentation overhead. The patch contains both the
instrumentation and the use of the profile to set the branch weights.

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

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

8 years ago[Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for returning...
Nathan Slingerland [Wed, 9 Dec 2015 17:11:28 +0000 (17:11 +0000)]
[Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for returning overflow state

Summary:
Improve SaturatingAdd()/SaturatingMultiply() to use bool * to optionally return overflow result.
This should make it clearer that the value is returned at callsites and reduces the size of the implementation.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

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

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

8 years agoRevert "[InstCombine] fold bitcasts around an extractelement"
Mehdi Amini [Wed, 9 Dec 2015 16:31:39 +0000 (16:31 +0000)]
Revert "[InstCombine] fold bitcasts around an extractelement"

This reverts commit r255124.

Broke http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/4193/steps/test/logs/stdio

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years ago[WebAssembly] Reintroduce ARGUMENT moving logic
Dan Gohman [Wed, 9 Dec 2015 16:23:59 +0000 (16:23 +0000)]
[WebAssembly] Reintroduce ARGUMENT moving logic

Reinteroduce the code for moving ARGUMENTS back to the top of the basic block.
While the ARGUMENTS physical register prevents sinking and scheduling from
moving them, it does not appear to be sufficient to prevent SelectionDAG from
moving them down in the initial schedule. This patch introduces a patch that
moves them back to the top immediately after SelectionDAG runs.

This is still hopefully a temporary solution. http://reviews.llvm.org/D14750 is
one alternative, though the review has not been favorable, and proposed
alternatives are longer-term and have other downsides.

This fixes the main outstanding -verify-machineinstrs failures, so it adds
-verify-machineinstrs to several tests.

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

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

8 years ago[InstCombine] fold bitcasts around an extractelement
Sanjay Patel [Wed, 9 Dec 2015 16:17:20 +0000 (16:17 +0000)]
[InstCombine] fold bitcasts around an extractelement

Example:
  bitcast (extractelement (bitcast <2 x float> %X to <2 x i32>), 1) to float
    --->
  extractelement <2 x float> %X, i32 1

This is part of fixing PR25543:
https://llvm.org/bugs/show_bug.cgi?id=25543

The next step will be to generalize this fold:
trunc ( lshr ( bitcast X) ) -> extractelement (X)

Ie, I'm hoping to replace the existing transform of:
bitcast ( trunc ( lshr ( bitcast X)))
added by:
http://reviews.llvm.org/rL112232

with 2 less specific transforms to catch the case in the bug report.

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

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

8 years agoChange hasUniqueInitializer() to call isStrongDefinitionForLinker() instead of !isWea...
Mehdi Amini [Wed, 9 Dec 2015 16:17:07 +0000 (16:17 +0000)]
Change hasUniqueInitializer() to call isStrongDefinitionForLinker() instead of !isWeakForLinker()

Summary:
Available_externally global variable with initializer were considered "hasInitializer()",
while obviously it can't match the description:

    Whether the global variable has an initializer, and any changes made to the
    initializer will turn up in the final executable.

since modifying the initializer of an externally available variable does not make sense.

Reviewers: pcc, rafael

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agoRe-commit r255115, with the PredicatedScalarEvolution class moved to
Silviu Baranga [Wed, 9 Dec 2015 16:06:28 +0000 (16:06 +0000)]
Re-commit r255115, with the PredicatedScalarEvolution class moved to
ScalarEvolution.h, in order to avoid cyclic dependencies between the Transform
and Analysis modules:

[LV][LAA] Add a layer over SCEV to apply run-time checked knowledge on SCEV expressions

Summary:
This change creates a layer over ScalarEvolution for LAA and LV, and centralizes the
usage of SCEV predicates. The SCEVPredicatedLayer takes the statically deduced knowledge
by ScalarEvolution and applies the knowledge from the SCEV predicates. The end goal is
that both LAA and LV should use this interface everywhere.

This also solves a problem involving the result of SCEV expression rewritting when
the predicate changes. Suppose we have the expression (sext {a,+,b}) and two predicates
  P1: {a,+,b} has nsw
  P2: b = 1.

Applying P1 and then P2 gives us {a,+,1}, while applying P2 and the P1 gives us
sext({a,+,1}) (the AddRec expression was changed by P2 so P1 no longer applies).
The SCEVPredicatedLayer maintains the order of transformations by feeding back
the results of previous transformations into new transformations, and therefore
avoiding this issue.

The SCEVPredicatedLayer maintains a cache to remember the results of previous
SCEV rewritting results. This also has the benefit of reducing the overall number
of expression rewrites.

Reviewers: mzolotukhin, anemet

Subscribers: jmolloy, sanjoy, llvm-commits

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

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

8 years agoARM: don't use a deleted node as the BaseReg in complex pattern.
Tim Northover [Wed, 9 Dec 2015 15:54:50 +0000 (15:54 +0000)]
ARM: don't use a deleted node as the BaseReg in complex pattern.

We mutated the DAG, which invalidated the node we were trying to use
as a base register. Sometimes we got away with it, but other times the
node really did get deleted before it was finished with.

Should fix PR25733

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

8 years agoWebAssembly: add missing failure to the list.
JF Bastien [Wed, 9 Dec 2015 15:52:57 +0000 (15:52 +0000)]
WebAssembly: add missing failure to the list.

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

8 years agoRevert r255115 until we figure out how to fix the bot failures.
Silviu Baranga [Wed, 9 Dec 2015 15:25:28 +0000 (15:25 +0000)]
Revert r255115 until we figure out how to fix the bot failures.

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

8 years ago[LV][LAA] Add a layer over SCEV to apply run-time checked knowledge on SCEV expressions
Silviu Baranga [Wed, 9 Dec 2015 15:03:52 +0000 (15:03 +0000)]
[LV][LAA] Add a layer over SCEV to apply run-time checked knowledge on SCEV expressions

Summary:
This change creates a layer over ScalarEvolution for LAA and LV, and centralizes the
usage of SCEV predicates. The SCEVPredicatedLayer takes the statically deduced knowledge
by ScalarEvolution and applies the knowledge from the SCEV predicates. The end goal is
that both LAA and LV should use this interface everywhere.

This also solves a problem involving the result of SCEV expression rewritting when
the predicate changes. Suppose we have the expression (sext {a,+,b}) and two predicates
  P1: {a,+,b} has nsw
  P2: b = 1.

Applying P1 and then P2 gives us {a,+,1}, while applying P2 and the P1 gives us
sext({a,+,1}) (the AddRec expression was changed by P2 so P1 no longer applies).
The SCEVPredicatedLayer maintains the order of transformations by feeding back
the results of previous transformations into new transformations, and therefore
avoiding this issue.

The SCEVPredicatedLayer maintains a cache to remember the results of previous
SCEV rewritting results. This also has the benefit of reducing the overall number
of expression rewrites.

Reviewers: mzolotukhin, anemet

Subscribers: jmolloy, sanjoy, llvm-commits

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

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

8 years agoFix cycle in selection DAG introduced by extractelement legalization
Robert Lougher [Wed, 9 Dec 2015 14:34:10 +0000 (14:34 +0000)]
Fix cycle in selection DAG introduced by extractelement legalization

During selection DAG legalization, extractelement is replaced with a load
instruction.  To do this, a temporary store to the stack is used unless an
existing store is found that can be re-used.

If re-using a store, the chain going out of the store must be replaced by
the one going out of the new load (this ensures that any stores that must
take place after the store happens after the load, else the value might
be overwritten before it is loaded).

The problem is, if the extractelement index is dependent on the store
replacing the chain will introduce a cycle in the selection DAG (the load
uses the index, and by replacing the chain we will make the index dependent
on the load).

To fix this, if the index is dependent on the store, the store is skipped.
This is conservative as we may end up creating an unnecessary extra store
to the stack.  However, the situation is not expected to occur very often.

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

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

8 years ago[AArch64] Fix FP16 vector instructions that should only accept low registers
Oliver Stannard [Wed, 9 Dec 2015 14:32:11 +0000 (14:32 +0000)]
[AArch64] Fix FP16 vector instructions that should only accept low registers

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

8 years ago[mips][ias] Range check uimm10 operands
Daniel Sanders [Wed, 9 Dec 2015 13:48:05 +0000 (13:48 +0000)]
[mips][ias] Range check uimm10 operands

Summary:

Reviewers: vkalintiris

Subscribers: dsanders, llvm-commits

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

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

8 years agoWebAssembly: add known failures
JF Bastien [Wed, 9 Dec 2015 13:29:32 +0000 (13:29 +0000)]
WebAssembly: add known failures

The bots are now running the torture tests properly. Bin all failures from the GCC C torture tests so that we can tackle failures and make the tree go red on regressions.

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

8 years ago[mips] Use multiclass patterns for f32/f64 comparisons and i32 selects.
Vasileios Kalintiris [Wed, 9 Dec 2015 13:24:22 +0000 (13:24 +0000)]
[mips] Use multiclass patterns for f32/f64 comparisons and i32 selects.

Summary:
Although the multiclass for i32 selects might seem redundant as it has
only one instantiation, we will use it to replace the correspondent
patterns in Mips64r6InstrInfo.td in follow-up commits.

Reviewers: dsanders

Subscribers: llvm-commits, dsanders

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

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

8 years agoRevert r254897 "[mips][microMIPS] Implement LH, LHE, LHU and LHUE instructions"
Zlatko Buljan [Wed, 9 Dec 2015 13:07:45 +0000 (13:07 +0000)]
Revert r254897 "[mips][microMIPS] Implement LH, LHE, LHU and LHUE instructions"

Commited patch was intended to implement LH, LHE, LHU and LHUE instructions.
After commit test-suite failed with error message in the form of:
fatal error: error in backend: Cannot select: t124: i32,ch = load<LD2[%d](tbaa=<0x94acc48>), sext from i16> t0, t2, undef:i32
For that reason I decided to revert commit r254897 and make new patch which besides implementation and standard regression tests will also have dedicated tests (CodeGen) for the above error.

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

8 years agoEarlyCSE: fix typo from rL255054.
JF Bastien [Wed, 9 Dec 2015 09:05:42 +0000 (09:05 +0000)]
EarlyCSE: fix typo from rL255054.

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

8 years agoRevert "Implement a new pass - LiveDebugValues - to compute the set of live DEBUG_VAL...
Mehdi Amini [Wed, 9 Dec 2015 08:17:42 +0000 (08:17 +0000)]
Revert "Implement a new pass - LiveDebugValues - to compute the set of live DEBUG_VALUEs at each basic block and insert them. Reviewed and accepted at: reviews.llvm.org/D11933"

This reverts commit r255096.

Break the bots: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/16378/

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agoThe current importing scheme is processing one function at a time,
Mehdi Amini [Wed, 9 Dec 2015 08:17:35 +0000 (08:17 +0000)]
The current importing scheme is processing one function at a time,
loading the source Module, linking the function in the destination
module, and destroying the source Module before repeating with the
next function to import (potentially from the same Module).

Ideally we would keep the source Module alive and import the next
Function needed from this Module. Unfortunately this is not possible
because the linker does not leave it in a usable state.

However we can do better by first computing the list of all candidates
per Module, and only then load the source Module and import all the
function we need for it.

The trick to process callees is to materialize function in the source
module when building the list of function to import, and inspect them
in their source module, collecting the list of callees for each
callee.

When we move the the actual import, we will import from each source
module exactly once. Each source module is loaded exactly once.
The only drawback it that it requires to have all the lazy-loaded
source Module in memory at the same time.

Currently this patch already improves considerably the link time,
a multithreaded link of llvm-dis on my laptop was:

  real  1m12.175s  user  6m32.430s sys  0m10.529s

and is now:

  real  0m40.697s  user  2m10.237s sys  0m4.375s

Note: this is the full link time (linker+Import+Optimizer+CodeGen)

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agoImplement a new pass - LiveDebugValues - to compute the set of live DEBUG_VALUEs...
Vikram TV [Wed, 9 Dec 2015 05:49:14 +0000 (05:49 +0000)]
Implement a new pass - LiveDebugValues - to compute the set of live DEBUG_VALUEs at each basic block and insert them. Reviewed and accepted at: reviews.llvm.org/D11933

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