oota-llvm.git
9 years agoMore code cleanup [NFC]
Philip Reames [Fri, 27 Mar 2015 05:39:32 +0000 (05:39 +0000)]
More code cleanup [NFC]

Minor naming, one potentially unsafe cast

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

9 years agoCode simplification and style cleanup
Philip Reames [Fri, 27 Mar 2015 05:34:44 +0000 (05:34 +0000)]
Code simplification and style cleanup

All the removed assertions are either implied locally by the assert at the top of the function or properties of the verifier.

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

9 years agoRequire a GC strategy be specified for functions which use gc.statepoint
Philip Reames [Fri, 27 Mar 2015 05:09:33 +0000 (05:09 +0000)]
Require a GC strategy be specified for functions which use gc.statepoint

This was discussed a while back and I left it optional for migration.  Since it's been far more than the 'week or two' that was discussed, time to actually make this manditory.

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

9 years agoAllow explicit spill slots to be specified for a gc.statepoint
Philip Reames [Fri, 27 Mar 2015 04:52:48 +0000 (04:52 +0000)]
Allow explicit spill slots to be specified for a gc.statepoint

This patch adds support for explicitly provided spill slots in the GC arguments of a gc.statepoint.  This is somewhat analogous to gcroot, but leverages the STATEPOINT MI node and StackMap infrastructure.  The motivation for this is:
1) The stack spilling code for gc.statepoints hasn't advanced as fast as I'd like.  One major option is to give up on doing spilling in the backend and do it at the IR level instead.  We'd give up the ability to have gc values in registers, but that's a minor cost in practice.  We are not neccessarily moving in that direction, but having the ability to prototype such a thing cheaply is interesting.
2) I want to port the gcroot lowering to use the statepoint infastructure.  Given the metadata printers for gcroot expect a fixed set of stack roots, it's easiest to just reuse the explicit stack slots and pass them directly to the underlying statepoint.

I'm holding off on the documentation for the new feature until I'm reasonable sure this is going to stick around.

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

9 years agoReintroduce the SelectionDAG scheduler test for r233351.
Andrew Trick [Fri, 27 Mar 2015 04:42:52 +0000 (04:42 +0000)]
Reintroduce the SelectionDAG scheduler test for r233351.

This test returns nonnative integer types which aren't supported on all targets.
The real issue with the SelectionDAG scheduler is with x86 EFLAGS.

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

9 years agoWinEH: Create a parent frame alloca for HandlerType xdata tables
David Majnemer [Fri, 27 Mar 2015 04:17:07 +0000 (04:17 +0000)]
WinEH: Create a parent frame alloca for HandlerType xdata tables

We don't have any logic to emit those tables yet, so the SDAG lowering
of this intrinsic is just a stub.  We can see the intrinsic in the
prepared IR, though.

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

9 years agoThis test should have been target specific. I missed that.
Andrew Trick [Fri, 27 Mar 2015 04:04:35 +0000 (04:04 +0000)]
This test should have been target specific. I missed that.

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

9 years agoRefactor Code inside LoopVectorizer's function isInductionVariable.
Karthik Bhat [Fri, 27 Mar 2015 03:44:15 +0000 (03:44 +0000)]
Refactor Code inside LoopVectorizer's function isInductionVariable.
This patch exposes LoopVectorizer's isInductionVariable function as common
a functionality.
http://reviews.llvm.org/D8608

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

9 years agoFix a bug in SelectionDAG scheduling backtracking code: PR22304.
Andrew Trick [Fri, 27 Mar 2015 03:44:13 +0000 (03:44 +0000)]
Fix a bug in SelectionDAG scheduling backtracking code: PR22304.

It can happen (by line CurSU->isPending = true; // This SU is not in
AvailableQueue right now.) that a SUnit is mark as available but is
not in the AvailableQueue. For SUnit being selected for scheduling
both conditions must be met.

This patch mainly defensively protects from invalid removing a node
from a queue. Sometimes nodes are marked isAvailable but are not in
the queue because they have been defered due to some hazard.

Patch by Pawel Bylica!

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

9 years agoRevert r233175 and r233183 with it. This pulls float2int back out of the tree, due...
Nick Lewycky [Fri, 27 Mar 2015 02:00:11 +0000 (02:00 +0000)]
Revert r233175 and r233183 with it. This pulls float2int back out of the tree, due to PR23038.

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

9 years agoDebugInfo: Update testcases with invalid variables
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 01:58:34 +0000 (01:58 +0000)]
DebugInfo: Update testcases with invalid variables

Fix testcases whose variables are invalid.  I'm working on a patch that
adds `Verifier` checks for `MDLocalVariable` (and `MDGlobalVariable`),
and these failed because:

  - `scope:` fields need to point at `MDLocalScope` and can't be null.
  - `file:` fields need to point at `MDFile`.
  - `inlinedAt:` fields need to point at `MDLocation`.

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

9 years ago[AsmPrinter] Don't assert on GOT equivalent non-constant users.
Ahmed Bougacha [Fri, 27 Mar 2015 01:40:54 +0000 (01:40 +0000)]
[AsmPrinter] Don't assert on GOT equivalent non-constant users.

We used to dyn_cast<Constant> in the recursive call, but cast<> in the
initial one, and there can be non-Constant initial users.

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

9 years agoDIBuilder: Change a few helpers to return downcasted MDNodes
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 00:34:10 +0000 (00:34 +0000)]
DIBuilder: Change a few helpers to return downcasted MDNodes

Change `getNonCompileUnitScope()` to return `MDScope` and
`getConstantAsMetadata()` to return `ConstantAsMetadata`.  This will
make it easier to start requiring more type safety in the debug info
hierarchy.

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

9 years agoAsmWriter: Cleanup debug info fields with MDFieldPrinter, NFC
Duncan P. N. Exon Smith [Fri, 27 Mar 2015 00:17:42 +0000 (00:17 +0000)]
AsmWriter: Cleanup debug info fields with MDFieldPrinter, NFC

