oota-llvm.git
9 years ago[Object/ELF] Don't confuse isDefined() and isCommon.
Davide Italiano [Sun, 7 Jun 2015 02:45:19 +0000 (02:45 +0000)]
[Object/ELF] Don't confuse isDefined() and isCommon.

Reported by Rafael Espindola. Pointy-hat to me.

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

9 years agoTeaching llvm-mc how to understand the defsym command line option. This allows integ...
Colin LeMahieu [Sun, 7 Jun 2015 01:46:24 +0000 (01:46 +0000)]
Teaching llvm-mc how to understand the defsym command line option.  This allows integer-constant symbols to be defined on the command line and used during assembly.

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

9 years ago[Object/ELF] Provide helpers for symbol types.
Davide Italiano [Sat, 6 Jun 2015 22:54:09 +0000 (22:54 +0000)]
[Object/ELF] Provide helpers for symbol types.

These were, originally, in a different form in lld.
They can be reused for other tools, e.g. llvm-readobj.

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

9 years ago[InstCombine, InstSimplify] Move xforms from Combine to Simplify
David Majnemer [Sat, 6 Jun 2015 22:40:21 +0000 (22:40 +0000)]
[InstCombine, InstSimplify] Move xforms from Combine to Simplify

There were several SelectInst combines that always returned an existing
instruction instead of modifying an old one or creating a new one.
These are prime candidates for moving to InstSimplify.

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

9 years agoUse early return idiom. NFC
Filipe Cabecinhas [Sat, 6 Jun 2015 20:44:53 +0000 (20:44 +0000)]
Use early return idiom. NFC

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

9 years ago[MC] Common symbols weren't being checked for redeclaration which allowed an assembly...
Colin LeMahieu [Sat, 6 Jun 2015 20:12:40 +0000 (20:12 +0000)]
[MC] Common symbols weren't being checked for redeclaration which allowed an assembly file to generate an assertion in setCommon(): !isCommon().  This change allows redeclaration as long as the size and alignment match exactly, otherwise report a fatal error.

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

9 years ago[LoopUnroll] Fix truncation bug in canUnrollCompletely.
Sanjoy Das [Sat, 6 Jun 2015 05:24:10 +0000 (05:24 +0000)]
[LoopUnroll] Fix truncation bug in canUnrollCompletely.

Summary:
canUnrollCompletely takes `unsigned` values for `UnrolledCost` and
`RolledDynamicCost` but is passed in `uint64_t`s that are silently
truncated.  Because of this, when `UnrolledSize` is a large integer
that has a small remainder with UINT32_MAX, LLVM tries to completely
unroll loops with high trip counts.

Reviewers: mzolotukhin, chandlerc

Subscribers: llvm-commits

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

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

9 years ago[CVP] Don't assume Constants of type i1 can be known to be true or false
David Majnemer [Sat, 6 Jun 2015 04:56:51 +0000 (04:56 +0000)]
[CVP] Don't assume Constants of type i1 can be known to be true or false

CVP wants to analyze the condition operand of a select along an edge.
It succeeds in getting back a Constant but not a ConstantInt.  Instead,
it gets a ConstantExpr.  It then assumes that the Constant must be equal
to false because it isn't equal to true.

Instead, perform an additional comparison.

This fixes PR23752.

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

9 years ago[InstCombine] Don't miscompile select to poison
David Majnemer [Sat, 6 Jun 2015 02:30:43 +0000 (02:30 +0000)]
[InstCombine] Don't miscompile select to poison

If we have (select a, b, c), it is sometimes valid to simplify this to a
single select operand.  However, doing so is only valid if the
computation doesn't inject poison into the computation.

It might be helpful to consider the following example:
  (select (icmp ne %i, INT_MAX), (add nsw %i, 1), INT_MIN)

The select is equivalent to (add %i, 1) but not (add nsw %i, 1).

Self hosting on x86_64 revealed that this occurs very, very rarely so
bailing out is hopefully pretty reasonable.

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

9 years agoHandle 16 bit PC relative relocations.
Rafael Espindola [Sat, 6 Jun 2015 02:29:56 +0000 (02:29 +0000)]
Handle 16 bit PC relative relocations.

Fixes pr23771.

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

9 years agoTargetParser: Fix comments in enum(s) introduced in r239150. [-Wdocumentation]
NAKAMURA Takumi [Sat, 6 Jun 2015 01:41:35 +0000 (01:41 +0000)]
TargetParser: Fix comments in enum(s) introduced in r239150. [-Wdocumentation]

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

