8 years agoRemove templates from CostTableLookup functions. All instantiations had the same...
Craig Topper [Wed, 28 Oct 2015 04:02:12 +0000 (04:02 +0000)]
Remove templates from CostTableLookup functions. All instantiations had the same type.

This also lets us remove the versions of the functions that took a statically sized array as we can rely on ArrayRef implicit conversion now.

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

8 years ago[PowerPC] Replace cntlz[.] with cntlzw[.]
Hal Finkel [Wed, 28 Oct 2015 03:26:45 +0000 (03:26 +0000)]
[PowerPC] Replace cntlz[.] with cntlzw[.]

cntlz is the old POWER mnemonic. cntlzw is the PowerPC mnemonic.

This change fixes an issue when -no-integrated-as: The opcode cntlz is
unrecognized by gas

Alias the POWER mnemonic cntlz[.] to the PowerPC mnemonic cntlzw[.]
This is done for because the POWER cntlz mnemonic has be used by LLVM for
a very long time. We need to make sure that assembly programs
that are using the cntlz[.] do not break with this change.

Change PowerPC tests to reflect the insn change from cntlz to cntlzw.
Add assembly test to verify cntlz[.] is encoded correctly.

Patch by Tom Rix!

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

8 years ago[ValueTracking] Expose `implies` via ValueTracking, NFC
Sanjoy Das [Wed, 28 Oct 2015 03:20:19 +0000 (03:20 +0000)]
[ValueTracking] Expose `implies` via ValueTracking, NFC

Summary: This will allow a later patch to `JumpThreading` use this functionality.

Reviewers: reames

Subscribers: llvm-commits

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

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

8 years ago[ValueTracking] Use !range metadata more aggressively in KnownBits
Sanjoy Das [Wed, 28 Oct 2015 03:20:15 +0000 (03:20 +0000)]
[ValueTracking] Use !range metadata more aggressively in KnownBits

Teach `computeKnownBitsFromRangeMetadata` to use `!range` metadata more

Reviewers: majnemer, nlewycky, jingyue

Subscribers: llvm-commits

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

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

8 years ago[SelectionDAG] Don't inspect !range metadata for extended loads
Sanjoy Das [Wed, 28 Oct 2015 03:20:10 +0000 (03:20 +0000)]
[SelectionDAG] Don't inspect !range metadata for extended loads

Don't call `computeKnownBitsFromRangeMetadata` for extended loads --
this can cause a mismatch between the width of the !range metadata and
the width of the APInt's accumulating `KnownZero` (and `KnownOne` in the
future).  This isn't a problem now, but will be after a future change.

Note: this can be made more aggressive in the future.

Reviewers: nlewycky

Subscribers: llvm-commits

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

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

8 years ago[GVN] Make a test case more robust
Sanjoy Das [Wed, 28 Oct 2015 03:20:05 +0000 (03:20 +0000)]
[GVN] Make a test case more robust

The singleton !range metadata gets simplified more aggressively after a
later change, so change the !range metadata to contain more than one

While at it, turn some `; CHECK` s to `; CHECK-LABEL:` s.

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

8 years ago[Orc] Disable Orc C API unit tests on non-Darwin while I investigate more
Lang Hames [Wed, 28 Oct 2015 03:12:51 +0000 (03:12 +0000)]
[Orc] Disable Orc C API unit tests on non-Darwin while I investigate more
builder failures.

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

8 years ago[Orc] Re-add C bindings for the Orc APIs, with a fix to remove the union that
Lang Hames [Wed, 28 Oct 2015 02:40:04 +0000 (02:40 +0000)]
[Orc] Re-add C bindings for the Orc APIs, with a fix to remove the union that
was causing builder failures.

The bindings were originally added in r251472, and reverted in r251473 due to
the builder failures.

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

8 years agolit/TestRunner.py: Factor variable subsitution into an own function; NFCI
Matthias Braun [Wed, 28 Oct 2015 02:36:45 +0000 (02:36 +0000)]
lit/TestRunner.py: Factor variable subsitution into an own function; NFCI

This is a clearer separation of concerns and makes it easier to reuse
the function.

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

8 years agolit/TestRunner.py: Factor out Substitution construction; NFC
Matthias Braun [Wed, 28 Oct 2015 02:36:42 +0000 (02:36 +0000)]
lit/TestRunner.py: Factor out Substitution construction; NFC

This is a clearer separation of concerns and makes it easier to reuse
the functions.

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

8 years agolit/TestRunner.py: Get execdir from test.getExecPath() instead of passing it around...
Matthias Braun [Wed, 28 Oct 2015 02:36:38 +0000 (02:36 +0000)]
lit/TestRunner.py: Get execdir from test.getExecPath() instead of passing it around; NFC

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

8 years agolit/TestRunner.py: Make parseIntegratedTestScriptCommands() keyword list a parameter...
Matthias Braun [Wed, 28 Oct 2015 02:36:35 +0000 (02:36 +0000)]
lit/TestRunner.py: Make parseIntegratedTestScriptCommands() keyword list a parameter; NFC

This allows the function to be easily reused and also simplifies the
code as the keyword list is next to the keyword handling now.

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

8 years ago[Orc] Revert the C bindngs commit, r251472, while I debug some builder failures.
Lang Hames [Wed, 28 Oct 2015 01:03:09 +0000 (01:03 +0000)]
[Orc] Revert the C bindngs commit, r251472, while I debug some builder failures.

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

8 years ago[Orc] Add experimental C bindings for Orc.
Lang Hames [Wed, 28 Oct 2015 00:28:26 +0000 (00:28 +0000)]
[Orc] Add experimental C bindings for Orc.

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