Move all the `MDNode` field helper methods into a new class,
`MDFieldPrinter`, and add helpers for integers, bools, and `DW_*`
symbolic constants.  This reduces a ton of code duplication, and makes
it more mechanical to update `AsmWriter` to print broken code in the
context of stricter accessors (like in r233322).

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

9 years agoDeduplicate a bunch of setOpActions into an MVT range-for. NFC.
Ahmed Bougacha [Thu, 26 Mar 2015 23:21:03 +0000 (23:21 +0000)]
Deduplicate a bunch of setOpActions into an MVT range-for. NFC.

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

9 years ago[CodeGen] Report error rather than crash when unable to makeLibCall.
Ahmed Bougacha [Thu, 26 Mar 2015 22:46:58 +0000 (22:46 +0000)]
[CodeGen] Report error rather than crash when unable to makeLibCall.

Also, make the assumption explicit in the header.

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

9 years ago[CodeGen] Don't pretend we can expand f16 libcalls.
Ahmed Bougacha [Thu, 26 Mar 2015 22:44:58 +0000 (22:44 +0000)]
[CodeGen] Don't pretend we can expand f16 libcalls.

We used to mark a bunch of libm nodes as Expand for f16.  There are no
libcalls we can use for those, so we eventually just hit an unhelpful
llvm_unreachable in ExpandFPLibCall.

Instead, just ignore them altogether.  If nothing else changes, we'll
then get the more descriptive and pleasant "Cannot select" fatal error.

There's an argument to be made for consistency, but f16 is already
special in all the good ways, and as long as there's no f16 support in
the ops expander (this patch), as well as the Soften/Expand float
legalizers (which, when hit, will currently segfault), I think there's
no point in even pretending we can legalize any of this.

This shouldn't affect anything that's not already broken.

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

9 years agoUse movw/movt instead of constant pool loads to lower byval parameter copies
Derek Schuff [Thu, 26 Mar 2015 22:11:00 +0000 (22:11 +0000)]
Use movw/movt instead of constant pool loads to lower byval parameter copies

Summary:
The ARM backend can use a loop to implement copying byval parameters before
a call. In non-thumb2 mode it uses a constant pool load to materialize the
trip count. For targets that need movt instead (e.g. Native Client), use
the same code as in thumb2 mode to materialize the trip count.

Reviewers: jfb, t.p.northover

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

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

9 years agoVerifier: Check accessors of MDLocation
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 22:05:04 +0000 (22:05 +0000)]
Verifier: Check accessors of MDLocation

Check accessors of `MDLocation`, and change them to `cast<>` down to the
right types.  Also add type-safe factory functions.

All the callers that handle broken code need to use the new versions of
the accessors (`getRawScope()` instead of `getScope()`) that still
return `Metadata*`.  This is also necessary for things like
`MDNodeKeyImpl<MDLocation>` (in LLVMContextImpl.h) that need to unique
the nodes when their operands might still be forward references of the
wrong type.

In the `Value` hierarchy, consumers that handle broken code use
`getOperand()` directly.  However, debug info nodes have a ton of
operands, and their order (even their existence) isn't stable yet.  It's
safer and more maintainable to add an explicit "raw" accessor on the
class itself.

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

9 years agoDefault to armv7 cpu for NaCl when march=arm
Derek Schuff [Thu, 26 Mar 2015 21:58:46 +0000 (21:58 +0000)]
Default to armv7 cpu for NaCl when march=arm

Summary:
When the arch is given as "arm" clang uses the default target CPU from
LLVM to determine what the real arch should be (i.e. "arm" becomes
"armv4t" because LLVM's getARMCPUForArch falls back to "arm7tdmi").
Default to "cortex-a8" so that we end up with "armv7" in clang.

the nacl-direct.c test in clang also covers this case.

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

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

9 years agoFix PR23025.
Rafael Espindola [Thu, 26 Mar 2015 21:11:00 +0000 (21:11 +0000)]
Fix PR23025.

There is something in link.exe that requires a relocation to use a
global symbol. Not doing so breaks the chrome build on windows.

This patch sets isWeak for that to work. To compensate,
we then need to look past those symbols when not creating relocations.

This patch includes an ELF test that matches GNU as behaviour.

I am still reducing the chrome build issue and will add a test
once that is done.

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

9 years agoFix rare case where APInt divide algorithm applied un-needed transformation.
Yaron Keren [Thu, 26 Mar 2015 19:45:19 +0000 (19:45 +0000)]
Fix rare case where APInt divide algorithm applied un-needed transformation.

APInt uses Knuth's D algorithm for long division. In rare cases the
implementation applied a transformation that was not needed.

Added unit tests for long division. KnuthDiv() procedure is fully covered.
There is a case in APInt::divide() that I believe is never used (marked with
a comment) as all users of divide() handle trivial cases earlier.

Patch by Pawel Bylica!

  http://reviews.llvm.org/D8448

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

9 years ago[ADT][CMake][AutoConf] Fail-fast iterators for DenseMap
Sanjoy Das [Thu, 26 Mar 2015 19:25:01 +0000 (19:25 +0000)]
[ADT][CMake][AutoConf] Fail-fast iterators for DenseMap

Summary:
This patch is an attempt at making `DenseMapIterator`s "fail-fast".
Fail-fast iterators that have been invalidated due to insertion into
the host `DenseMap` deterministically trip an assert (in debug mode)
on access, instead of non-deterministically hitting memory corruption
issues.

Enabling fail-fast iterators breaks the LLVM C++ ABI, so they are
predicated on `LLVM_ENABLE_ABI_BREAKING_CHECKS`.
`LLVM_ENABLE_ABI_BREAKING_CHECKS` by default flips with
`LLVM_ENABLE_ASSERTS`, but can be clamped to ON or OFF using the CMake /
autoconf build system.

Reviewers: chandlerc, dexonsmith, rnk, zturner

Subscribers: llvm-commits

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

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

9 years ago[ARM] Fix some non-portable shell syntax in r233301's tests
Justin Bogner [Thu, 26 Mar 2015 19:24:13 +0000 (19:24 +0000)]
[ARM] Fix some non-portable shell syntax in r233301's tests

The "|&" operator isn't POSIX, so it can fail depending on the host's
default shell. Avoid it.

There were also a couple of places that did "2>1", but this creates a
file called "1". They clearly meant "2>&1".

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

9 years agoIgnore compile_commands.json only at the root of the tree.
Paul Robinson [Thu, 26 Mar 2015 18:55:42 +0000 (18:55 +0000)]
Ignore compile_commands.json only at the root of the tree.
Can avoid a problem if tools/clang/tools/extra is in the tree.

Patch by Douglas Yung!

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

9 years agoSupress MSVC padding warning in alignment test
Andrew Kaylor [Thu, 26 Mar 2015 18:48:42 +0000 (18:48 +0000)]
Supress MSVC padding warning in alignment test

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

9 years agoAdds an option to disable ARM ld/st optim pass
Renato Golin [Thu, 26 Mar 2015 18:38:04 +0000 (18:38 +0000)]
Adds an option to disable ARM ld/st optim pass

Enabled by default, but it's useful when debugging with llc.

Patch by Ranjeet Singh.

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

9 years agoReapply "Linker: Drop function pointers for overridden subprograms"
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 18:35:30 +0000 (18:35 +0000)]
Reapply "Linker: Drop function pointers for overridden subprograms"