9 years ago[TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers...
Craig Topper [Sat, 6 Jun 2015 01:34:04 +0000 (01:34 +0000)]
[TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC

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

9 years ago[TableGen] Remove trailing whitespace, add space between 'if' and paren, other format...
Craig Topper [Sat, 6 Jun 2015 01:34:01 +0000 (01:34 +0000)]
[TableGen] Remove trailing whitespace, add space between 'if' and paren, other formatting fixes. NFC

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

9 years ago[TableGen] Remove unnecessary temporary. NFC
Craig Topper [Sat, 6 Jun 2015 01:34:00 +0000 (01:34 +0000)]
[TableGen] Remove unnecessary temporary. NFC

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

9 years ago[TableGen] Fold variable declaration/initialization into if condition for a couple...
Craig Topper [Sat, 6 Jun 2015 01:33:58 +0000 (01:33 +0000)]
[TableGen] Fold variable declaration/initialization into if condition for a couple short lived variables. NFC

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

9 years ago[TableGen] Remove unnecessary outer 'if' and merge it's conditions into the inner...
Craig Topper [Sat, 6 Jun 2015 01:33:55 +0000 (01:33 +0000)]
[TableGen] Remove unnecessary outer 'if' and merge it's conditions into the inner 'if's. NFC

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

9 years ago[TableGen] Fold variable declarations with their assignments. NFC
Craig Topper [Sat, 6 Jun 2015 00:44:45 +0000 (00:44 +0000)]
[TableGen] Fold variable declarations with their assignments. NFC

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

9 years ago[TableGen] Correct the documentation for 'foreach' in the Language Intro.
Craig Topper [Sat, 6 Jun 2015 00:44:42 +0000 (00:44 +0000)]
[TableGen] Correct the documentation for 'foreach' in the Language Intro.

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

9 years ago[dsymutil] Fix misspelled CHECK line.
Frederic Riss [Fri, 5 Jun 2015 23:46:18 +0000 (23:46 +0000)]
[dsymutil] Fix misspelled CHECK line.

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

9 years ago[dsymutil] Add support for linking the debug_frame section.
Frederic Riss [Fri, 5 Jun 2015 23:06:11 +0000 (23:06 +0000)]
[dsymutil] Add support for linking the debug_frame section.

Linking the debug frame section is actually very easy as we just have to
patch the start address in the FDE header and then copy the rest of the
FDE without even looking at it. The only small complexity comes from the
handling of the CIEs that we should unique across object file. This is
also really easy by using a StringMap keyed on the raw contents of the
CIE.

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

9 years agoMove the code in TargetPassConfig::addPass that inserts machine printer pass to
Akira Hatanaka [Fri, 5 Jun 2015 21:58:14 +0000 (21:58 +0000)]
Move the code in TargetPassConfig::addPass that inserts machine printer pass to
the overloaded version of addPass which takes Pass*.

This change enables inserting the machine printer pass when the overloaded
version of addPass that takes Pass* is called to add a pass, instead of the
one which takes AnalysisID. I need this to prevent make-check tests from
failing when I commit another patch later.

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

9 years ago[dsymutil] Rename a variable to appease some bots.
Frederic Riss [Fri, 5 Jun 2015 21:21:57 +0000 (21:21 +0000)]
[dsymutil] Rename a variable to appease some bots.

Anyway having the type and the name of the member being the same
thing wasn't the wisest of the choices.

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

9 years ago[dsymutil] Have the YAML deserialization rewrite the object address of symbols.
Frederic Riss [Fri, 5 Jun 2015 21:12:07 +0000 (21:12 +0000)]
[dsymutil] Have the YAML deserialization rewrite the object address of symbols.

The main use of the YAML debug map format is for testing inside LLVM. If we have IR
files in the tests used to generate object files, then we obviously don't know the
addresses of the symbols inside the object files beforehand.

This change lets the YAML import lookup the addresses in the object files and rewrite
them. This will allow to have test that really don't need any binary input.

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

9 years ago[dsymutil] Apply clang-format. NFC
Frederic Riss [Fri, 5 Jun 2015 20:27:07 +0000 (20:27 +0000)]
[dsymutil] Apply clang-format. NFC

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

9 years ago[dsymutil] Out-line the YAML serialization code. NFC
Frederic Riss [Fri, 5 Jun 2015 20:27:04 +0000 (20:27 +0000)]
[dsymutil] Out-line the YAML serialization code. NFC

It will get a bit bigger in an upcoming commit. No need to have all
of that in the header.

Also move parseYAMLDebugMap() to the same place as the serialization
code. This way it will be able to share a private Context object with
it.

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

9 years agoRevert "[InstCombine] Rephrase fix to SimplifyWithOpReplaced"
Renato Golin [Fri, 5 Jun 2015 18:24:12 +0000 (18:24 +0000)]
Revert "[InstCombine] Rephrase fix to SimplifyWithOpReplaced"

This reverts commit r239141. This commit was an attempt to reintroduce
a previous patch that broke many self-hosting bots with clang timeouts,
but it still has slowdown issues, at least  on ARM, increasing the
compilation time (stage 2, clang's) by 5x.

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

9 years agoRefactor padding writing into a helper function.
Rafael Espindola [Fri, 5 Jun 2015 18:21:00 +0000 (18:21 +0000)]
Refactor padding writing into a helper function.

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

9 years ago[InstCombine][NFC] Add a ``break;`` statement.
Sanjoy Das [Fri, 5 Jun 2015 18:04:46 +0000 (18:04 +0000)]
[InstCombine][NFC] Add a ``break;`` statement.

This change is NFC because both the ``break;`` and the fall through end
up returning immediately. However, this helps clarify intent and also
ensures correctness in case more ``case`` blocks are added later.

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

9 years ago[InstCombine] Fix PR23751.
Sanjoy Das [Fri, 5 Jun 2015 18:04:42 +0000 (18:04 +0000)]
[InstCombine] Fix PR23751.

PR23751 was caused by a missing ``break;`` in r234388.

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

9 years agoRevert r238473, "Thumb2: Modify codegen for memcpy intrinsic to prefer LDM/STM."
Peter Collingbourne [Fri, 5 Jun 2015 18:01:28 +0000 (18:01 +0000)]
Revert r238473, "Thumb2: Modify codegen for memcpy intrinsic to prefer LDM/STM."
as it caused miscompilations and assertion failures (PR23768,
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150601/280380.html).

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

9 years agoSave a map lookup. NFC.
Rafael Espindola [Fri, 5 Jun 2015 17:54:25 +0000 (17:54 +0000)]
Save a map lookup. NFC.

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

9 years agoDAGCombiner: don't duplicate (fmul x, c) in visitFNEG if fneg is free
Fiona Glaser [Fri, 5 Jun 2015 17:52:34 +0000 (17:52 +0000)]
DAGCombiner: don't duplicate (fmul x, c) in visitFNEG if fneg is free

For targets with a free fneg, this fold is always a net loss if it
ends up duplicating the multiply, so definitely avoid it.

This might be true for some targets without a free fneg too, but
I'll leave that for future investigation.

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

9 years agoRangify more for loops in LegacyPassManager.cpp.
Yaron Keren [Fri, 5 Jun 2015 17:48:47 +0000 (17:48 +0000)]
Rangify more for loops in LegacyPassManager.cpp.

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

9 years agoRemove stray semi-colon, NFC
Duncan P. N. Exon Smith [Fri, 5 Jun 2015 17:22:00 +0000 (17:22 +0000)]
Remove stray semi-colon, NFC

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

9 years ago[Unroll] Rework the naming and structure of the new unroll heuristics.
Chandler Carruth [Fri, 5 Jun 2015 17:01:43 +0000 (17:01 +0000)]
[Unroll] Rework the naming and structure of the new unroll heuristics.

The new naming is (to me) much easier to understand. Here is a summary
of the new state of the world:

- '*Threshold' is the threshold for full unrolling. It is measured
  against the estimated unrolled cost as computed by getUserCost in TTI
  (or CodeMetrics, etc). We will exceed this threshold when unrolling
  loops where unrolling exposes a significant degree of simplification
  of the logic within the loop.
- '*PercentDynamicCostSavedThreshold' is the percentage of the loop's
  estimated dynamic execution cost which needs to be saved by unrolling
  to apply a discount to the estimated unrolled cost.
- '*DynamicCostSavingsDiscount' is the discount applied to the estimated
  unrolling cost when the dynamic savings are expected to be high.

When actually analyzing the loop, we now produce both an estimated
unrolled cost, and an estimated rolled cost. The rolled cost is notably
a dynamic estimate based on our analysis of the expected execution of
each iteration.

While we're still working to build up the infrastructure for making
these estimates, to me it is much more clear *how* to make them better
when they have reasonably descriptive names. For example, we may want to
apply estimated (from heuristics or profiles) dynamic execution weights
to the *dynamic* cost estimates. If we start doing that, we would also
need to track the static unrolled cost and the dynamic unrolled cost, as
only the latter could reasonably be weighted by profile information.

This patch is sadly not without functionality change for the new unroll
analysis logic. Buried in the heuristic management were several things
that surprised me. For example, we never subtracted the optimized
instruction count off when comparing against the unroll heursistics!
I don't know if this just got lost somewhere along the way or what, but
with the new accounting of things, this is much easier to keep track of
and we use the post-simplification cost estimate to compare to the
thresholds, and use the dynamic cost reduction ratio to select whether
we can exceed the baseline threshold.

The old values of these flags also don't necessarily make sense. My
impression is that none of these thresholds or discounts have been tuned
yet, and so they're just arbitrary placehold numbers. As such, I've not
bothered to adjust for the fact that this is now a discount and not
a tow-tier threshold model. We need to tune all these values once the
logic is ready to be enabled.

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

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

9 years ago[dsymutil] Handle the -oso-prepend-path option when the input is a YAML debug map
Frederic Riss [Fri, 5 Jun 2015 16:35:44 +0000 (16:35 +0000)]
[dsymutil] Handle the -oso-prepend-path option when the input is a YAML debug map

All the tests using a YAML debug map will need this.

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

9 years ago[bpf] rename triple names bpf_be -> bpfeb
Alexei Starovoitov [Fri, 5 Jun 2015 16:11:14 +0000 (16:11 +0000)]
[bpf] rename triple names bpf_be -> bpfeb

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

9 years ago[Hexagon] Reapply r239097 with tests corrected for shuffling and duplexing.
Colin LeMahieu [Fri, 5 Jun 2015 16:00:11 +0000 (16:00 +0000)]
[Hexagon] Reapply r239097 with tests corrected for shuffling and duplexing.

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

9 years agoRevert "Include BPF target in CMake builds."
Alexei Starovoitov [Fri, 5 Jun 2015 15:32:38 +0000 (15:32 +0000)]
Revert "Include BPF target in CMake builds."

This reverts commit r239035

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

9 years ago[TargetParser] Properly attach functions of ARMTargetParser to the class
Benjamin Kramer [Fri, 5 Jun 2015 14:33:02 +0000 (14:33 +0000)]
[TargetParser] Properly attach functions of ARMTargetParser to the class

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

9 years ago[ARM] Make helper function static.
Benjamin Kramer [Fri, 5 Jun 2015 14:32:54 +0000 (14:32 +0000)]
[ARM] Make helper function static.

This one had a declaration but it differed from the definition so the
declaration was actually dead.

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

9 years agoRangify for loops in LegacyPassManager.cpp.
Yaron Keren [Fri, 5 Jun 2015 14:15:07 +0000 (14:15 +0000)]
Rangify for loops in LegacyPassManager.cpp.

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

9 years ago[ARM] Add support for -sp- FPUs and FPU none to TargetParser
John Brawn [Fri, 5 Jun 2015 13:31:19 +0000 (13:31 +0000)]
[ARM] Add support for -sp- FPUs and FPU none to TargetParser

These are added mainly for the benefit of clang, but this also means that they
are now allowed in .fpu directives and we emit the correct .fpu directive when
single-precision-only is used.

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

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

9 years ago[ARM] Add knowledge of FPU subtarget features to TargetParser
John Brawn [Fri, 5 Jun 2015 13:29:24 +0000 (13:29 +0000)]
[ARM] Add knowledge of FPU subtarget features to TargetParser

Add getFPUFeatures to TargetParser, which gets the list of subtarget features
that are enabled/disabled for each FPU, and use it when handling the .fpu
directive.

No functional change in this commit, though clang will start behaving
differently once it starts using this.

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

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

9 years ago[ARMTargetParser] Follow-up for r239099: one case was missed
Artyom Skrobov [Fri, 5 Jun 2015 12:39:28 +0000 (12:39 +0000)]
[ARMTargetParser] Follow-up for r239099: one case was missed

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

9 years ago[X86][AVX2] Added tests for v32i8 vector shifts
Simon Pilgrim [Fri, 5 Jun 2015 12:35:36 +0000 (12:35 +0000)]
[X86][AVX2] Added tests for v32i8 vector shifts

Currently still scalarized, but D9474 should remedy that.

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

9 years agoRevert "[mips] [IAS] Restore STI.FeatureBits in .set pop." (r239144).
Toma Tabacu [Fri, 5 Jun 2015 12:19:27 +0000 (12:19 +0000)]
Revert "[mips] [IAS] Restore STI.FeatureBits in .set pop." (r239144).

This is breaking the Windows buildbots.

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

9 years ago[mips] [IAS] Restore STI.FeatureBits in .set pop.
Toma Tabacu [Fri, 5 Jun 2015 11:48:54 +0000 (11:48 +0000)]
[mips] [IAS] Restore STI.FeatureBits in .set pop.

Summary:
Only restoring AvailableFeatures is not enough and will lead to buggy behaviour.
For example, if we have a feature enabled and we ".set pop", the next time we try
to ".set" that feature nothing will happen because the "!(STI.getFeatureBits()[Feature])"
check will be false, because we didn't restore STI.FeatureBits.

In order to fix this, we need to make MipsAssemblerOptions remember the STI.FeatureBits
instead of the AvailableFeatures and then regenerate AvailableFeatures each time we ".set pop".
This is because, AFAIK, there is no way to convert from AvailableFeatures back to STI.FeatureBits,
but the reverse is possible by using ComputeAvailableFeatures(STI.FeatureBits).

I also moved the updating of AssemblerOptions inside the "if" statement in
setFeatureBits() and clearFeatureBits(), as there is no reason to update if
nothing changes.

Reviewers: dsanders, mkuper

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

9 years ago[LoopVectorize] Don't crash on zero-sized types in isInductionPHI
David Majnemer [Fri, 5 Jun 2015 10:52:40 +0000 (10:52 +0000)]
[LoopVectorize] Don't crash on zero-sized types in isInductionPHI

isInductionPHI wants to calculate the stride based on the pointee size.
However, this is not possible when the pointee is zero sized.

This fixes PR23763.

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

9 years agoSimplify code; NFC.
Andrea Di Biagio [Fri, 5 Jun 2015 10:29:55 +0000 (10:29 +0000)]
Simplify code; NFC.

Also, moved test cases from CodeGen/X86/fold-buildvector-bug.ll into
CodeGen/X86/buildvec-insertvec.ll and regenerated CHECK lines using
update_llc_test_checks.py.

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

9 years ago[InstCombine] Rephrase fix to SimplifyWithOpReplaced
David Majnemer [Fri, 5 Jun 2015 09:57:57 +0000 (09:57 +0000)]
[InstCombine] Rephrase fix to SimplifyWithOpReplaced

I don't have the IR which is causing the build bot breakage but I can
postulate as to why they are timing out:
1. SimplifyWithOpReplaced was stripping flags from the simplified value.
2. visitSelectInstWithICmp was overriding SimplifyWithOpReplaced because
   it's simplification wasn't correct.
3. InstCombine would revisit the add instruction and note that it can
   rederive the flags.
4. By modifying the value, we chose to revisit instructions which reuse
   the value.  One of the instructions is the original select, causing
   LLVM to never reach fixpoint.

Instead, strip the flags only when we are sure we are going to perform
the simplification.

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

9 years agoRevert "[InstCombine] Don't miscompile safe increment idiom"
Daniel Jasper [Fri, 5 Jun 2015 09:31:20 +0000 (09:31 +0000)]
Revert "[InstCombine] Don't miscompile safe increment idiom"

This is breaking a lot of build bots and is causing very long-running
compiles (infinite loops)?

Likely, we shouldn't return nullptr?

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

9 years ago[X86][SSE] Added tests for i8/i16 vector shifts
Simon Pilgrim [Fri, 5 Jun 2015 08:24:23 +0000 (08:24 +0000)]
[X86][SSE] Added tests for i8/i16 vector shifts

Currently still scalarized, but D9474 should remedy that.

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

9 years agoInstrProf: Fix reading of consecutive 32 bit coverage maps
Justin Bogner [Fri, 5 Jun 2015 01:23:42 +0000 (01:23 +0000)]
InstrProf: Fix reading of consecutive 32 bit coverage maps

When we generate coverage data, we explicitly set each coverage map's
alignment to 8 (See InstrProfiling::lowerCoverageData), but when we
read the coverage data, we assume consecutive maps are exactly
adjacent. When we're dealing with 32 bit, maps can end on a 4 byte
boundary, causing us to think the padding is part of the next record.

Fix this by adjusting the buffer to an appropriately aligned address
between records.

This is pretty awkward to test, as it requires a binary with multiple
coverage maps to hit, so we'd need to check in multiple source files
and a binary blob as inputs.

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

9 years agoRevert "[Object, ELF] Fix segmentation fault in ELFFile::getSectionName()."
Alexey Samsonov [Thu, 4 Jun 2015 23:58:31 +0000 (23:58 +0000)]
Revert "[Object, ELF] Fix segmentation fault in ELFFile::getSectionName()."

This reverts commit r239124.

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

9 years ago[Object, ELF] Fix segmentation fault in ELFFile::getSectionName().
Alexey Samsonov [Thu, 4 Jun 2015 23:40:23 +0000 (23:40 +0000)]
[Object, ELF] Fix segmentation fault in ELFFile::getSectionName().

Don't do a null dereference if .shstrtab section is missing.

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

9 years agoMC: Clean up naming in MCObjectFileInfo.h.
Jim Grosbach [Thu, 4 Jun 2015 23:35:03 +0000 (23:35 +0000)]
MC: Clean up naming in MCObjectFileInfo.h.

Init*() methods to init*().

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

9 years agoMC: Tidy up formatting and doc comments. NFC.
Jim Grosbach [Thu, 4 Jun 2015 23:35:00 +0000 (23:35 +0000)]
MC: Tidy up formatting and doc comments. NFC.

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

9 years agoMC: Clean up the naming for MCMachObjectWriter. NFC.
Jim Grosbach [Thu, 4 Jun 2015 23:25:54 +0000 (23:25 +0000)]
MC: Clean up the naming for MCMachObjectWriter. NFC.

s/ExecutePostLayoutBinding/executePostLayoutBinding/
s/ComputeSymbolTable/computeSymbolTable/
s/BindIndirectSymbols/bindIndirectSymbols/
s/RecordTLVPRelocation/recordTLVPRelocation/
s/RecordScatteredRelocation/recordScatteredRelocation/
s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/
s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/
s/WriteNlist/writeNlist/
s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/
s/WriteSymtabLoadCommand/writeSymtabLoadCommand/
s/WriteSection/writeSection/
s/WriteSegmentLoadCommand/writeSegmentLoadCommand/
s/WriteHeader/writeHeader/

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

9 years agoMC: Move MachObjectWriter::SectionAddress to private.
Jim Grosbach [Thu, 4 Jun 2015 23:25:19 +0000 (23:25 +0000)]
MC: Move MachObjectWriter::SectionAddress to private.

There's already a get() method everything that needs it is using.

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

9 years agoMC: Tidy up formatting and doc comments. NFC.
Jim Grosbach [Thu, 4 Jun 2015 23:25:05 +0000 (23:25 +0000)]
MC: Tidy up formatting and doc comments. NFC.

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

9 years ago[Object, ELF] Don't assert on invalid magic in createELFObjectFile.
Alexey Samsonov [Thu, 4 Jun 2015 23:14:43 +0000 (23:14 +0000)]
[Object, ELF] Don't assert on invalid magic in createELFObjectFile.

Instead, return a proper error code from factory.

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

9 years ago[InstCombine] Don't miscompile safe increment idiom
David Majnemer [Thu, 4 Jun 2015 23:11:30 +0000 (23:11 +0000)]
[InstCombine] Don't miscompile safe increment idiom

We cleverly handle cases where computation done in one argument of a select
instruction is suitable for the other operand, thus obviating the need
of the select and the comparison.  However, the other operand cannot
have flags.

This fixes PR23757.

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

9 years agoStatepoint: Fix handling of Far Immediate calls
Swaroop Sridhar [Thu, 4 Jun 2015 23:03:21 +0000 (23:03 +0000)]
Statepoint: Fix handling of Far Immediate calls

gc.statepoint intrinsics with a far immediate call target
were lowered incorrectly as pc-rel32 calls.

This change fixes the problem, and generates an indirect call
via a scratch register.

For example:

Intrinsic:
  %safepoint_token = call i32 (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* inttoptr (i64 140727162896504 to void ()*), i32 0, i32 0, i32 0, i32 0)

Old Incorrect Lowering:
  callq 140727162896504

New Correct Lowering:
  movabsq $140727162896504, %rax
  callq *%rax

In lowerCallFromStatepoint(), the callee-target was modified and
represented as a "TargetConstant" node, rather than a "Constant" node.
Undoing this modification enabled LowerCall() to generate the
correct CALL instruction.

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

9 years ago[Object, ELF] Don't call llvm_unreachable() from createELFObjectFile.
Alexey Samsonov [Thu, 4 Jun 2015 22:58:25 +0000 (22:58 +0000)]
[Object, ELF] Don't call llvm_unreachable() from createELFObjectFile.

Instead, return a proper error code from factory.

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

9 years ago[Target/X86] Don't use callee-saved registers in a Win64 tail call on non-Windows.
Charles Davis [Thu, 4 Jun 2015 22:50:05 +0000 (22:50 +0000)]
[Target/X86] Don't use callee-saved registers in a Win64 tail call on non-Windows.

Summary:
A small bit that I missed when I updated the X86 backend to account for
the Win64 calling convention on non-Windows. Now we don't use dead
non-volatile registers when emitting a Win64 indirect tail call on
non-Windows.

Should fix PR23710.

Test Plan: Added test for the correct behavior based on the case I posted to PR23710.

Reviewers: rnk

Subscribers: llvm-commits

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

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

9 years ago[Object, MachO] Fixup for r239075: use union to store mach_header and mach_header_64.
Alexey Samsonov [Thu, 4 Jun 2015 22:49:55 +0000 (22:49 +0000)]
[Object, MachO] Fixup for r239075: use union to store mach_header and mach_header_64.

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

9 years ago[Object, MachO] Don't crash on incomplete MachO segment load commands.
Alexey Samsonov [Thu, 4 Jun 2015 22:26:44 +0000 (22:26 +0000)]
[Object, MachO] Don't crash on incomplete MachO segment load commands.

Report proper error code from MachOObjectFile constructor if we
can't parse another segment load command (we already return a proper
error if segment load command contents is suspicious).

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

9 years agoMC: Clean up naming in MCObjectWriter. NFC.
Jim Grosbach [Thu, 4 Jun 2015 22:24:41 +0000 (22:24 +0000)]
MC: Clean up naming in MCObjectWriter. NFC.

s/WriteObject/writeObject/
s/RecordRelocation/recordRelocation/
s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/
s/Write8/write8/
s/WriteLE16/writeLE16/
s/WriteLE32/writeLE32/
s/WriteLE64/writeLE64/
s/WriteBE16/writeBE16/
s/WriteBE32/writeBE32/
s/WriteBE64/writeBE64/
s/Write16/write16/
s/Write32/write32/
s/Write64/write64/
s/WriteZeroes/writeZeroes/
s/WriteBytes/writeBytes/

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

9 years agoMC: Tidy up formatting and doc comments. NFC.
Jim Grosbach [Thu, 4 Jun 2015 22:24:29 +0000 (22:24 +0000)]
MC: Tidy up formatting and doc comments. NFC.

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

9 years ago[Object, MachO] Simplify load segment parsing code. NFC.
Alexey Samsonov [Thu, 4 Jun 2015 22:08:37 +0000 (22:08 +0000)]
[Object, MachO] Simplify load segment parsing code. NFC.

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

9 years ago[SDAG switch lowering] Fix switch case -> or merging for 0 and INT_MIN
Benjamin Kramer [Thu, 4 Jun 2015 22:05:51 +0000 (22:05 +0000)]
[SDAG switch lowering] Fix switch case -> or merging for 0 and INT_MIN

The big/small ordering here is based on signed values so SmallValue will
be INT_MIN and BigValue 0. This shouldn't be a problem but the code
assumed that BigValue always had more bits set than SmallValue.

We used to just miss the transformation, but a recent refactoring of
mine turned this into an assertion failure.

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

9 years agoShouldn't be XFAIL'ed.
Colin LeMahieu [Thu, 4 Jun 2015 21:49:43 +0000 (21:49 +0000)]
Shouldn't be XFAIL'ed.

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

9 years agoRevert r239095 incorrect test tree.
Colin LeMahieu [Thu, 4 Jun 2015 21:32:42 +0000 (21:32 +0000)]
Revert r239095 incorrect test tree.

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

9 years ago[NVPTX] roll forward r239082
Jingyue Wu [Thu, 4 Jun 2015 21:28:26 +0000 (21:28 +0000)]
[NVPTX] roll forward r239082

NVPTXISelDAGToDAG translates "addrspacecast to param" to
NVPTX::nvvm_ptr_gen_to_param

Added an llc test in bug21465.

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

9 years agoSimplify ARMTargetParser::getArchSynonym
Artyom Skrobov [Thu, 4 Jun 2015 21:26:58 +0000 (21:26 +0000)]
Simplify ARMTargetParser::getArchSynonym

Summary:
1) The only caller, ARMTargetParser::parseArch, uses the results for an "endswith" test; so, including the "arm" prefix into the result is unnecessary.
2) Most ARMTargetParser::parseArch callers pass it the output from ARMTargetParser::getCanonicalArchName; so, make this behaviour the default. Then, including the "arm" prefix into the cases is unnecessary.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits

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

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