8 years agoAdd myself as the the code owner for the AVR backend
Dylan McKay [Wed, 28 Oct 2015 00:24:54 +0000 (00:24 +0000)]
Add myself as the the code owner for the AVR backend

As I maintain the AVR backend and am currently in the process of migrating it in tree, it makes sense to add myself as the code owner.

Thoughts welcome!

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

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

8 years agoMake the SelectionDAG graph printer use SDNode::PersistentId labels.
James Y Knight [Tue, 27 Oct 2015 23:09:03 +0000 (23:09 +0000)]
Make the SelectionDAG graph printer use SDNode::PersistentId labels.

r248010 changed the -debug output to use short ids, but did not
similarly modify the graph printer. Change to be consistent, for ease of

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

8 years agoBitcode: Fix more unsigned integer overflow bugs.
Peter Collingbourne [Tue, 27 Oct 2015 23:01:25 +0000 (23:01 +0000)]
Bitcode: Fix more unsigned integer overflow bugs.

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

8 years ago[SimplifyCFG] Don't DCE catchret because the successor is unreachable
David Majnemer [Tue, 27 Oct 2015 22:43:56 +0000 (22:43 +0000)]
[SimplifyCFG] Don't DCE catchret because the successor is unreachable

CatchReturnInst has side-effects: it runs a destructor.  This destructor
could conceivably run forever/call exit/etc. and should not be removed.

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

8 years ago[Bitcode] Fix accidental syntax errors in compatibility tests
Vedant Kumar [Tue, 27 Oct 2015 22:10:17 +0000 (22:10 +0000)]
[Bitcode] Fix accidental syntax errors in compatibility tests

We used automated tools to update our IR to its current syntax in commit
21f77df7(r247378). While it correctly updated the CHECK lines in our
compatibility tests, the IR should have remained untouched.  This commit
fixes the syntax errors.

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

8 years ago[X86][AVX512] Test UNPCK with non-sequential scalars
Simon Pilgrim [Tue, 27 Oct 2015 21:18:45 +0000 (21:18 +0000)]
[X86][AVX512] Test UNPCK with non-sequential scalars

Missing tests for r251297

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

8 years ago[IR] Limit bits used for CallingConv::ID, update tests
Vedant Kumar [Tue, 27 Oct 2015 21:17:06 +0000 (21:17 +0000)]
[IR] Limit bits used for CallingConv::ID, update tests

Use 10 bits to represent calling convention ID's instead of 13, and
update the bitcode compatibility tests accordingly. We now error-out in
the bitcode reader when we see bad calling conv ID's.

Thanks to rnk and dexonsmith for feedback!

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

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

8 years ago[AliasSetTracker] Use mod/ref information for UnknownInstr
Hal Finkel [Tue, 27 Oct 2015 20:37:04 +0000 (20:37 +0000)]
[AliasSetTracker] Use mod/ref information for UnknownInstr

AliasSetTracker does not need to convert the access mode to ModRefAccess if the
new visited UnknownInst has only 'REF' modrefinfo to existing pointers in the

Patch by Andrew Zhogin!

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

8 years agoUse the 'arcp' fast-math-flag when combining repeated FP divisors
Sanjay Patel [Tue, 27 Oct 2015 20:27:25 +0000 (20:27 +0000)]
Use the 'arcp' fast-math-flag when combining repeated FP divisors

This is a usage of the IR-level fast-math-flags now that they are propagated to SDNodes.
This was originally part of D8900.

Removing the global 'enable-unsafe-fp-math' checks will require auto-upgrade and
possibly other changes.

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

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

8 years ago[ScalarEvolutionExpander] PHI on a catchpad can be used on both edges
David Majnemer [Tue, 27 Oct 2015 19:48:28 +0000 (19:48 +0000)]
[ScalarEvolutionExpander] PHI on a catchpad can be used on both edges

A PHI on a catchpad might be used by both edges out of the catchpad,
feeding back into a loop.  In this case, just use the insertion point.
Anything more clever would require new basic blocks or PHI placement.

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

8 years ago[AArch64]Merge halfword loads into a 32-bit load
Jun Bum Lim [Tue, 27 Oct 2015 19:16:03 +0000 (19:16 +0000)]
[AArch64]Merge halfword loads into a 32-bit load

This recommits r250719, which caused a failure in SPEC2000.gcc
because of the incorrect insert point for the new wider load.