This reverts commit r233254, effectively reapplying r233164 (and its
successors), with an additional testcase for when subprograms match
exactly.  This fixes PR22792 (again).

I'm using the same approach, but I've moved up the call to
`stripReplacedSubprograms()`.  The function pointers need to be dropped
before mapping any metadata from the source module, or else this can
drop the function from new subprograms that have merged (via Metadata
uniquing) with the old ones.  Dropping the pointers first prevents them
from merging.

**** The original commit message follows. ****

Linker: Drop function pointers for overridden subprograms

Instead of dropping subprograms that have been overridden, just set
their function pointers to `nullptr`.  This is a minor adjustment to the
stop-gap fix for PR21910 committed in r224487, and fixes the crasher
from PR22792.

The problem that r224487 put a band-aid on: how do we find the canonical
subprogram for a `Function`?  Since the backend currently relies on
`DebugInfoFinder` (which does a naive in-order traversal of compile
units and picks the first subprogram) for this, r224487 tried dropping
non-canonical subprograms.

Dropping subprograms fails because the backend *also* builds up a map
from subprogram to compile unit (`DwarfDebug::SPMap`) based on the
subprogram lists.  A missing subprogram causes segfaults later when an
inlined reference (such as in this testcase) is created.

Instead, just drop the `Function` pointer to `nullptr`, which nicely
mirrors what happens when an already-inlined `Function` is optimized
out.  We can't really be sure that it's the same definition anyway, as
the testcase demonstrates.