9 years ago[Hexagon] Removing unused variable.
Colin LeMahieu [Thu, 4 Jun 2015 21:22:12 +0000 (21:22 +0000)]
[Hexagon] Removing unused variable.

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

9 years ago[MachOWriter] Use for-range and roll some duplicated code into loops.
Benjamin Kramer [Thu, 4 Jun 2015 21:17:27 +0000 (21:17 +0000)]
[MachOWriter] Use for-range and roll some duplicated code into loops.

No functionality change intended.

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

9 years ago[Hexagon] Adding functionality for duplexing. Duplexing is a way to compress commonl...
Colin LeMahieu [Thu, 4 Jun 2015 21:16:16 +0000 (21:16 +0000)]
[Hexagon] Adding functionality for duplexing.  Duplexing is a way to compress commonly used pairs of instructions in order to reduce code size.  The test case duplex.ll normally would be 8 bytes, assign register to 0 and jump to link register.  After duplexing this is only 4 bytes.  This also tests the HexagonMCShuffler code path which is used to make sure duplexed instructions still follow slot requirements.

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

9 years agoRevert r239082
Jingyue Wu [Thu, 4 Jun 2015 21:07:08 +0000 (21:07 +0000)]
Revert r239082

llc crashed for NVPTX backend

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

9 years agoRemove unused argument. NFC.
Rafael Espindola [Thu, 4 Jun 2015 20:55:49 +0000 (20:55 +0000)]
Remove unused argument. NFC.

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