Convert two halfword loads into a single 32-bit word load with bitfield extract
instructions. For example :
  ldrh w0, [x2]
  ldrh w1, [x2, #2]
  ldr w0, [x2]
  ubfx w1, w0, #16, #16
  and  w0, w0, #ffff

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

8 years agoWhitespace.
NAKAMURA Takumi [Tue, 27 Oct 2015 19:02:52 +0000 (19:02 +0000)]

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

8 years agoRevert r251291, "Loop Vectorizer - skipping "bitcast" before GEP"
NAKAMURA Takumi [Tue, 27 Oct 2015 19:02:36 +0000 (19:02 +0000)]
Revert r251291, "Loop Vectorizer - skipping "bitcast" before GEP"

It causes miscompilation of llvm/lib/ExecutionEngine/Interpreter/Execution.cpp.
See also PR25324.

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

8 years agoTidy a comment. NFC.
Diego Novillo [Tue, 27 Oct 2015 18:41:46 +0000 (18:41 +0000)]
Tidy a comment. NFC.

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

8 years agoCreate a new interface addSuccessorWithoutWeight(MBB*) in MBB to add successors when...
Cong Hou [Tue, 27 Oct 2015 17:59:36 +0000 (17:59 +0000)]
Create a new interface addSuccessorWithoutWeight(MBB*) in MBB to add successors when optimization is disabled.

When optimization is disabled, edge weights that are stored in MBB won't be used so that we don't have to store them. Currently, this is done by adding successors with default weight 0, and if all successors have default weights, the weight list will be empty. But that the weight list is empty doesn't mean disabled optimization (as is stated several times in MachineBasicBlock.cpp): it may also mean all successors just have default weights.

We should discourage using default weights when adding successors, because it is very easy for users to forget update the correct edge weights instead of using default ones (one exception is that the MBB only has one successor). In order to detect such usages, it is better to differentiate using default weights from the case when optimizations is disabled.

In this patch, a new interface addSuccessorWithoutWeight(MBB*) is created for when optimization is disabled. In this case, MBB will try to maintain an empty weight list, but it cannot guarantee this as for many uses of addSuccessor() whether optimization is disabled or not is not checked. But it can guarantee that if optimization is enabled, then the weight list always has the same size of the successor list.

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

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

8 years ago[SLP] Be more aggressive about reduction width selection.
Charlie Turner [Tue, 27 Oct 2015 17:59:03 +0000 (17:59 +0000)]
[SLP] Be more aggressive about reduction width selection.

This change could be way off-piste, I'm looking for any feedback on whether it's an acceptable approach.

It never seems to be a problem to gobble up as many reduction values as can be found, and then to attempt to reduce the resulting tree. Some of the workloads I'm looking at have been aggressively unrolled by hand, and by selecting reduction widths that are not constrained by a vector register size, it becomes possible to profitably vectorize. My test case shows such an unrolling which SLP was not vectorizing (on neither ARM nor X86) before this patch, but with it does vectorize.

I measure no significant compile time impact of this change when combined with D13949 and D14063. There are also no significant performance regressions on ARM/AArch64 in SPEC or LNT.

The more principled approach I thought of was to generate several candidate tree's and use the cost model to pick the cheapest one. That seemed like quite a big design change (the algorithms seem very much one-shot), and would likely be a costly thing for compile time. This seemed to do the job at very little cost, but I'm worried I've misunderstood something!

Reviewers: nadav, jmolloy

Subscribers: mssimpso, llvm-commits, aemerson

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

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

8 years ago[SLP] Try a bit harder to find reduction PHIs
Charlie Turner [Tue, 27 Oct 2015 17:54:16 +0000 (17:54 +0000)]
[SLP] Try a bit harder to find reduction PHIs

Currently, when the SLP vectorizer considers whether a phi is part of a reduction, it dismisses phi's whose incoming blocks are not the same as the block containing the phi. For the patterns I'm looking at, extending this rule to allow phis whose incoming block is a containing loop latch allows me to vectorize certain workloads.

There is no significant compile-time impact, and combined with D13949, no performance improvement measured in ARM/AArch64 in any of SPEC2000, SPEC2006 or LNT.

Reviewers: jmolloy, mcrosier, nadav

Subscribers: mssimpso, nadav, aemerson, llvm-commits

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

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

8 years ago[SLP] Treat SelectInsts as reduction values.
Charlie Turner [Tue, 27 Oct 2015 17:49:11 +0000 (17:49 +0000)]
[SLP] Treat SelectInsts as reduction values.

Certain workloads, in particular sum-of-absdiff loops, can be vectorized using SLP if it can treat select instructions as reduction values.

The test case is a bit awkward. The AArch64 cost model needs some tuning to not be so pessimistic about selects. I've had to tweak the SLP threshold here.

Reviewers: jmolloy, mzolotukhin, spatel, nadav

Subscribers: nadav, mssimpso, aemerson, llvm-commits

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

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

8 years ago[Orc] Fix indentation.
Lang Hames [Tue, 27 Oct 2015 17:45:48 +0000 (17:45 +0000)]
[Orc] Fix indentation.

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

8 years agoFix SamplePGO segfault when debug info is missing.
Diego Novillo [Tue, 27 Oct 2015 17:37:00 +0000 (17:37 +0000)]
Fix SamplePGO segfault when debug info is missing.

When emitting a remark for a conditional branch annotation, the remark
uses the line location information of the conditional branch in the
message.  In some cases, that information is unavailable and the
optimization would segfaul. I'm still not sure whether this is a bug or
WAI, but the optimizer should not die because of this.

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

8 years ago[ms-inline-asm] Leave alignment in bytes if the native assembler uses bytes
Reid Kleckner [Tue, 27 Oct 2015 17:32:48 +0000 (17:32 +0000)]
[ms-inline-asm] Leave alignment in bytes if the native assembler uses bytes

The existing behavior was correct on Darwin, which is probably the
platform it was written for.

Before this change, we would rewrite "align 8" to ".align 3" and then
fail to make it through the integrated assembler because 3 is not a
power of 2.

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

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

8 years agoRename qsort -> multikey_qsort. NFC.
Rui Ueyama [Tue, 27 Oct 2015 16:57:50 +0000 (16:57 +0000)]
Rename qsort -> multikey_qsort. NFC.

`qsort` as a file-scope local function name was confusing.

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

8 years agoPrefer ranlib mode over ar mode.
Ed Schouten [Tue, 27 Oct 2015 16:37:49 +0000 (16:37 +0000)]
Prefer ranlib mode over ar mode.

For CloudABI's toolchain I have a symlink that goes from <target>-ar and
<target>-ranlib to LLVM's ar binary, to mimick GNU Binutils' naming
scheme. The problem is that if we're targetting ARM64, the name of the
ranlib executable is aarch64-unknown-cloudabi-ranlib. This already
contains the string "ar".

Let's move the "ranlib" test above the "ar" test. It's not that likely
that we're going to see operating systems or harwdare architectures that
are called "ranlib".

Reviewed by: rafael
Differential Revision: http://reviews.llvm.org/D14123

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

8 years ago[CMake] Get rid of LLVM_DYLIB_EXPORT_ALL, and make it the default, add libLLVM-C...
Chris Bieneman [Tue, 27 Oct 2015 16:02:04 +0000 (16:02 +0000)]
[CMake] Get rid of LLVM_DYLIB_EXPORT_ALL, and make it the default, add libLLVM-C on darwin to cover the C API needs.

We've had a lot of discussion in the past about the meaningful and useful default behaviors for the llvm-shlib tool. The original implementation was heavily geared toward Apple's use, and I think that was wrong. This patch seeks to correct that.

I've removed the LLVM_DYLIB_EXPORT_ALL variable and made libLLVM export everything by default.

I've also added a new target that is only built on Darwin for libLLVM-C as a library that re-exports the LLVM-C API. This library is not built on Linux because ELF doesn't support re-export libraries in the same way MachO does.

Reviewers: chapuni, resistor, bogner, axw

Subscribers: llvm-commits

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

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

8 years ago[X86][AVX512] [X86][AVX512] add convert float to half
Asaf Badouh [Tue, 27 Oct 2015 15:37:17 +0000 (15:37 +0000)]
[X86][AVX512] [X86][AVX512] add convert float to half

convert float to half with mask/maskz for the reg to reg version and mask for the reg to mem version (there is no maskz version for reg to mem).

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

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

8 years ago[ARM] Expand ROTL and ROTR of vector value types
Charlie Turner [Tue, 27 Oct 2015 10:25:20 +0000 (10:25 +0000)]
[ARM] Expand ROTL and ROTR of vector value types

Summary: After D13851 landed, we saw backend crashes when compiling the reduced test case included in this patch. The right fix seems to be to allow these vector types for expansion in instruction selection.

Reviewers: rengolin, t.p.northover

Subscribers: RKSimon, t.p.northover, aemerson, llvm-commits, rengolin

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

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

8 years agoDo not use "else" when both branches return (NFC)
Mehdi Amini [Tue, 27 Oct 2015 08:12:08 +0000 (08:12 +0000)]
Do not use "else" when both branches return (NFC)

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

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

8 years ago[ScalarEvolutionExpander] Properly insert no-op casts + EH Pads
David Majnemer [Tue, 27 Oct 2015 07:36:42 +0000 (07:36 +0000)]
[ScalarEvolutionExpander] Properly insert no-op casts + EH Pads

We want to insert no-op casts as close as possible to the def.  This is
tricky when the cast is of a PHI node and the BasicBlocks between the
def and the use cannot hold any instructions.  Iteratively walk EH pads
until we hit a non-EH pad.

This fixes PR25326.

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

8 years ago[X86] Make elfiamcu an OS, not an environment.
Michael Kuperstein [Tue, 27 Oct 2015 07:23:59 +0000 (07:23 +0000)]
[X86] Make elfiamcu an OS, not an environment.

GNU tools require elfiamcu to take up the entire OS field, so, e.g.
i?86-*-linux-elfiamcu is not considered a legal triple.
Make us compatible.

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

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

8 years ago[SimplifyLibCalls] Use range-based loop. No functional change.
Davide Italiano [Tue, 27 Oct 2015 04:17:51 +0000 (04:17 +0000)]
[SimplifyLibCalls] Use range-based loop. No functional change.

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

8 years agoConvert cost table lookup functions to return a pointer to the entry or nullptr inste...
Craig Topper [Tue, 27 Oct 2015 04:14:24 +0000 (04:14 +0000)]
Convert cost table lookup functions to return a pointer to the entry or nullptr instead of the index.

This avoid mentioning the table name an extra time and allows the lookup to be done directly in the ifs by relying on the bool conversion of the pointer.

While there make use of ArrayRef and std::find_if.

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

8 years ago[function-attrs] Refactor code to handle shorter code with early exits.
Chandler Carruth [Tue, 27 Oct 2015 01:41:43 +0000 (01:41 +0000)]
[function-attrs] Refactor code to handle shorter code with early exits.

No functionality changed here, but the indentation is substantially
reduced and IMO the code is much easier to read. I've also added some
helpful comments.

This is just a clean-up I wrote while studying the code, and that has
been in my backlog for a while.

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

8 years ago[ValueTracking] Don't special case wrapped ConstantRanges; NFCI
Sanjoy Das [Tue, 27 Oct 2015 01:36:06 +0000 (01:36 +0000)]
[ValueTracking] Don't special case wrapped ConstantRanges; NFCI

Use `getUnsignedMax` directly instead of special casing a wrapped

The previous code would have been "buggy" (and this would have been a
semantic change) if LLVM allowed !range metadata to denote full
ranges. E.g. in

  %val = load i1, i1* %ptr, !range !{i1 1, i1 1} ;; == full set

ValueTracking would conclude that the high bit (IOW the only bit) in
%val was zero.

Since !range metadata does not allow empty or full ranges, this change
is just a minor stylistic improvement.

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

8 years ago[x86] replace integer logic ops with packed SSE FP logic ops
Sanjay Patel [Tue, 27 Oct 2015 01:28:07 +0000 (01:28 +0000)]
[x86] replace integer logic ops with packed SSE FP logic ops

If we have an operand to a bitwise logic op that's already in
an XMM register and the result is going to be sent to an XMM
register, then use an SSE logic op to avoid moves between the
integer and vector register files.

Related commits:

This should solve PR22428:

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

8 years ago[SCEV] Refactor out ScalarEvolution::getDataLayout; NFC
Sanjoy Das [Tue, 27 Oct 2015 00:52:09 +0000 (00:52 +0000)]
[SCEV] Refactor out ScalarEvolution::getDataLayout; NFC

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

8 years agoFix llc crash processing S/UREM for -Oz builds caused by rL250825.
Steve King [Tue, 27 Oct 2015 00:14:06 +0000 (00:14 +0000)]
Fix llc crash processing S/UREM for -Oz builds caused by rL250825.

When taking the remainder of a value divided by a constant, visitREM()
attempts to convert the REM to a longer but faster sequence of instructions.
This conversion calls combine() on a speculative DIV instruction. Commit
rL250825 may cause this combine() to return a DIVREM, corrupting nearby nodes.
Flow eventually hits unreachable().

This patch adds a test case and a check to prevent visitREM() from trying
to convert the REM instruction in cases where a DIVREM is possible.
See http://reviews.llvm.org/D14035

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

8 years agoadd FP logic test cases to show current codegen (PR22428)
Sanjay Patel [Mon, 26 Oct 2015 23:52:42 +0000 (23:52 +0000)]
add FP logic test cases to show current codegen (PR22428)

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

8 years ago[mips][ias] Fold needsExpansion() and expandInstruction() together. NFC.
Daniel Sanders [Mon, 26 Oct 2015 23:50:00 +0000 (23:50 +0000)]
[mips][ias] Fold needsExpansion() and expandInstruction() together. NFC.

Previously we maintained two separate switch statements that had to be kept in
sync. This patch merges them into a single switch.

Reviewers: vkalintiris

Subscribers: llvm-commits, dsanders

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

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

8 years agoSwitch ownership of miscellaneous ARM target to myself.
Tim Northover [Mon, 26 Oct 2015 23:33:13 +0000 (23:33 +0000)]
Switch ownership of miscellaneous ARM target to myself.

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

8 years ago[x86] Make the vselect-minmax test 2x to 3x faster by deleting all the
Chandler Carruth [Mon, 26 Oct 2015 22:54:53 +0000 (22:54 +0000)]
[x86] Make the vselect-minmax test 2x to 3x faster by deleting all the
instructions that aren't relevant for instruction selection of vector
min and max.

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

8 years agoUse Twin instead of std::to_string.
Oleksiy Vyalov [Mon, 26 Oct 2015 22:37:36 +0000 (22:37 +0000)]
Use Twin instead of std::to_string.


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

8 years agoFix indents. It's a follow up to r251353.
Ivan Krasin [Mon, 26 Oct 2015 22:35:40 +0000 (22:35 +0000)]
Fix indents. It's a follow up to r251353.

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

8 years ago[LLVMSymbolize] Don't use LLVMSymbolizer::Options in ModuleInfo. NFC.
Alexey Samsonov [Mon, 26 Oct 2015 22:34:56 +0000 (22:34 +0000)]
[LLVMSymbolize] Don't use LLVMSymbolizer::Options in ModuleInfo. NFC.

LLVMSymbolizer::Options is mostly used in LLVMSymbolizer class anyway.
Let's keep their usage restricted to that class, especially given that
it's worth to move ModuleInfo to a different header, independent from
the symbolizer class.

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

8 years agoreorganize logic; NFCI (retry r251349)
Sanjay Patel [Mon, 26 Oct 2015 21:54:14 +0000 (21:54 +0000)]
reorganize logic; NFCI (retry r251349)

This is a preliminary step before adding another optimization
to PerformBITCASTCombine().

..and I really hope it's NFC this time!

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

8 years agoMove imported entities into DwarfCompilationUnit to speed up LTO linking.
Ivan Krasin [Mon, 26 Oct 2015 21:36:35 +0000 (21:36 +0000)]
Move imported entities into DwarfCompilationUnit to speed up LTO linking.

In particular, this CL speeds up the official Chrome linking with LTO by

See more details in https://crbug.com/542426

Reviewers: dblaikie

Subscribers: jevinskie

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

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

8 years agoARM: make sure VFP loads and stores are properly aligned.
Tim Northover [Mon, 26 Oct 2015 21:32:53 +0000 (21:32 +0000)]
ARM: make sure VFP loads and stores are properly aligned.

Both VLDRS and VLDRD fault if the memory is not 4 byte aligned, which wasn't
really being checked before, leading to faults at runtime.

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

8 years agorevert r251349; it included code for a functional change
Sanjay Patel [Mon, 26 Oct 2015 21:28:02 +0000 (21:28 +0000)]
revert r251349; it included code for a functional change

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

8 years agoreorganize logic; NFCI
Sanjay Patel [Mon, 26 Oct 2015 21:24:09 +0000 (21:24 +0000)]
reorganize logic; NFCI

This is a preliminary step before adding another optimization
to PerformBITCASTCombine().

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

8 years agoInitialize BasicAAWrapperPass in it's constructor
Keno Fischer [Mon, 26 Oct 2015 21:22:58 +0000 (21:22 +0000)]
Initialize BasicAAWrapperPass in it's constructor

Summary: This idiom is used elsewhere in LLVM, but was overlooked here.

Reviewers: chandlerc

Subscribers: llvm-commits

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

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

8 years agoFix build failure on GCC 4.7 (old libstdc++ doesn't have std::map::emplace).
Alexey Samsonov [Mon, 26 Oct 2015 21:20:37 +0000 (21:20 +0000)]
Fix build failure on GCC 4.7 (old libstdc++ doesn't have std::map::emplace).

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

8 years agoRemove use of std::map<>::emplace which is not supported on some older versions of...
David Blaikie [Mon, 26 Oct 2015 21:10:36 +0000 (21:10 +0000)]
Remove use of std::map<>::emplace which is not supported on some older versions of libstdc++

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

8 years agoRemove unused local variable. NFC.
Diego Novillo [Mon, 26 Oct 2015 20:50:26 +0000 (20:50 +0000)]
Remove unused local variable. NFC.

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

8 years agoFix tests.
Peter Collingbourne [Mon, 26 Oct 2015 20:49:49 +0000 (20:49 +0000)]
Fix tests.

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

8 years agoARM/ELF: Restore original (pre-r251322) logic for deciding whether to use GOT.
Peter Collingbourne [Mon, 26 Oct 2015 20:46:44 +0000 (20:46 +0000)]
ARM/ELF: Restore original (pre-r251322) logic for deciding whether to use GOT.

Unbreaks linking with gold, which cannot resolve direct relocations referring
to global symbols.

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

8 years ago[LLVMSymbolize] Use symbol table only if function linkage name was requested.
Alexey Samsonov [Mon, 26 Oct 2015 20:12:29 +0000 (20:12 +0000)]
[LLVMSymbolize] Use symbol table only if function linkage name was requested.

Now it's enough to just specify -functions=short without additionally
providing -use-symbol-table=false.

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

8 years agoFix build error by fully qualifying llvm::make_unique.
Alexey Samsonov [Mon, 26 Oct 2015 20:12:27 +0000 (20:12 +0000)]
Fix build error by fully qualifying llvm::make_unique.

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

8 years agoOptimize StringTableBuilder.
Rui Ueyama [Mon, 26 Oct 2015 19:58:29 +0000 (19:58 +0000)]
Optimize StringTableBuilder.

This is a patch to improve StringTableBuilder's performance. That class'
finalize function is very hot particularly in LLD because the function
does tail-merge strings in string tables or SHF_MERGE sections.

Generic std::sort-style sorter is not efficient for sorting strings.
The function implemented in this patch seems to be more efficient.

Here's a benchmark of LLD to link Clang with or without this patch.
The numbers are medians of 50 runs.

real 0m0.455s
real 0m0.430s (5.5% faster)

real 0m0.487s
real 0m0.452s (7.2% faster)

Since that is a benchmark of the whole linker, the speedup of
StringTableBuilder itself is much more than that.


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

8 years ago[LLVMSymbolize] Use std::unique_ptr more extensively to clarify ownership.
Alexey Samsonov [Mon, 26 Oct 2015 19:41:23 +0000 (19:41 +0000)]
[LLVMSymbolize] Use std::unique_ptr more extensively to clarify ownership.

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

8 years ago[RS4GC] Strip noalias attribute after statepoint rewrite
Igor Laevsky [Mon, 26 Oct 2015 19:06:01 +0000 (19:06 +0000)]
[RS4GC] Strip noalias attribute after statepoint rewrite

We should remove noalias along with dereference and dereference_or_null attributes
because statepoint could potentially touch the entire heap including noalias objects.

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

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

8 years agoSamplePGO - Add optimization reports.
Diego Novillo [Mon, 26 Oct 2015 18:52:53 +0000 (18:52 +0000)]
SamplePGO - Add optimization reports.

This adds a couple of optimization remarks to the SamplePGO
transformation. When it decides to inline a hot function (to mimic the
inline stack and repeat useful inline decisions in the original build).

It will also report branch destinations. For instance, given the code

     6      if (i < 1000)
     7        sum -= i;
     8      else
     9        sum += -i * rand();

If the 'else' branch is taken most of the time, building this code with
-Rpass=sample-profile will produce:

a.cc:9:14: remark: most popular destination for conditional branches at small.cc:6:9 [-Rpass=sample-profile]
      sum += -i * rand();

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

8 years agoRemove assert(false) in favor of asserting the if conditional it is contained within.
David Blaikie [Mon, 26 Oct 2015 18:41:13 +0000 (18:41 +0000)]
Remove assert(false) in favor of asserting the if conditional it is contained within.

Also adjust the code to avoid 3 redundant map lookups.

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

8 years agoMove the canonical header to the top of its matching cpp file as per coding convention
David Blaikie [Mon, 26 Oct 2015 18:40:56 +0000 (18:40 +0000)]
Move the canonical header to the top of its matching cpp file as per coding convention

This ensures that the header will be verified to be standalone (and
avoid mistakes like the one fixed in r251178)

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

8 years agoAdd an (optional) identification block in the bitcode
Mehdi Amini [Mon, 26 Oct 2015 18:37:00 +0000 (18:37 +0000)]
Add an (optional) identification block in the bitcode

Processing bitcode from a different LLVM version can lead to
unexpected behavior. The LLVM project guarantees autoupdating
bitcode from a previous minor revision for the same major, but
can't make any promise when reading bitcode generated from a
either a non-released LLVM, a vendor toolchain, or a "future"
LLVM release. This patch aims at being more user-friendly and
allows a bitcode produce to emit an optional block at the
beginning of the bitcode that will contains an opaque string
intended to describe the bitcode producer information. The
bitcode reader will dump this information alongside any error it

The optional block also includes an "epoch" number, monotonically
increasing when incompatible changes are made to the bitcode. The
reader will reject bitcode whose epoch is different from the one

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

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

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

8 years ago[safestack] Fast access to the unsafe stack pointer on AArch64/Android.
Evgeniy Stepanov [Mon, 26 Oct 2015 18:28:25 +0000 (18:28 +0000)]
[safestack] Fast access to the unsafe stack pointer on AArch64/Android.

Android libc provides a fixed TLS slot for the unsafe stack pointer,
and this change implements direct access to that slot on AArch64 via
__builtin_thread_pointer() + offset.

This change also moves more code into TargetLowering and its
target-specific subclasses to get rid of target-specific codegen
in SafeStackPass.

This change does not touch the ARM backend because ARM lowers
builting_thread_pointer as aeabi_read_tp, which is not available
on Android.

The previous iteration of this change was reverted in r250461. This
version leaves the generic, compiler-rt based implementation in
SafeStack.cpp instead of moving it to TargetLoweringBase in order to
allow testing without a TargetMachine.

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

8 years agoBitstreamWriter: Fix integer overflow.
Peter Collingbourne [Mon, 26 Oct 2015 18:23:21 +0000 (18:23 +0000)]
BitstreamWriter: Fix integer overflow.

We were previously overflowing a 32-bit multiply operation when emitting large
(>512MB) bitcode files, resulting in corrupted bitcode. Fix by extending
one of the operands to 64 bits.

There are a few other 32-bit integer types in this code that seem like they
also ought to be extended to 64 bits; this will be done separately.

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

8 years agoARM/ELF: Better codegen for global variable addresses.
Peter Collingbourne [Mon, 26 Oct 2015 18:23:16 +0000 (18:23 +0000)]
ARM/ELF: Better codegen for global variable addresses.

In PIC mode we were previously computing global variable addresses (or GOT
entry addresses) by adding the PC, the PC-relative GOT displacement and
the GOT-relative symbol/GOT entry displacement. Because the latter two
displacements are fixed, we ended up performing one more addition than

This change causes us to compute addresses using a single PC-relative
displacement, resulting in a shorter code sequence. This reduces code size
by about 4% in a recent build of Chromium for Android.

As a result of this change we no longer need to compute the GOT base address
in the ARM backend, which allows us to remove the Global Base Reg pass and
SDAG lowering for the GOT.

We also now no longer use the GOT when addressing a symbol which is known
to be defined in the same linkage unit. Specifically, the symbol must have
either hidden visibility or a strong definition in the current module in
order to not use the the GOT.

This is a change from the previous behaviour where we would use the GOT to
address externally visible symbols defined in the same module. I think the
only cases where this could matter are cases involving symbol interposition,
but we don't really support that well anyway.

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

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

8 years agoCleanup test case debug info. NFC.
Diego Novillo [Mon, 26 Oct 2015 18:14:44 +0000 (18:14 +0000)]
Cleanup test case debug info. NFC.

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

8 years agoRefactor: Simplify boolean conditional return statements in lib/Transforms/Instrument...
Alexey Samsonov [Mon, 26 Oct 2015 18:06:40 +0000 (18:06 +0000)]
Refactor: Simplify boolean conditional return statements in lib/Transforms/Instrumentation

Summary: Use clang-tidy to simplify boolean conditional return statements.

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

Patch by Richard (legalize@xmission.com)!

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

8 years agoCheck the case that the numerator and denominator are both zeros when getting edge...
Cong Hou [Mon, 26 Oct 2015 18:00:17 +0000 (18:00 +0000)]
Check the case that the numerator and denominator are both zeros when getting edge probabilities in BPI and return 100% in this case.

This issue is triggered in PGO mode when bootstrapping LLVM. It seems that it is not guaranteed that edge weights are always greater than zero which are read from profile data.

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

8 years agoMove parts of llvm-symbolizer tool into LLVMSymbolize library.
Alexey Samsonov [Mon, 26 Oct 2015 17:56:12 +0000 (17:56 +0000)]
Move parts of llvm-symbolizer tool into LLVMSymbolize library.

Summary: See http://lists.llvm.org/pipermail/llvm-dev/2015-October/091624.html

Reviewers: echristo

Subscribers: llvm-commits, aizatsky

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

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

8 years ago[SystemZ] LTGFR use regclass should be GR32, not GR64.
Jonas Paulsson [Mon, 26 Oct 2015 15:03:49 +0000 (15:03 +0000)]
[SystemZ] LTGFR use regclass should be GR32, not GR64.

Discovered by testing int-cmp-44.ll with -verify-machineinstrs (added to
test run).

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

8 years ago[SystemZ] Also clear kill flag for index reg in splitMove().
Jonas Paulsson [Mon, 26 Oct 2015 15:03:41 +0000 (15:03 +0000)]
[SystemZ] Also clear kill flag for index reg in splitMove().

Discovered by running fp-move-05.ll with -verify-machineinstrs (added
to test case run).

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

8 years ago[SystemZ] Don't forget the CC def op on LTEBRCompare pseudos
Jonas Paulsson [Mon, 26 Oct 2015 15:03:32 +0000 (15:03 +0000)]
[SystemZ] Don't forget the CC def op on LTEBRCompare pseudos

Discovered by running fp-cmp-02.ll with -verify-machineinstrs (now added
to test run).

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

8 years ago[SystemZ] Tie operands in SystemZShorteInst if MI becomes 2-address.
Jonas Paulsson [Mon, 26 Oct 2015 15:03:07 +0000 (15:03 +0000)]
[SystemZ] Tie operands in SystemZShorteInst if MI becomes 2-address.

Discovered by testing fp-add-02.ll with -verify-machineinstrs.

Test case updated to always run with -verify-machineinstrs.

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

8 years ago[mips] Check for the correct error message in tests for interrupt attributes.
Vasileios Kalintiris [Mon, 26 Oct 2015 14:24:30 +0000 (14:24 +0000)]
[mips] Check for the correct error message in tests for interrupt attributes.

Instead of XFAIL-ing the tests with the wrong usage of the "interrupt"
attribute, we should check that we emit the correct error messages to
the user.

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

8 years ago[ValueTracking] Extend r251146 to catch a fairly common case
James Molloy [Mon, 26 Oct 2015 14:10:46 +0000 (14:10 +0000)]
[ValueTracking] Extend r251146 to catch a fairly common case

Even though we may not know the value of the shifter operand, it's possible we know the shifter operand is non-zero. This can allow us to infer more known bits - for example:

  %1 = load %p !range {1, 5}
  %2 = shl %q, %1

We don't know %1, but we do know that it is nonzero so %2[0] is known zero, and importantly %2 is known non-zero.

Calling isKnownNonZero is nontrivially expensive so use an Optional to run it lazily and cache its result.

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

8 years ago[SCEV] Fix issues found during the review of r251283. NFC.
Silviu Baranga [Mon, 26 Oct 2015 13:50:06 +0000 (13:50 +0000)]
[SCEV] Fix issues found during the review of r251283. NFC.

Replace (const SCEVAddRecExpr *) with cast<SCEVAddRecExpr>.

Rename SCEVApplyRewriter to SCEVLoopAddRecRewriter (which is a more
appropriate name) since the description is "takes a scalar evolution
expression and applies the Map (Loop -> SCEV) to all AddRecExprs."

Subscribers: llvm-commits, sanjoy

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

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

8 years agoLoop Vectorizer - skipping "bitcast" before GEP
Elena Demikhovsky [Mon, 26 Oct 2015 13:42:41 +0000 (13:42 +0000)]
Loop Vectorizer - skipping "bitcast" before GEP

Vectorization of memory instruction (Load/Store) is possible when the pointer is coming from GEP. The GEP analysis allows to estimate the profit.
In some cases we have a "bitcast" between GEP and memory instruction.
I added code that skips the "bitcast".


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

8 years agoTests: be slightly more specific to avoid conflict with path.
Tim Northover [Mon, 26 Oct 2015 13:40:03 +0000 (13:40 +0000)]
Tests: be slightly more specific to avoid conflict with path.

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

8 years agofix test errors (on windows) for commit r251287
Igor Breger [Mon, 26 Oct 2015 13:31:41 +0000 (13:31 +0000)]
fix test errors (on windows) for commit r251287

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

8 years agoAVX512: Enabled VPBROADCASTB lowering for v64i8 vectors.
Igor Breger [Mon, 26 Oct 2015 13:01:02 +0000 (13:01 +0000)]
AVX512: Enabled VPBROADCASTB lowering for v64i8 vectors.

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

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

8 years ago[mips] Interrupt attribute support for mips32r2+.
Vasileios Kalintiris [Mon, 26 Oct 2015 12:38:43 +0000 (12:38 +0000)]
[mips] Interrupt attribute support for mips32r2+.

This patch adds support for using the "interrupt" attribute on Mips
for interrupt handling functions. At this time only mips32r2+ with the
o32 ABI with the static relocation model is supported. Unsupported
configurations will be rejected

Patch by Simon Dardis (+ clang-format & some trivial changes to follow the
LLVM coding standards by me).

Reviewers: mpf, dsanders

Subscribers: dsanders, vkalintiris, llvm-commits

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

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

8 years agoAVX-512: Use correct extract vector length.
Igor Breger [Mon, 26 Oct 2015 12:26:34 +0000 (12:26 +0000)]
AVX-512: Use correct extract vector length.

Bug https://llvm.org/bugs/show_bug.cgi?id=25318

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

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

8 years ago[SCEV] Factor out common visiting patterns for SCEV rewriters. NFC.
Silviu Baranga [Mon, 26 Oct 2015 11:18:31 +0000 (11:18 +0000)]
[SCEV] Factor out common visiting patterns for SCEV rewriters. NFC.

Add a SCEVRewriteVisitor class which contains the common
visiting patterns used when rewriting SCEVs.

SCEVParameterRewriter and SCEVApplyRewriter now inherit
from SCEVRewriteVisitor (and are therefore much simpler).

Reviewers: anemet, mzolotukhin, sanjoy

Subscribers: rengolin, llvm-commits, sanjoy

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

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

8 years ago[InstCombine] Teach instcombine not to create extra PHI nodes when folding GEPs
Silviu Baranga [Mon, 26 Oct 2015 10:25:05 +0000 (10:25 +0000)]
[InstCombine] Teach instcombine not to create extra PHI nodes when folding GEPs

InstCombine tries to transform GEP(PHI(GEP1, GEP2, ..)) into GEP(GEP(PHI(...))
when possible. However, this may leave the old PHI node around. Even if we
do end up folding the GEPs, having an extra PHI node might not be beneficial.

This change makes the transformation more conservative. We now only do this if
the PHI has only one use, and can therefore be removed after the transformation.

Reviewers: jmolloy, majnemer

Subscribers: mcrosier, mssimpso, llvm-commits

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

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

8 years ago[ARM] Handle the inline asm constraint type 'o'
James Molloy [Mon, 26 Oct 2015 10:04:52 +0000 (10:04 +0000)]
[ARM] Handle the inline asm constraint type 'o'

This means "memory with offset" and requires very little plumbing to get working. This fixes PR25317.

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