This still isn't completely satisfactory.  Two flaws at least that I can
think of:

  - I still haven't found a straightforward way to make this symmetric
    in the IR.  (Interestingly, the DWARF output is already symmetric,
    and I've tested for that to be sure we don't regress.)
  - Using `DebugInfoFinder` to find the canonical subprogram for a
    function is kind of crazy.  We should just attach metadata to the
    function, like this:

        define weak i32 @foo(i32, i32) !dbg !MDSubprogram(...) {

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

9 years ago[ARM] Add v8.1a "Rounding Double Multiply Add/Subtract" extension
Vladimir Sukharev [Thu, 26 Mar 2015 18:29:02 +0000 (18:29 +0000)]
[ARM] Add v8.1a "Rounding Double Multiply Add/Subtract" extension

Reviewers: t.p.northover

Subscribers: llvm-commits

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

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

9 years ago[AArch64] Rename Pairs to Mappings in AArch64NamedImmMapper
Vladimir Sukharev [Thu, 26 Mar 2015 17:57:39 +0000 (17:57 +0000)]
[AArch64] Rename Pairs to Mappings in AArch64NamedImmMapper

Third element is to be added soon to "struct AArch64NamedImmMapper::Mapping". So its instances are renamed from ...Pairs to ...Mappings

Reviewers: jmolloy

Subscribers: llvm-commits

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

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

9 years ago[AArch64] Move initializations of AArch64NamedImmMapper out of void AArch64Operand...
Vladimir Sukharev [Thu, 26 Mar 2015 17:29:53 +0000 (17:29 +0000)]
[AArch64] Move initializations of AArch64NamedImmMapper out of void AArch64Operand::print(...)

class AArch64NamedImmMapper is to become dependent of SubTargetFeatures, while class AArch64Operand don't have access to the latter.

So, AArch64NamedImmMapper constructor invocations are refactored away from methods of AArch64Operand.

Reviewers: jmolloy

Subscribers: llvm-commits

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

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

9 years ago[SCEV] Revert bailout added in r75511.
Sanjoy Das [Thu, 26 Mar 2015 17:28:26 +0000 (17:28 +0000)]
[SCEV] Revert bailout added in r75511.

Summary:
With the introduction of MarkPendingLoopPredicates in r157092, I don't
think the bailout is needed anymore.

Reviewers: atrick, nicholas

Subscribers: llvm-commits

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

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

9 years agorevert inadvertent change
Sanjay Patel [Thu, 26 Mar 2015 17:19:24 +0000 (17:19 +0000)]
revert inadvertent change

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

9 years agocomment cleanup; NFC
Sanjay Patel [Thu, 26 Mar 2015 17:18:17 +0000 (17:18 +0000)]
comment cleanup; NFC

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

9 years agoRemove outdated README-SSE.txt entries.
Benjamin Kramer [Thu, 26 Mar 2015 17:12:16 +0000 (17:12 +0000)]
Remove outdated README-SSE.txt entries.

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

9 years agoInstCombine: fold (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0
Benjamin Kramer [Thu, 26 Mar 2015 17:12:06 +0000 (17:12 +0000)]
InstCombine: fold (A << C) == (B << C) --> ((A^B) & (~0U >> C)) == 0

Anding and comparing with zero can be done in a single instruction on
most archs so this is a bit cheaper.

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

9 years ago[AArch64, ARM] Add v8.1a architecture and generic cpu
Vladimir Sukharev [Thu, 26 Mar 2015 17:05:54 +0000 (17:05 +0000)]
[AArch64, ARM] Add v8.1a architecture and generic cpu

New architecture and cpu added, following http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: t.p.northover

Subscribers: llvm-commits

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

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

9 years agoUse SDValue bool checks; NFC intended
Sanjay Patel [Thu, 26 Mar 2015 16:55:43 +0000 (16:55 +0000)]
Use SDValue bool checks; NFC intended

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

9 years agofix indent; NFC
Sanjay Patel [Thu, 26 Mar 2015 16:55:17 +0000 (16:55 +0000)]
fix indent; NFC

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

9 years ago[SLSR] handle candidate form &B[i * S]
Jingyue Wu [Thu, 26 Mar 2015 16:49:24 +0000 (16:49 +0000)]
[SLSR] handle candidate form &B[i * S]

Summary:
This patch enhances SLSR to handle another candidate form &B[i * S]. If
we found two candidates

S1: X = &B[i * S]
S2: Y = &B[i' * S]

and S1 dominates S2, we can replace S2 with

Y = &X[(i' - i) * S]

Test Plan:
slsr-gep.ll
X86/no-slsr.ll: verify that we do not run SLSR on GEPs that already fit into
an addressing mode

Reviewers: eliben, atrick, meheff, hfinkel

Reviewed By: hfinkel

Subscribers: sanjoy, llvm-commits

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

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

9 years agoSometimes report_fatal_error is called when there is not a handler function used...
Aaron Ballman [Thu, 26 Mar 2015 16:24:38 +0000 (16:24 +0000)]
Sometimes report_fatal_error is called when there is not a handler function used to fail gracefully. In that case, RunInterruptHandlers is called, which attempts to enter a critical section object. Ensure that the critical section is properly initialized so that this code functions properly, and tools like clang-tidy do not crash in Debug builds.

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

9 years ago[mips] Move the setATReg definition inside the MipsAssemblerOptions class. NFC.
Toma Tabacu [Thu, 26 Mar 2015 13:08:55 +0000 (13:08 +0000)]
[mips] Move the setATReg definition inside the MipsAssemblerOptions class. NFC.

Summary: This groups all of the MipsAssemblerOptions functionality together, making it more reader-friendly.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

9 years ago[X86][FastIsel] Teach how to select vector load instructions.
Andrea Di Biagio [Thu, 26 Mar 2015 11:29:02 +0000 (11:29 +0000)]
[X86][FastIsel] Teach how to select vector load instructions.

This patch teaches fast-isel how to select 128-bit vector load instructions.
Added test CodeGen/X86/fast-isel-vecload.ll

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

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

9 years agoRevert "Linker: Drop function pointers for overridden subprograms"
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 05:27:45 +0000 (05:27 +0000)]
Revert "Linker: Drop function pointers for overridden subprograms"

This reverts commit r233164 and its testcase follow-ups in r233165,
r233207, r233214, and r233221.  It apparently unleashed an LTO bootstrap
failure, at least on Darwin:

http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/3376/

I'm reproducing now.

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

9 years agobugpoint: Verify input files
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 05:03:10 +0000 (05:03 +0000)]
bugpoint: Verify input files

Like r233229 for `llvm-link`, start verifying input files to `bugpoint`.

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

9 years agobugpoint: Return early after error, NFC
Duncan P. N. Exon Smith [Thu, 26 Mar 2015 05:03:06 +0000 (05:03 +0000)]
bugpoint: Return early after error, NFC

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

9 years ago[RegisterCoalescer] Add a rule to consider more profitable copies first when
Quentin Colombet [Thu, 26 Mar 2015 01:01:48 +0000 (01:01 +0000)]
[RegisterCoalescer] Add a rule to consider more profitable copies first when
those are in the same basic block.
The previous approach was the topological order of the basic block.

By default this rule is disabled.

Related to PR22768.

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

9 years agoTestcase for r233239.
Eric Christopher [Thu, 26 Mar 2015 00:57:33 +0000 (00:57 +0000)]
Testcase for r233239.

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

9 years agoAdd computeFSAdditions to the function based subtarget creation
Eric Christopher [Thu, 26 Mar 2015 00:50:23 +0000 (00:50 +0000)]
Add computeFSAdditions to the function based subtarget creation
for PPC due to some unfortunate default setting via TargetMachine
creation. I've added a FIXME on how this can be unraveled in the
backend and a test to make sure we successfully legalize 64-bit things
if we say we're 64-bits.

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

9 years agollvm-link: Verify input modules
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 23:22:10 +0000 (23:22 +0000)]
llvm-link: Verify input modules

Otherwise, broken input modules can cause assertions.  I've updated two
of the testcases that started failing (modules that had `Require` flags
but didn't meet their own requirements), but Rafael and I decided that
test/Linker/2011-08-22-ResolveAlias.ll should just be deleted outright
-- it's a leftover of the way llvm-gcc used to implement weakref.

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

9 years agoFix typo in comment.
Nico Weber [Wed, 25 Mar 2015 22:34:16 +0000 (22:34 +0000)]
Fix typo in comment.

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

9 years ago[ValueTracking] Fix PR23011.
Sanjoy Das [Wed, 25 Mar 2015 22:33:53 +0000 (22:33 +0000)]
[ValueTracking] Fix PR23011.

Summary:
`ComputeNumSignBits` returns incorrect results for `srem` instructions.
This change fixes the issue and adds a test case.

Reviewers: nadav, nicholas, atrick

Subscribers: llvm-commits

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

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

9 years ago[DAGCombiner] Add support for TRUNCATE + FP_EXTEND vector constant folding
Simon Pilgrim [Wed, 25 Mar 2015 22:30:31 +0000 (22:30 +0000)]
[DAGCombiner] Add support for TRUNCATE + FP_EXTEND vector constant folding

This patch adds supports for the vector constant folding of TRUNCATE and FP_EXTEND instructions and tidies up the SINT_TO_FP and UINT_TO_FP instructions to match.

It also moves the vector constant folding for the FNEG and FABS instructions to use the DAG.getNode() functionality like the other unary instructions.

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

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

9 years agoLinker: Stop using -gmlt test/Linker/subprogram-linkonce-weak.ll
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 21:36:41 +0000 (21:36 +0000)]
Linker: Stop using -gmlt test/Linker/subprogram-linkonce-weak.ll

As dblaikie pointed out, if I stop setting `emissionKind: 2` then the
backend won't do magical things on Linux vs. Darwin.  I had wrongly
assumed that there were stricter requirements on the input if we weren't
in line-tables-only mode, but apparently not.

With that knowledge, clean up this testcase a little more.

  - Set `emissionKind: 1`.
  - Add back checks for the weak version of @foo.
  - Check more robustly that we have the right subprograms by checking
    the `DW_AT_decl_file` and `DW_AT_decl_line` which now show up.
  - Check the line table in isolation (since it's no longer doubling as
    an indirect test for the subprogram of the weak version of @foo).

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

9 years agoFix remaining MSVC warning
Andrew Kaylor [Wed, 25 Mar 2015 21:33:24 +0000 (21:33 +0000)]
Fix remaining MSVC warning

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

9 years agoRegisterCoalescer: Fix implicit def handling in register coalescer
Matthias Braun [Wed, 25 Mar 2015 21:18:24 +0000 (21:18 +0000)]
RegisterCoalescer: Fix implicit def handling in register coalescer

If liveranges induced by an IMPLICIT_DEF get completely covered by a
proper liverange the IMPLICIT_DEF instructions and its corresponding
definitions have to be removed from the live ranges. This has to happen
in the subregister live ranges as well (I didn't see this case earlier
because in most programs only some subregisters are covered and the
IMPLCIT_DEF won't get removed).

No testcase, I spent hours trying to create one for one of the public
targets, but ultimately failed because I couldn't manage to properly
control the placement of COPY and IMPLICIT_DEF instructions from an .ll
file.

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

9 years agoMachineVerifier: slightly simplify code that is only called with vregs
Matthias Braun [Wed, 25 Mar 2015 21:18:22 +0000 (21:18 +0000)]
MachineVerifier: slightly simplify code that is only called with vregs

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

9 years agoLinker: Loosen checks slightly from r233207
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 20:51:21 +0000 (20:51 +0000)]
Linker: Loosen checks slightly from r233207

According to at least one bot [1], function prologues aren't always
empty for these functions.  Skip that part of the follow-up check.

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

9 years agoRevert r233206
Krzysztof Parzyszek [Wed, 25 Mar 2015 20:21:16 +0000 (20:21 +0000)]
Revert r233206

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

9 years agoWinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tables
Reid Kleckner [Wed, 25 Mar 2015 20:10:36 +0000 (20:10 +0000)]
WinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tables

We don't have any logic to emit those tables yet, so the sdag lowering
of this intrinsic is just a stub. We can see the intrinsic in the
prepared IR, though.

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

9 years agoLinker: Rewrite dwarfdump checks from r233164
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 19:57:42 +0000 (19:57 +0000)]
Linker: Rewrite dwarfdump checks from r233164

Rewrite the checks from r233164 that I temporarily disabled in r233165.

It turns out that the line-tables only debug info we emit from `llc` is
(intentionally) different on Linux than on Darwin.  r218129 started
skipping emission of subprograms with no inlined subroutines, and
r218702 was a spiritual revert of that behaviour for Darwin.

I think we can still test this in a platform-neutral way.

  - Stop checking for the possibly missing `DW_TAG_subprogram` defining
    the debug info for the real version of `@foo`.
  - Start checking the line tables, ensuring that the right debug info
    was used to generate them (grabbing `DW_AT_low_pc` from the compile
    unit).
  - I changed up the line numbers used in the "weak" version so it's
    easier to follow.

This should hopefully finish off PR22792.

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

9 years ago[Hexagon] Keep the bare getSubtargetImpl for now
Krzysztof Parzyszek [Wed, 25 Mar 2015 19:51:52 +0000 (19:51 +0000)]
[Hexagon] Keep the bare getSubtargetImpl for now

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

9 years agoAdd Hardware Transactional Memory (HTM) Support
Kit Barton [Wed, 25 Mar 2015 19:36:23 +0000 (19:36 +0000)]
Add Hardware Transactional Memory (HTM) Support

This patch adds Hardware Transaction Memory (HTM) support supported by ISA 2.07
(POWER8). The intrinsic support is based on GCC one [1], but currently only the
'PowerPC HTM Low Level Built-in Function' are implemented.

The HTM instructions follows the RC ones and the transaction initiation result
is set on RC0 (with exception of tcheck). Currently approach is to create a
register copy from CR0 to GPR and comapring. Although this is suboptimal, since
the branch could be taken directly by comparing the CR0 value, it generates code
correctly on both test and branch and just return value. A possible future
optimization could be elimitate the MFCR instruction to branch directly.

The HTM usage requires a recently newer kernel with PPC HTM enabled. Tested on
powerpc64 and powerpc64le.

This is send along a clang patch to enabled the builtins and option switch.

[1] https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html

Phabricator Review: http://reviews.llvm.org/D8247

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

9 years agoclang-format bits of code to make another patch readable.
Rafael Espindola [Wed, 25 Mar 2015 19:24:39 +0000 (19:24 +0000)]
clang-format bits of code to make another patch readable.

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

9 years agoSimplify missing-file-line.ll test.
Peter Collingbourne [Wed, 25 Mar 2015 17:58:09 +0000 (17:58 +0000)]
Simplify missing-file-line.ll test.

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

9 years agoDebugInfo: Permit DW_TAG_structure_type, DW_TAG_member, DW_TAG_typedef tags with...
Peter Collingbourne [Wed, 25 Mar 2015 17:44:49 +0000 (17:44 +0000)]
DebugInfo: Permit DW_TAG_structure_type, DW_TAG_member, DW_TAG_typedef tags with empty file names.

Some languages, such as Go, have pre-defined structure types (e.g. "string"
is essentially a pointer/length pair) or pre-defined "typedef" types
(e.g. "error" is essentially a typedef for a specific interface type).
Such types do not have associated source location, so a Go frontend would
be correct not to associate a file name with such types.

This change relaxes the DIType verifier to permit unlocated types with
these tags.

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

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

9 years ago[X86, AVX] improve insertion into zero element of 256-bit vector
Sanjay Patel [Wed, 25 Mar 2015 17:36:01 +0000 (17:36 +0000)]
[X86, AVX] improve insertion into zero element of 256-bit vector

This patch allows AVX blend instructions to handle insertion into the low
element of a 256-bit vector for the appropriate data types.

For f32, instead of:

   vblendps $1, %xmm1, %xmm0, %xmm1 ## xmm1 = xmm1[0],xmm0[1,2,3]
   vblendps $15, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]