9 years agoRe-unique_ptrify LoadedObjectInfo::clone after it was reverted due to some other...
David Blaikie [Thu, 4 Jun 2015 20:54:32 +0000 (20:54 +0000)]
Re-unique_ptrify LoadedObjectInfo::clone after it was reverted due to some other changes that broke on GCC around the same time

Apparently this functionality isn't used in-tree (or I would go & make
the explicit unique_ptr constructions into implicit constructions to
make them more self documenting now that clone doesn't return a raw
owning pointer anymore) but only by the Julia frontend. This isn't
ideal.

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

9 years agoTidy comment. NFC.
Diego Novillo [Thu, 4 Jun 2015 20:49:52 +0000 (20:49 +0000)]
Tidy comment. NFC.

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

9 years agoErase constant dbgloc on reuse in PHI node
Sergey Dmitrouk [Thu, 4 Jun 2015 20:48:40 +0000 (20:48 +0000)]
Erase constant dbgloc on reuse in PHI node

Basic block selection involves checking successor BBs for PHI nodes
that depend on the current BB.  In case such BBs are found, the value
being selected is a constant and such constant already exists in
current BB, it's value is reused.

This might lead to wrong locations in some situations, especially if
same constant value ends up being materialized twice in two different
ways, which discards that sharing and leaves us with wrong debug
location in the successor BB.