we get:

   vblendps $1, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0],ymm0[1,2,3,4,5,6,7]

For f64, instead of:

   vmovsd %xmm1, %xmm0, %xmm1     ## xmm1 = xmm1[0],xmm0[1]
   vblendpd $3, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0,1],ymm0[2,3]

we get:

   vblendpd $1, %ymm1, %ymm0, %ymm0 ## ymm0 = ymm1[0],ymm0[1,2,3]

For the hardware-neglected integer data types, I left a TODO comment in the
code and added regression tests for a follow-on patch.

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

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

9 years agouse update_llc_test_checks.py to tighten checking in these tests
Sanjay Patel [Wed, 25 Mar 2015 17:34:11 +0000 (17:34 +0000)]
use update_llc_test_checks.py to tighten checking in these tests

1. There were no CHECK-LABELs, so we could match instructions from the wrong function.
2. The use of zero operands meant multiple xor instructions could match some CHECKs.
3. The test was over-specified to need a Sandybridge CPU and Darwin triple.

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

9 years agollvm-jitlistener: Add missing include.
Benjamin Kramer [Wed, 25 Mar 2015 17:12:36 +0000 (17:12 +0000)]
llvm-jitlistener: Add missing include.

This code is only compiled when LLVM_USE_INTEL_JITEVENTS, but at least we have
one buildbot where that's the case :)

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