In code this involves the following sequence of calls:

 SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks ->
 SelectionDAGBuilder::CopyValueToVirtualRegister ->
 SelectionDAGBuilder::getNonRegisterValue

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

9 years agoRetry defaulting the virtual dtor in LoadedObjectInfo
David Blaikie [Thu, 4 Jun 2015 20:41:51 +0000 (20:41 +0000)]
Retry defaulting the virtual dtor in LoadedObjectInfo

Originally committed in r237975, GCC 4.7 gave a compilation error
regarding "looser throw specification" though it seemed to be pointing
to a virtual defaulted dtor in a base class and an override defaulted
dtor in a derived class - so I'm not quite sure why/how they could end
up with different throw specifications. To simplify and reduce the risk
of this, I've just removed the pointless override in the derived class,
the base class's should be sufficient. *fingers crossed*

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

9 years ago[GlobalMerge] Take into account minsize on Global users' parents.
Ahmed Bougacha [Thu, 4 Jun 2015 20:39:23 +0000 (20:39 +0000)]
[GlobalMerge] Take into account minsize on Global users' parents.

Now that we can look at users, we can trivially do this: when we would
have otherwise disabled GlobalMerge (currently -O<3), we can just run
it for minsize functions, as it's usually a codesize win.

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

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

9 years ago[docs] Document "LGTM" in the lexicon.
Sean Silva [Thu, 4 Jun 2015 20:28:09 +0000 (20:28 +0000)]
[docs] Document "LGTM" in the lexicon.

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