9 years ago[APInt] Add an isSplat helper and use it in some places.
Benjamin Kramer [Wed, 25 Mar 2015 16:49:59 +0000 (16:49 +0000)]
[APInt] Add an isSplat helper and use it in some places.

To complement getSplat. This is more general than the binary
decomposition method as it also handles non-pow2 splat sizes.

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

9 years ago[Hexagon] Pattern match a CTZ loop into a call to countTrailingZeros.
Benjamin Kramer [Wed, 25 Mar 2015 15:36:57 +0000 (15:36 +0000)]
[Hexagon] Pattern match a CTZ loop into a call to countTrailingZeros.

No functional change intended.

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

9 years ago[ARM] Rewrite .save/.vsave emission with bit math
Benjamin Kramer [Wed, 25 Mar 2015 15:27:58 +0000 (15:27 +0000)]
[ARM] Rewrite .save/.vsave emission with bit math

Hopefully makes it a bit easier to understand what's going on.
No functional change intended.

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

9 years agoMake exit-code test use same mechanism as existing one.
Daniel Jasper [Wed, 25 Mar 2015 14:35:40 +0000 (14:35 +0000)]
Make exit-code test use same mechanism as existing one.

The other version doesn't properly work with our internal test runner,
which sets pipefail.

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

9 years agoFix fixup evaluation when deciding what to relocate with.
Rafael Espindola [Wed, 25 Mar 2015 13:16:53 +0000 (13:16 +0000)]
Fix fixup evaluation when deciding what to relocate with.

The previous logic was to first try without relocations at all
and failing that stop on the first defined symbol.

That was inefficient and incorrect in the case part of the
expression could be simplified and another part could not
(see included test).

We now stop the evaluation when we get to a variable whose value
can change (i.e. is weak).

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

9 years ago[Orc] Remove another unnecessary typedef.
Lang Hames [Wed, 25 Mar 2015 12:32:36 +0000 (12:32 +0000)]
[Orc] Remove another unnecessary typedef.

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

9 years ago[optnone] Skip pass Float2Int on optnone functions.
Andrea Di Biagio [Wed, 25 Mar 2015 12:22:37 +0000 (12:22 +0000)]
[optnone] Skip pass Float2Int on optnone functions.

Added test Float2Int/float2int-optnone.ll to verify that pass Float2Int
is not run on optnone functions.

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

9 years ago[Orc][lli] Add a very simple Orc-based lazy JIT to lli.
Lang Hames [Wed, 25 Mar 2015 12:11:48 +0000 (12:11 +0000)]
[Orc][lli] Add a very simple Orc-based lazy JIT to lli.

This ensures that we're building and testing the CompileOnDemand layer, at least
in a basic way.