9 years agoMC: Remove obsolete MachO UseAggressiveSymbolFolding.
Jim Grosbach [Thu, 4 Jun 2015 20:27:42 +0000 (20:27 +0000)]
MC: Remove obsolete MachO UseAggressiveSymbolFolding.

Fix the FIXME and remove this old as(1) compat option. It was useful for
bringup of the integrated assembler to diff object files, but now it's
just causing more relocations than strictly necessary to be generated.

rdar://21201804

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

9 years agoHaving another go at some simple cleanup from r237975/r237976
David Blaikie [Thu, 4 Jun 2015 20:23:13 +0000 (20:23 +0000)]
Having another go at some simple cleanup from r237975/r237976

I made a few changes here in a couple of commits - breaking them out
into smaller ones in case I hit the GCC oddities again.

I'm still not /entirely/ sure what the issues were, so apologies if any
of these experiments break things again. Feel free to revert
immediately.

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

9 years ago[NVPTX] kernel pointer arguments point to the global address space
Jingyue Wu [Thu, 4 Jun 2015 20:19:38 +0000 (20:19 +0000)]
[NVPTX] kernel pointer arguments point to the global address space

Summary:
With this patch, NVPTXLowerKernelArgs converts a kernel pointer argument to a
pointer in the global address space. This change, along with
NVPTXFavorNonGenericAddrSpaces, allows the NVPTX backend to emit ld.global.*
and st.global.* for accessing kernel pointer arguments.