Currently x86-64 only, and with limited to no library calls enabled (depending
on host platform). Patches welcome. ;)

To enable access to the lazy JIT, this patch replaces the '-use-orcmcjit' lli
option with a new option:
'-jit-kind={ mcjit | orc-mcjit | orc-lazy }'.

All regression tests are updated to use the new option, and one trivial test of
the new lazy JIT is added.

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

9 years ago[X86] Simplify check lines in tests. No functional change.
Andrea Di Biagio [Wed, 25 Mar 2015 11:44:19 +0000 (11:44 +0000)]
[X86] Simplify check lines in tests. No functional change.

Also, removed unused check lines from test atomic6432.ll.

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

9 years agoReapply r233062: "float2int": Add a new pass to demote from float to int where possible.
James Molloy [Wed, 25 Mar 2015 10:03:42 +0000 (10:03 +0000)]
Reapply r233062: "float2int": Add a new pass to demote from float to int where possible.

Now with a fix for PR23008 and extra regression test.

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

9 years agotest: Fix the dependencies for the check-llvm-* targets
Justin Bogner [Wed, 25 Mar 2015 08:07:47 +0000 (08:07 +0000)]
test: Fix the dependencies for the check-llvm-* targets

In r233009 we gained specific check-llvm-* build targets for invoking
specific parts of the test suite, but they were copying the
dependencies for check-all, rather than just listing the dependencies
for check-llvm.

This moves the creation of these targets next to the check-llvm
target, and uses that target's configuration rather than the check-all
config.

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

9 years agoFix build.
Rafael Espindola [Wed, 25 Mar 2015 04:36:20 +0000 (04:36 +0000)]
Fix build.

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

9 years ago[X86] Remove GetCpuIDAndInfo, GetCpuIDAndInfoEx and DetectFamilyModel functions from...
Craig Topper [Wed, 25 Mar 2015 04:16:50 +0000 (04:16 +0000)]
[X86] Remove GetCpuIDAndInfo, GetCpuIDAndInfoEx and DetectFamilyModel functions from X86 MC layer. They haven't been used since CPU autodetection was removed from X86Subtarget.cpp.

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

9 years ago[Orc] Remove extraneous 'typename'. This should cheer the bots up.
Lang Hames [Wed, 25 Mar 2015 04:00:34 +0000 (04:00 +0000)]
[Orc] Remove extraneous 'typename'. This should cheer the bots up.

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

9 years ago[Orc] Refactor JITCompileCallbackManagerBase and CompileOnDemandLayer to support
Lang Hames [Wed, 25 Mar 2015 02:45:50 +0000 (02:45 +0000)]
[Orc] Refactor JITCompileCallbackManagerBase and CompileOnDemandLayer to support
target-independent callback management.

This is a prerequisite for adding orc-based lazy-jitting to lli.

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

9 years agoLinker: Temporarily disable dwarfdump checks from r233164
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 02:43:04 +0000 (02:43 +0000)]
Linker: Temporarily disable dwarfdump checks from r233164

At least one Linux bot [1] doesn't like my dwarfdump checks, so I've
disable those until I can investigate what's going on there.  I'll
continue to track this in PR22792.

[1]: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/22863

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

9 years agoLinker: Drop function pointers for overridden subprograms
Duncan P. N. Exon Smith [Wed, 25 Mar 2015 02:26:32 +0000 (02:26 +0000)]
Linker: Drop function pointers for overridden subprograms

Instead of dropping subprograms that have been overridden, just set
their function pointers to `nullptr`.  This is a minor adjustment to the
stop-gap fix for PR21910 committed in r224487, and fixes the crasher
from PR22792.

The problem that r224487 put a band-aid on: how do we find the canonical
subprogram for a `Function`?  Since the backend currently relies on
`DebugInfoFinder` (which does a naive in-order traversal of compile
units and picks the first subprogram) for this, r224487 tried dropping
non-canonical subprograms.

Dropping subprograms fails because the backend *also* builds up a map
from subprogram to compile unit (`DwarfDebug::SPMap`) based on the
subprogram lists.  A missing subprogram causes segfaults later when an
inlined reference (such as in this testcase) is created.

Instead, just drop the `Function` pointer to `nullptr`, which nicely
mirrors what happens when an already-inlined `Function` is optimized
out.  We can't really be sure that it's the same definition anyway, as
the testcase demonstrates.