Minor changes:
1. refactor: extract function convertToPointerInAddrSpace
2. fix a bug in the test case in bug21465.ll

Test Plan: lower-kernel-ptr-arg.ll

Reviewers: eliben, meheff, jholewinski

Reviewed By: jholewinski

Subscribers: wengxt, jholewinski, llvm-commits

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

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

9 years ago[Object, MachO] Don't crash on invalid MachO segment load commands.
Alexey Samsonov [Thu, 4 Jun 2015 20:08:52 +0000 (20:08 +0000)]
[Object, MachO] Don't crash on invalid MachO segment load commands.

Summary:
Properly report the error in segment load commands from MachOObjectFile
constructor instead of crashing the program.

Adjust the test case accordingly.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits

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

9 years ago[Object, MachO] Don't crash on invalid MachO load commands.
Alexey Samsonov [Thu, 4 Jun 2015 19:57:46 +0000 (19:57 +0000)]
[Object, MachO] Don't crash on invalid MachO load commands.

Summary:
Currently all load commands are parsed in MachOObjectFile constructor.
If the next load command cannot be parsed, or if command size is too
small, properly report it through the error code and fail to construct
the object, instead of crashing the program.

Test Plan: regression test suite

Reviewers: rafael, filcab

Subscribers: llvm-commits

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

9 years ago[MC] Allowing operands to be erased from MCInst.
Colin LeMahieu [Thu, 4 Jun 2015 19:49:52 +0000 (19:49 +0000)]
[MC] Allowing operands to be erased from MCInst.

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

9 years ago[Object, MachO] Don't crash on parsing invalid MachO header.
Alexey Samsonov [Thu, 4 Jun 2015 19:45:22 +0000 (19:45 +0000)]
[Object, MachO] Don't crash on parsing invalid MachO header.

Summary: Instead, properly report this error from MachOObjectFile constructor.

Test Plan: regression test suite

Reviewers: rafael

Subscribers: llvm-commits

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

9 years ago[Object, MachO] Remove some code duplication. NFC.
Alexey Samsonov [Thu, 4 Jun 2015 19:34:14 +0000 (19:34 +0000)]
[Object, MachO] Remove some code duplication. NFC.

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

9 years ago[CMake] Fixing the check for Ninja
Chris Bieneman [Thu, 4 Jun 2015 19:33:23 +0000 (19:33 +0000)]
[CMake] Fixing the check for Ninja

Enabling Ninja Job Pools needs to be dependent on the CMAKE_MAKE_PROGRAM not the CMAKE_GENERATOR. There are generators (like "Sublime Text 2 - Ninja") that also generate ninja build files. Basing of the CMAKE_MAKE_PROGRAM is the best future-proof way to handle this.

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

9 years ago[Object, MachO] Cache parsed MachO header in MachOObjectFile. NFC.
Alexey Samsonov [Thu, 4 Jun 2015 19:22:03 +0000 (19:22 +0000)]
[Object, MachO] Cache parsed MachO header in MachOObjectFile. NFC.

Summary:
Avoid parsing object file each time MachOObjectFile::getHeader() is
called. Instead, cache the header in MachOObjectFile constructor, where
it's parsed anyway. In future, we must avoid constructing the object
at all if the header can't be parsed.

Test Plan: regression test suite.

Reviewers: rafael

Subscribers: llvm-commits

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

9 years agoFix buildbot failure on Windows by relaxing test expectations.
Alexey Samsonov [Thu, 4 Jun 2015 19:22:00 +0000 (19:22 +0000)]
Fix buildbot failure on Windows by relaxing test expectations.

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

9 years ago[bpf] add big- and host- endian support
Alexei Starovoitov [Thu, 4 Jun 2015 19:15:05 +0000 (19:15 +0000)]
[bpf] add big- and host- endian support

Summary:
-march=bpf    -> host endian
-march=bpf_le -> little endian
-match=bpf_be -> big endian

Test Plan:
v1 was tested by IBM s390 guys and appears to be working there.
It bit rots too fast here.

Reviewers: chandlerc, tstellarAMD

Subscribers: llvm-commits

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

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

9 years ago[DAGCombiner] Fix wrong folding of a build_vector into a blend with zero.
Andrea Di Biagio [Thu, 4 Jun 2015 19:15:01 +0000 (19:15 +0000)]
[DAGCombiner] Fix wrong folding of a build_vector into a blend with zero.

Method 'visitBUILD_VECTOR' in the DAGCombiner knows how to combine a
build_vector of a bunch of extract_vector_elt nodes and constant zero nodes
into a shuffle blend with a zero vector.

However, method 'visitBUILD_VECTOR' forgot that a floating point
build_vector may contain negative zero as well as positive zero.

Example:

define <2 x double> @example(<2 x double> %A) {
entry:
  %0 = extractelement <2 x double> %A, i32 0
  %1 = insertelement <2 x double> undef, double %0, i32 0
  %2 = insertelement <2 x double> %1, double -0.0, i32 1
  ret <2 x double> %2
}

Before this patch, llc (with -mattr=+sse4.1) wrongly generated
  movq   %xmm0, %xmm0  # xmm0 = xmm0[0],zero

So, the sign bit of the negative zero was effectively lost.

This patch fixes the problem by adding explicit checks for positive zero.

With this patch, llc produces the following code for the example above:
  movhpd .LCPI0_0(%rip), %xmm0

where .LCPI0_0 referes to a 'double -0'.

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