This still isn't completely satisfactory.  Two flaws at least that I can
think of:

  - I still haven't found a straightforward way to make this symmetric
    in the IR.  (Interestingly, the DWARF output is already symmetric,
    and I've tested for that to be sure we don't regress.)
  - Using `DebugInfoFinder` to find the canonical subprogram for a
    function is kind of crazy.  We should just attach metadata to the
    function, like this:

        define weak i32 @foo(i32, i32) !dbg !MDSubprogram(...) {

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

9 years ago[ADT] Teach MapVector to support a swap member. Will be used in
Chandler Carruth [Wed, 25 Mar 2015 00:50:21 +0000 (00:50 +0000)]
[ADT] Teach MapVector to support a swap member. Will be used in
a subsequent commit in Clang.

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

9 years agoFix warning on non-assert build.
Rafael Espindola [Wed, 25 Mar 2015 00:45:41 +0000 (00:45 +0000)]
Fix warning on non-assert build.

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

9 years agoProduce an error instead of asserting on invalid .sleb128/.uleb128.
Rafael Espindola [Wed, 25 Mar 2015 00:25:37 +0000 (00:25 +0000)]
Produce an error instead of asserting on invalid .sleb128/.uleb128.

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

9 years ago'optnone' should not disable DAG combiner.
Paul Robinson [Wed, 25 Mar 2015 00:10:24 +0000 (00:10 +0000)]
'optnone' should not disable DAG combiner.

Reverts the code change from r221168 and the relevant test.
It was a mistake to disable the combiner, and based on the ultimate
definition of 'optnone' we shouldn't have considered the test case
as failing in the first place.

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

9 years ago!invariant.load semantics with potentially clobbering calls
Philip Reames [Tue, 24 Mar 2015 23:54:54 +0000 (23:54 +0000)]
!invariant.load semantics with potentially clobbering calls

A load from an invariant location is assumed to not alias any otherwise potentially aliasing stores. Our implementation only applied this rule to store instructions themselves whereas they it should apply for any memory accessing instruction. This results in both FRE and PRE becoming more effective at eliminating invariant loads.

Note that as a follow on change I will likely move this into AliasAnalysis itself. That's where the TBAA constant flag is handled and the semantics are essentially the same. I'd like to separate the semantic change from the refactoring and thus have extended the hack that's already in MemoryDependenceAnalysis for this change.

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

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

9 years agoDon't be over eager in evaluating a subtraction with a weak symbol.
Rafael Espindola [Tue, 24 Mar 2015 23:48:44 +0000 (23:48 +0000)]
Don't be over eager in evaluating a subtraction with a weak symbol.

In a subtraction of the form A - B, if B is weak, there is no way to represent
that on ELF since all relocations add the value of a symbol.

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

9 years agoX86: Fix frameescape when not using an FP
Reid Kleckner [Tue, 24 Mar 2015 23:46:01 +0000 (23:46 +0000)]
X86: Fix frameescape when not using an FP

We can't use TargetFrameLowering::getFrameIndexOffset directly, because
Win64 really wants the offset from the stack pointer at the end of the
prologue. Instead, use X86FrameLowering::getFrameIndexOffsetFromSP(),
which is a pretty close approximiation of that. It fails to handle cases
with interestingly large stack alignments, which is pretty uncommon on
Win64 and is TODO.

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

9 years agoUpdate a test I missed in r233132
Justin Bogner [Tue, 24 Mar 2015 23:44:03 +0000 (23:44 +0000)]
Update a test I missed in r233132

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

9 years agoDisabling warnings for MSVC build to enable /W4 use.
Andrew Kaylor [Tue, 24 Mar 2015 23:37:10 +0000 (23:37 +0000)]
Disabling warnings for MSVC build to enable /W4 use.

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

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

9 years agollvm-cov: Require a subcommand when invoked as llvm-cov
Justin Bogner [Tue, 24 Mar 2015 23:34:36 +0000 (23:34 +0000)]
llvm-cov: Require a subcommand when invoked as llvm-cov

A while ago llvm-cov gained support for clang's instrumentation based
profiling in addition to its gcov support, and subcommands were added
to choose which behaviour to use. When no subcommand was specified, we
fell back to gcov compatibility with a warning that a subcommand would
be required in the future. Now, we require the subcommand.

Note that if the basename of llvm-cov is gcov (via symlink or
hardlink, for example), we still use the gcov compatible behaviour
with no subcommand required.

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

9 years agoOpaque Pointer Types: GEP API migrations to specify the gep type explicitly
David Blaikie [Tue, 24 Mar 2015 23:34:31 +0000 (23:34 +0000)]
Opaque Pointer Types: GEP API migrations to specify the gep type explicitly

The changes to InstCombine (& SCEV) do seem a bit silly - it doesn't make
anything obviously better to have the caller access the pointers element
type (the thing I'm trying to remove) than the GEP itself, but it's a
helpful migration step. This will allow me to more obviously lock down
GEP (& Load, etc) API usage, then fix all the code that accesses pointer
element types except the places that need to be removed (most of the
InstCombines) anyway - at which point I'll need to just remove all that
code because it won't be meaningful anymore (there will be no pointer
types, so no bitcasts to combine)

SCEV looks like it'll need some restructuring - we'll have to do a bit
more work for GEP canonicalization, since it'll depend on how it's used
if we can even manage to canonicalize it to a non-ugly GEP. I guess we
can do some fun stuff like voting (do 2 out of 3 load from the GEP with
a certain type that gives a pretty GEP? Does every typed use of the GEP
use either a specific type or a generic type (i8*, etc)?)

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

9 years ago[dsymutil] Temporarily disable some tests on windows.
Frederic Riss [Tue, 24 Mar 2015 23:11:07 +0000 (23:11 +0000)]
[dsymutil] Temporarily disable some tests on windows.

It seems one windows bot fails since I added ilne table linking to
llvm-dsymutil (see r232333 commit thread).
Disable the affected tests until I can figure out what's happening.

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

9 years agooptimize the AVX2 (integer) version of vperm2 into a shuffle
Sanjay Patel [Tue, 24 Mar 2015 22:39:29 +0000 (22:39 +0000)]
optimize the AVX2 (integer) version of vperm2 into a shuffle

...because this is what happens when an instruction
set puts its underwear on after its pants.

This is an extension of r232852, r233100, and 233110:
http://llvm.org/viewvc/llvm-project?view=revision&revision=232852
http://llvm.org/viewvc/llvm-project?view=revision&revision=233100
http://llvm.org/viewvc/llvm-project?view=revision&revision=233110

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

9 years agoOpaque Pointer Types: GEP API migrations to specify the gep type explicitly
David Blaikie [Tue, 24 Mar 2015 22:38:16 +0000 (22:38 +0000)]
Opaque Pointer Types: GEP API migrations to specify the gep type explicitly

The changes to InstCombine do seem a bit silly - it doesn't make
anything obviously better to have the caller access the pointers element
type (the thing I'm trying to remove) than the GEP itself, but it's a
helpful migration step. This will allow me to more obviously lock down
GEP (& Load, etc) API usage, then fix all the code that accesses pointer
element types except the places that need to be removed (most of the
InstCombines) anyway - at which point I'll need to just remove all that
code because it won't be meaningful anymore (there will be no pointer
types, so no bitcasts to combine)

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