oota-llvm.git
9 years agoNarrow down the type of CallInst::getFunctionType to a FunctionType
David Blaikie [Fri, 17 Apr 2015 06:40:11 +0000 (06:40 +0000)]
Narrow down the type of CallInst::getFunctionType to a FunctionType

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

9 years agoFix test failure due to racing commits
Reid Kleckner [Fri, 17 Apr 2015 01:09:53 +0000 (01:09 +0000)]
Fix test failure due to racing commits

It looks like r235145 changed the .ll syntax for variadic calls. Update
tests to use the new syntax.

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

9 years agoFix unused variable warning
Reid Kleckner [Fri, 17 Apr 2015 01:03:30 +0000 (01:03 +0000)]
Fix unused variable warning

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

9 years ago[SEH] Reimplement x64 SEH using WinEHPrepare
Reid Kleckner [Fri, 17 Apr 2015 01:01:27 +0000 (01:01 +0000)]
[SEH] Reimplement x64 SEH using WinEHPrepare

This now emits simple, unoptimized xdata tables for __C_specific_handler
based on the handlers listed in @llvm.eh.actions calls produced by
WinEHPrepare.

This adds support for running __finally blocks when exceptions are
thrown, and removes the old landingpad fan-in codepath.

I ran some manual execution tests on small basic test cases with and
without optimization, as well as on Chrome base_unittests, which uses a
small amount of SEH.  I'm sure there are bugs, and we may need to
revert.

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

9 years agoDebugInfo: Fixup r235149 after IR change in r235145
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 00:37:53 +0000 (00:37 +0000)]
DebugInfo: Fixup r235149 after IR change in r235145

This shouldn't have used varargs anyway; change the functions to be
`void`.  Also remove my accidentally-committed directory path.

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

9 years ago[NaryReassociate] run NaryReassociate iteratively
Jingyue Wu [Fri, 17 Apr 2015 00:25:10 +0000 (00:25 +0000)]
[NaryReassociate] run NaryReassociate iteratively

Summary:
An alternative is to use a worklist approach. However, that approach
would break the traversing order so that we couldn't lookup SeenExprs
efficiently. I don't see a clear winner here, so I picked the easier approach.

Along with two minor improvements:
1. preserves ScalarEvolution by forgetting instructions replaced
2. removes dead code locally avoiding the need of running DCE afterwards

Test Plan: add to slsr-add.ll a test that requires multiple iterations

Reviewers: broune, dberlin, atrick, meheff

Reviewed By: atrick

Subscribers: llvm-commits

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

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

9 years agoDebugInfo: Simplify testcase from LiveDebugVariables fix in r235140
Duncan P. N. Exon Smith [Fri, 17 Apr 2015 00:18:46 +0000 (00:18 +0000)]
DebugInfo: Simplify testcase from LiveDebugVariables fix in r235140

This testcase is less brittle and exactly tests for the misbehaviour.
Thanks to David Blaikie for the suggestion.

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

9 years ago[AArch64] Don't assert on f16 in DUP PerfectShuffle generator.
Ahmed Bougacha [Thu, 16 Apr 2015 23:57:07 +0000 (23:57 +0000)]
[AArch64] Don't assert on f16 in DUP PerfectShuffle generator.

Found by code inspection, but breaking i16 at least breaks other tests.
They aren't checking this in particular though, so also add some
explicit tests for the already working types.

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

9 years ago[opaque pointer type] Add textual IR support for explicit type parameter to the call...
David Blaikie [Thu, 16 Apr 2015 23:24:18 +0000 (23:24 +0000)]
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction

See r230786 and r230794 for similar changes to gep and load
respectively.

Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.

When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.

This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.

This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).

No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.

This leaves /only/ the varargs case where the explicit type is required.

Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.

About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.

import fileinput
import sys
import re

pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")

def conv(match, line):
  if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
    return line
  return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]

for line in sys.stdin:
  sys.stdout.write(conv(re.search(pat, line), line))

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

9 years agoFor llvm-objdump, dump the (__OBJC,__protocol) section for Objc1 32-bit Mach-O files
Kevin Enderby [Thu, 16 Apr 2015 22:33:20 +0000 (22:33 +0000)]
For llvm-objdump, dump the (__OBJC,__protocol) section for Objc1 32-bit Mach-O files
with the -section option as objc_protocol_t structs.

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

9 years agoDebugInfo: Fix UserValue::match() in LiveDebugVariables after r235050
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 22:27:54 +0000 (22:27 +0000)]
DebugInfo: Fix UserValue::match() in LiveDebugVariables after r235050

r235050 dropped the inlined-at field from `MDLocalVariable`, deferring
to the `!dbg` attachments.  Fix `UserValue` to take the `!dbg` into
account when differentiating between variables.

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

9 years agoAsmPrinter: Remove dead code, NFC
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 22:14:20 +0000 (22:14 +0000)]
AsmPrinter: Remove dead code, NFC

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

9 years agoAsmPrinter: Simplify logic for debug info intrinsics' !dbg attachments
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 22:12:59 +0000 (22:12 +0000)]
AsmPrinter: Simplify logic for debug info intrinsics' !dbg attachments

These are required, so just assume they're there.

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

9 years agoUpdating symbol wildcards one more time.
Chris Bieneman [Thu, 16 Apr 2015 21:58:22 +0000 (21:58 +0000)]
Updating symbol wildcards one more time.

This should catch all C++ symbols containing llvm in the name.

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

9 years agoDisable AArch64 fast-isel on big-endian call vector returns.
Pete Cooper [Thu, 16 Apr 2015 21:19:36 +0000 (21:19 +0000)]
Disable AArch64 fast-isel on big-endian call vector returns.

A big-endian vector return needs a byte-swap which we aren't doing right now.

For now just bail on these cases to get correctness back.

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

9 years ago[IR] Introduce a dereferenceable_or_null(N) attribute.
Sanjoy Das [Thu, 16 Apr 2015 20:29:50 +0000 (20:29 +0000)]
[IR] Introduce a dereferenceable_or_null(N) attribute.

Summary:
If a pointer is marked as dereferenceable_or_null(N), LLVM assumes it
is either `null` or `dereferenceable(N)` or both.  This change only
introduces the attribute and adds a token test case for the `llvm-as`
/ `llvm-dis`.  It does not hook up other parts of the optimizer to
actually exploit the attribute -- those changes will come later.

For pointers in address space 0, `dereferenceable(N)` is now exactly
equivalent to `dereferenceable_or_null(N)` && `nonnull`.  For other
address spaces, `dereferenceable(N)` is potentially weaker than
`dereferenceable_or_null(N)` && `nonnull` (since we could have a null
`dereferenceable(N)` pointer).

The motivating case for this change is Java (and other managed
languages), where pointers are either `null` or dereferenceable up to
some usually known-at-compile-time constant offset.

Reviewers: rafael, hfinkel

Reviewed By: hfinkel

Subscribers: nicholas, llvm-commits

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

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

9 years ago[NFC] [MachO] remove extra semicolons
Jingyue Wu [Thu, 16 Apr 2015 18:43:44 +0000 (18:43 +0000)]
[NFC] [MachO] remove extra semicolons

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

9 years ago[NaryReassociate] speeds up candidate searching
Jingyue Wu [Thu, 16 Apr 2015 18:42:31 +0000 (18:42 +0000)]
[NaryReassociate] speeds up candidate searching

Summary:
This fixes a left-over efficiency issue in D8950.

As Andrew and Daniel suggested, we can store the candidates in a stack
and pop the top element when it does not dominate the current
instruction. This reduces the worst-case time complexity to O(n).

Test Plan: a new test in nary-add.ll that exercises this optimization.

Reviewers: broune, dberlin, meheff, atrick

Reviewed By: atrick

Subscribers: llvm-commits, sanjoy

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

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

9 years agoProperly escaping the quotes so that bash doesn't do stupid things with the wildcards.
Chris Bieneman [Thu, 16 Apr 2015 18:36:32 +0000 (18:36 +0000)]
Properly escaping the quotes so that bash doesn't do stupid things with the wildcards.

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

9 years agoCleanup based on rnk's feedback.
Chris Bieneman [Thu, 16 Apr 2015 18:08:33 +0000 (18:08 +0000)]
Cleanup based on rnk's feedback.

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

9 years ago[X86, SSE] instcombine common cases of insertps intrinsics into shuffles
Sanjay Patel [Thu, 16 Apr 2015 17:52:13 +0000 (17:52 +0000)]
[X86, SSE] instcombine common cases of insertps intrinsics into shuffles

This is very similar to D8486 / r232852 (vperm2). If we treat insertps intrinsics
as shufflevectors, we can optimize them better.

I've left all but the full zero case of the zero mask variants out of this patch.
I don't think those can be converted into a single shuffle in all cases, but I'd
be happy to be proven wrong as I was for vperm2f128.

Either way, we'd need to support whatever sequence we come up with for those cases
in the backend before converting them here.

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

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

9 years agoFixing windows bots.
Chris Bieneman [Thu, 16 Apr 2015 17:40:51 +0000 (17:40 +0000)]
Fixing windows bots.

Third time's the try.

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

9 years agoBetter fix to the windows conditional.
Chris Bieneman [Thu, 16 Apr 2015 17:26:50 +0000 (17:26 +0000)]
Better fix to the windows conditional.

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

9 years agoFix Windows bots.
Chris Bieneman [Thu, 16 Apr 2015 17:25:17 +0000 (17:25 +0000)]
Fix Windows bots.

Turns out Windows is special. All library installs are RUNTIME.

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

9 years agoFor llvm-objdump added support for printing Objc1 32-bit runtime meta data
Kevin Enderby [Thu, 16 Apr 2015 17:19:59 +0000 (17:19 +0000)]
For llvm-objdump added support for printing Objc1 32-bit runtime meta data
with the existing -objc-meta-data and -macho options for Mach-O files.

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

9 years ago[WinEH] Handle a landingpad, resume, and cleanup all rolled into a BB
Reid Kleckner [Thu, 16 Apr 2015 17:02:23 +0000 (17:02 +0000)]
[WinEH] Handle a landingpad, resume, and cleanup all rolled into a BB

This happens a lot with simple cleanups after SimplifyCFG.

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

9 years agoEditorial changes in the programmers manual.
Charlie Turner [Thu, 16 Apr 2015 17:01:23 +0000 (17:01 +0000)]
Editorial changes in the programmers manual.

VMCore was renamed to IR back in 2013. The relevant "core"
implementations were moved into the lib/IR directory at the same time.

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

9 years agoDebugInfo: Allow DebugLocs to be constructed from const
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 16:56:29 +0000 (16:56 +0000)]
DebugInfo: Allow DebugLocs to be constructed from const

Allow `const`-qualified pointers to be used to construct `DebugLoc`s, as
a convenience.

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

9 years agoFixing llvm-shlib's LLVM_DYLIB_EXPORT_ALL to work with Darwin fat binaries.
Chris Bieneman [Thu, 16 Apr 2015 16:56:22 +0000 (16:56 +0000)]
Fixing llvm-shlib's LLVM_DYLIB_EXPORT_ALL to work with Darwin fat binaries.

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

9 years agoFixing a mis-use of the CMake install command.
Chris Bieneman [Thu, 16 Apr 2015 16:56:18 +0000 (16:56 +0000)]
Fixing a mis-use of the CMake install command.

The CMake install command is defined as:

install(TARGETS targets... [EXPORT <export-name>]
        [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|
          PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE]
         [DESTINATION <dir>]
         [INCLUDES DESTINATION [<dir> ...]]
         [PERMISSIONS permissions...]
         [CONFIGURATIONS [Debug|Release|...]]
         [COMPONENT <component>]
         [OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP]
        ] [...])

This means it can only take one parameter from the set of RUNTIME, LIBRARY, or ARCHIVE. If you set more than one of these it seems to gobble up the extra arguments and ignore the COMPONENT argument.

This adds a check to only set LIBRARY or ARCHIVE based on whether or not the library being built is shared.

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

9 years agoDebugInfo: Remove DIDescriptor from the DIBuilder API
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 16:36:23 +0000 (16:36 +0000)]
DebugInfo: Remove DIDescriptor from the DIBuilder API

As a step toward killing `DIDescriptor` and its subclasses, remove it
from the `DIBuilder` API.  Replace the subclasses with appropriate
pointers from the new debug info hierarchy.  There are a couple of
possible surprises in type choices for out-of-tree frontends:

  - Subroutine types: `MDSubroutineType`, not `MDCompositeTypeBase`.
  - Composite types: `MDCompositeType`, not `MDCompositeTypeBase`.
  - Scopes: `MDScope`, not `MDNode`.
  - Generic debug info nodes: `DebugNode`, not `MDNode`.

This is part of PR23080.

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

9 years agoRevert the switch lowering change (r235101, r235103, r235106)
Hans Wennborg [Thu, 16 Apr 2015 15:43:26 +0000 (15:43 +0000)]
Revert the switch lowering change (r235101, r235103, r235106)

Looks like it broke the sanitizer-ppc64-linux1 build. Reverting for now.

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

9 years ago[AArch64] Add v8.1a "Virtualization Host Extensions"
Vladimir Sukharev [Thu, 16 Apr 2015 15:38:58 +0000 (15:38 +0000)]
[AArch64] Add v8.1a "Virtualization Host Extensions"

Reviewers: t.p.northover

Subscribers: llvm-commits

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

Patch by: Tom Coxon

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

9 years agoAdd a triple to test/DebugInfo/unconditional-branch.ll (PR23252)
Hans Wennborg [Thu, 16 Apr 2015 15:35:44 +0000 (15:35 +0000)]
Add a triple to test/DebugInfo/unconditional-branch.ll (PR23252)

This started failing on Windows after my switch lowering change in r235101.

I suspect the error is unrelated, so adding a triple to pacify it
until it can be fixed. See the PR for details.

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

9 years ago[AArch64] Add v8.1a "Limited Ordering Regions" extension
Vladimir Sukharev [Thu, 16 Apr 2015 15:30:43 +0000 (15:30 +0000)]
[AArch64] Add v8.1a "Limited Ordering Regions" extension

Reviewers:  t.p.northover

Subscribers: llvm-commits

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

Patch by: Tom Coxon

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

9 years ago[AArch64] Add v8.1a "Privileged Access Never" extension
Vladimir Sukharev [Thu, 16 Apr 2015 15:20:51 +0000 (15:20 +0000)]
[AArch64] Add v8.1a "Privileged Access Never" extension

Reviewers: jmolloy

Subscribers: llvm-commits

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

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

9 years agoAdd a triple to switch.ll test.
Hans Wennborg [Thu, 16 Apr 2015 15:09:33 +0000 (15:09 +0000)]
Add a triple to switch.ll test.

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

9 years ago[AArch64] Handle Cyclone-specific register in common way
Vladimir Sukharev [Thu, 16 Apr 2015 15:01:20 +0000 (15:01 +0000)]
[AArch64] Handle Cyclone-specific register in common way

Reviewers: jmolloy

Subscribers: llvm-commits

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

Patch by: Tom Coxon

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

9 years agoSwitch lowering: extract jump tables and bit tests before building binary tree (PR22262)
Hans Wennborg [Thu, 16 Apr 2015 14:49:23 +0000 (14:49 +0000)]
Switch lowering: extract jump tables and bit tests before building binary tree (PR22262)

This is a major rewrite of the SelectionDAG switch lowering. The previous code
would lower switches as a binary tre, discovering clusters of cases
suitable for lowering by jump tables or bit tests as it went along. To increase
the likelihood of finding jump tables, the binary tree pivot was selected to
maximize case density on both sides of the pivot.

By not selecting the pivot in the middle, the binary trees would not always
be balanced, leading to performance problems in the generated code.

This patch rewrites the lowering to search for clusters of cases
suitable for jump tables or bit tests first, and then builds the binary
tree around those clusters. This way, the binary tree will always be balanced.

This has the added benefit of decoupling the different aspects of the lowering:
tree building and jump table or bit tests finding are now easier to tweak
separately.

For example, this will enable us to balance the tree based on profile info
in the future.

The algorithm for finding jump tables is O(n^2), whereas the previous algorithm
was O(n log n) for common cases, and quadratic only in the worst-case. This
doesn't seem to be major problem in practice, e.g. compiling a file consisting
of a 10k-case switch was only 30% slower, and such large switches should be rare
in practice. Compiling e.g. gcc.c showed no compile-time difference.  If this
does turn out to be a problem, we could limit the search space of the algorithm.

This commit also disables all optimizations during switch lowering in -O0.

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

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

9 years ago[AArch64] Follow-up to: Refactor AArch64NamedImmMapper to become dependent on subtarg...
Vladimir Sukharev [Thu, 16 Apr 2015 14:36:13 +0000 (14:36 +0000)]
[AArch64] Follow-up to: Refactor AArch64NamedImmMapper to become dependent on subtarget features

Fixed compilation with clang on some buildbots with "-Werror -Wmissing-field-initializers"

Related to: http://reviews.llvm.org/rL235089

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

9 years ago[mips] [IAS] Preserve microMIPS label marking for objects when assigning.
Toma Tabacu [Thu, 16 Apr 2015 13:37:32 +0000 (13:37 +0000)]
[mips] [IAS] Preserve microMIPS label marking for objects when assigning.

Summary: Previously, this was only happening for functions, but because of .insn, objects can also be marked now.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

9 years agoSilencing a -Wunused-but-set-variable warning; NFC.
Aaron Ballman [Thu, 16 Apr 2015 13:29:36 +0000 (13:29 +0000)]
Silencing a -Wunused-but-set-variable warning; NFC.

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

9 years agoDon't depend on the order relocations are written to a .o file.
Rafael Espindola [Thu, 16 Apr 2015 12:59:30 +0000 (12:59 +0000)]
Don't depend on the order relocations are written to a .o file.

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

9 years ago[Mips] Use unique_ptr to manage ownership.
Benjamin Kramer [Thu, 16 Apr 2015 12:43:33 +0000 (12:43 +0000)]
[Mips] Use unique_ptr to manage ownership.

Required some tweaking of ValueMap to accommodate a move-only value
type. No functional change intended.

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

9 years agoMake it obvious that we're iterating over a range of pointers.
Benjamin Kramer [Thu, 16 Apr 2015 12:43:07 +0000 (12:43 +0000)]
Make it obvious that we're iterating over a range of pointers.

Found by -Wrange-loop-analysis.

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

9 years ago[AArch64] Refactor AArch64NamedImmMapper to become dependent on subtarget features.
Vladimir Sukharev [Thu, 16 Apr 2015 12:15:27 +0000 (12:15 +0000)]
[AArch64] Refactor AArch64NamedImmMapper to become dependent on subtarget features.

In order to introduce v8.1a-specific entities, Mappers should be aware of SubtargetFeatures available.

This patch introduces refactoring, that will then allow to easily introduce:

- v8.1-specific "pan" PState for PStateMapper (PAN extension)

- v8.1-specific sysregs for SysRegMapper (LOR,VHE extensions)

Reviewers: jmolloy

Subscribers: llvm-commits

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

Patch by Tom Coxon

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

9 years ago[AArch64] Fix invalid use of references to BuildMI.
James Molloy [Thu, 16 Apr 2015 11:37:40 +0000 (11:37 +0000)]
[AArch64] Fix invalid use of references to BuildMI.

This was found in GCC PR65773 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65773).

We shouldn't be taking a reference to the temporary that BuildMI returns, we must copy it.

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

9 years ago[ARM] Add v8.1a "Privileged Access Never" extension
Vladimir Sukharev [Thu, 16 Apr 2015 11:34:25 +0000 (11:34 +0000)]
[ARM] Add v8.1a "Privileged Access Never" extension

Reviewers: jmolloy

Subscribers: llvm-commits

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

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

9 years agoUpdate MCELFStreamer::reset() following r234714
Yaron Keren [Thu, 16 Apr 2015 10:53:22 +0000 (10:53 +0000)]
Update MCELFStreamer::reset() following r234714
and order fields according to declaration order.

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

9 years ago[mips] [IAS] Add support for the .insn directive.
Toma Tabacu [Thu, 16 Apr 2015 09:53:47 +0000 (09:53 +0000)]
[mips] [IAS] Add support for the .insn directive.

Summary:
This assembler directive marks the current label as an instruction label in microMIPS and MIPS16.

This initial implementation works only for microMIPS.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

9 years agoRevert "[RuntimeDyldELF] Fold Placeholder into Addend"
Pavel Labath [Thu, 16 Apr 2015 08:58:15 +0000 (08:58 +0000)]
Revert "[RuntimeDyldELF] Fold Placeholder into Addend"

This reverts commit cbbeac14f0ddca71f6d8ff91cd05522bd23908e5.

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

9 years agoRevert "[RuntimeDyldELF] Fix missing cases in Placeholder processing"
Pavel Labath [Thu, 16 Apr 2015 08:58:11 +0000 (08:58 +0000)]
Revert "[RuntimeDyldELF] Fix missing cases in Placeholder processing"

This reverts commit ec0a34f850eca0d97e0592236e0ac14083aa1c3d.

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

9 years agoTRUNCATE constant folding - minor fix for rL233224
Simon Pilgrim [Thu, 16 Apr 2015 08:21:09 +0000 (08:21 +0000)]
TRUNCATE constant folding - minor fix for rL233224

Fix for test case found by James Molloy - TRUNCATE of constant build vectors can be more simply achieved by simply replacing with a new build vector node with the truncated value type - no need to touch the scalar operands at all.

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

9 years agoReplace loop doing postorder walk with postorder iterator
Daniel Berlin [Thu, 16 Apr 2015 04:28:32 +0000 (04:28 +0000)]
Replace loop doing postorder walk with postorder iterator

Summary: LoopInfoImpl's loop population is just a normal postorder walk, written out.

Reviewers: chandlerc

Subscribers: llvm-commits

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

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

9 years ago[CodeGen] Re-apply r234809 (concat of scalars), with an x86_mmx fix.
Ahmed Bougacha [Thu, 16 Apr 2015 02:39:14 +0000 (02:39 +0000)]
[CodeGen] Re-apply r234809 (concat of scalars), with an x86_mmx fix.

The only type that isn't an integer, isn't floating point, and isn't
a vector; ladies and gentlemen, the gift that keeps on giving: x86_mmx!

Fixes PR23246.

Original message (reverted in r235062):
[CodeGen] Combine concat_vectors of scalars into build_vector.

Combine something like:
  (v8i8 concat_vectors (v2i8 bitcast (i16)) x4)
into:
  (v8i8 (bitcast (v4i16 BUILD_VECTOR (i16) x4)))

If any of the scalars are floating point, use that throughout.

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

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

9 years agoDebugInfo: DIRef<> => TypedDebugNodeRef<>
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 02:24:01 +0000 (02:24 +0000)]
DebugInfo: DIRef<> => TypedDebugNodeRef<>

Delete `DIRef<>`, and replace the remaining uses of it with
`TypedDebugNodeRef<>`.  To minimize code churn, I've added typedefs from
`MDTypeRef` to `DITypeRef` (etc.).

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

9 years ago[RuntimeDyldELF] Fix missing cases in Placeholder processing
Keno Fischer [Thu, 16 Apr 2015 02:00:38 +0000 (02:00 +0000)]
[RuntimeDyldELF] Fix missing cases in Placeholder processing

Try to appease the build bots. We should write rtdyld test cases for these
to make them testible on other platforms.

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

9 years agoDebugInfo: Gut DIDescriptor
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:53:33 +0000 (01:53 +0000)]
DebugInfo: Gut DIDescriptor

PR23080 is almost finished.  With this commit, there's no consequential
API in `DIDescriptor` and its subclasses.  What's left?

  - Default-constructed to `nullptr`.
  - Handy `const_cast<>` (constructed from `const`, but accessors are
    non-`const`).

I think the safe way to catch those is to delete the classes and fix
compile errors.  That'll be my next step, after I delete the `DITypeRef`
(etc.) wrapper around `MDTypeRef`.

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

9 years agoDebugInfo: Gut DIScope, DIEnumerator and DISubrange
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:37:00 +0000 (01:37 +0000)]
DebugInfo: Gut DIScope, DIEnumerator and DISubrange

The only class the still has API left is `DIDescriptor` itself.

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

9 years agoDebugInfo: Gut DIType and subclasses
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:01:28 +0000 (01:01 +0000)]
DebugInfo: Gut DIType and subclasses

Continuing PR23080, gut `DIType` and its various subclasses, leaving
behind thin wrappers around the pointer types in the new debug info
hierarchy.

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

9 years agoRevert r234809 because it caused PR23246.
Nick Lewycky [Thu, 16 Apr 2015 00:56:20 +0000 (00:56 +0000)]
Revert r234809 because it caused PR23246.

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

9 years ago[SEH] Deal with users of the old lpad for SEH catch-all blocks
Reid Kleckner [Thu, 16 Apr 2015 00:02:04 +0000 (00:02 +0000)]
[SEH] Deal with users of the old lpad for SEH catch-all blocks

The way we split SEH catch-all blocks can leave some dead EH values
behind at -O0. Try to remove them, and if we fail, replace them all with
undef.

Fixes a crash when removing the old unreachable landingpad which is
still used by extractvalue instructions in the catch-all block.

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

9 years ago[RuntimeDyldELF] Fold Placeholder into Addend
Keno Fischer [Wed, 15 Apr 2015 23:49:29 +0000 (23:49 +0000)]
[RuntimeDyldELF] Fold Placeholder into Addend

Summary:

This allows us to get rid of the original unrelocated object file after
we're done processing relocations (but before applying them).
MachO and COFF already do not require this (currently we have temporary hacks
to prevent ownership from being released, but those are brittle and should be
removed soon).

The placeholder mechanism allowed the relocation resolver to look at original
object file to obtain more information that are required to apply the
relocations. This is usually necessary in two cases:

- For relocations targetting sub-word memory locations, there may be pieces
  of the instruction at the target address which we should not override.
- Some relocations on some platforms allow an extra addend to be encoded in
  their immediate fields.

The problem is that in the second case the information cannot be recovered
after the relocations have been applied once because they will have been
overridden. In the first case we also need to be careful to not use any bits
that aren't fixed and may have been overriden by applying a first relocation.

In the past both have been fixed by just looking at original object file. This
patch attempts to recover the information from the first by looking at the
relocated object file, while the extra addend in the second case is read
upon relocation processing and addend to the regular addend.

I have tested this on X86. Other platforms represent my best understanding
of how those relocations should work, but I may have missed something because
I do not have access to those platforms.
We will keep the ugly workarounds in place for a couple of days, so this commit
can be reverted if it breaks the bots.

Reviewers: petarj, t.p.northover, lhames

Reviewed By: lhames

Subscribers: aemerson, llvm-commits

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

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

9 years agoDebugInfo: Remove unnecessary API from DIDerivedType and DIType
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:49:09 +0000 (23:49 +0000)]
DebugInfo: Remove unnecessary API from DIDerivedType and DIType

Remove the accessors of `DIDerivedType` that downcast to
`MDDerivedType`, shifting the `cast<MDDerivedType>` into the callers.
Also remove `DIType::isValid()`, which is really just a check against
`nullptr` at this point.

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

9 years agoDebugInfo: Gut DICompileUnit and DIFile
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:19:27 +0000 (23:19 +0000)]
DebugInfo: Gut DICompileUnit and DIFile

Continuing gutting `DIDescriptor` subclasses; this edition,
`DICompileUnit` and `DIFile`.  In the name of PR23080.

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

9 years agoDebugInfo: factor out dead variable in NDEBUG from r235050
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 22:42:43 +0000 (22:42 +0000)]
DebugInfo: factor out dead variable in NDEBUG from r235050

Caught by the lld bot:

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/9832

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

9 years agoDebugInfo: Remove 'inlinedAt:' field from MDLocalVariable
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 22:29:27 +0000 (22:29 +0000)]
DebugInfo: Remove 'inlinedAt:' field from MDLocalVariable

Remove 'inlinedAt:' from MDLocalVariable.  Besides saving some memory
(variables with it seem to be single largest `Metadata` contributer to
memory usage right now in -g -flto builds), this stops optimization and
backend passes from having to change local variables.

The 'inlinedAt:' field was used by the backend in two ways:

 1. To tell the backend whether and into what a variable was inlined.
 2. To create a unique id for each inlined variable.

Instead, rely on the 'inlinedAt:' field of the intrinsic's `!dbg`
attachment, and change the DWARF backend to use a typedef called
`InlinedVariable` which is `std::pair<MDLocalVariable*, MDLocation*>`.
This `DebugLoc` is already passed reliably through the backend (as
verified by r234021).

This commit removes the check from r234021, but I added a new check
(that will survive) in r235048, and changed the `DIBuilder` API in
r235041 to require a `!dbg` attachment whose 'scope:` is in the same
`MDSubprogram` as the variable's.

If this breaks your out-of-tree testcases, perhaps the script I used
(mdlocalvariable-drop-inlinedat.sh) will help; I'll attach it to PR22778
in a moment.

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

9 years agoVerifier: Check that @llvm.dbg.* intrinsics have a !dbg attachment
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 22:15:46 +0000 (22:15 +0000)]
Verifier: Check that @llvm.dbg.* intrinsics have a !dbg attachment

Before we start to rely on valid `!dbg` attachments, add a check to the
verifier that `@llvm.dbg.*` intrinsics always have one.  Also check that
the `scope:` fields point at the same `MDSubprogram`.

This is in the context of PR22778.  The check that the `inlinedAt:`
fields agree has baked for a while (since r234021), so I'll kill [1] the
`MDLocalVariable::getInlinedAt()` field soon.

[1]: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150330/269387.html

Unfortunately, that means it's impossible to keep the current `Verifier`
checks, which rely on comparing `inlinedAt:` fields.  We'll be able to
keep the checks I'm adding here.

If this breaks your out-of-tree testcases, the upgrade script
(add-dbg-to-intrinsics.sh) attached to PR22778 that I used for r235040
might fix them for you.

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

9 years agoOne more -Wrange-loop-analysis cleanup.
Richard Trieu [Wed, 15 Apr 2015 21:40:50 +0000 (21:40 +0000)]
One more -Wrange-loop-analysis cleanup.

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

9 years ago[RuntimeDyld] Work around a bug in RuntimeDyldELF exposed by r234839.
Lang Hames [Wed, 15 Apr 2015 21:18:41 +0000 (21:18 +0000)]
[RuntimeDyld] Work around a bug in RuntimeDyldELF exposed by r234839.

Hopefully this will fix the failures on the windows builders that started with
r234839.

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

9 years agoDebugInfo: Require a DebugLoc in DIBuilder::insertDeclare()
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 21:18:07 +0000 (21:18 +0000)]
DebugInfo: Require a DebugLoc in DIBuilder::insertDeclare()

Change `DIBuilder::insertDeclare()` and `insertDbgValueIntrinsic()` to
take an `MDLocation*`/`DebugLoc` parameter which it attaches to the
created intrinsic.  Assert at creation time that the `scope:` field's
subprogram matches the variable's.  There's a matching `clang` commit to
use the API.

The context for this is PR22778, which is removing the `inlinedAt:`
field from `MDLocalVariable`, instead deferring to the `!dbg` location
attached to the debug info intrinsic.  The best way to ensure we always
have a `!dbg` attachment is to require one at creation time.  I'll be
adding verifier checks next, but this API change is the best way to
shake out frontend bugs.

Note: I added an `llvm_unreachable()` in `bindings/go` and passed in
`nullptr` for the `DebugLoc`.  The `llgo` folks will eventually need to
pass a valid `DebugLoc` here.

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

9 years agoDebugInfo: Add missing !dbg attachments to intrinsics
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 21:04:10 +0000 (21:04 +0000)]
DebugInfo: Add missing !dbg attachments to intrinsics

Add missing `!dbg` attachments to `@llvm.dbg.*` intrinsics.  I updated
these using a script (add-dbg-to-intrinsics.sh) that I'll attach to
PR22778 for posterity.

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

9 years agoUpdate for post-commit review comments
Daniel Berlin [Wed, 15 Apr 2015 19:36:10 +0000 (19:36 +0000)]
Update for post-commit review comments

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

9 years ago[WinEH] Try to make the MachineFunction CFG more accurate
Reid Kleckner [Wed, 15 Apr 2015 18:48:15 +0000 (18:48 +0000)]
[WinEH] Try to make the MachineFunction CFG more accurate

This avoids emitting code for unreachable landingpad blocks that contain
calls to llvm.eh.actions and indirectbr.

It's also a first step towards unifying the SEH and WinEH lowering
codepaths. I'm keeping the old fan-in lowering of SEH around until the
preparation version works well enough that we can switch over without
breaking existing users.

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

9 years ago[Orc] Refactor the CompileOnDemandLayer to make its addModuleSet method
Lang Hames [Wed, 15 Apr 2015 18:26:24 +0000 (18:26 +0000)]
[Orc] Refactor the CompileOnDemandLayer to make its addModuleSet method
signature match the other layers.

This makes it possible to compose other layers (e.g. IRTransformLayer) on top
of CompileOnDemandLayer.

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

9 years agoReland "[WinEH] Use the parent function when computing frameescape labels"
Reid Kleckner [Wed, 15 Apr 2015 17:47:26 +0000 (17:47 +0000)]
Reland "[WinEH] Use the parent function when computing frameescape labels"

Fixed the test by removing extraneous quotes.

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

9 years agoRevert "[WinEH] Use the parent function when computing frameescape labels"
Reid Kleckner [Wed, 15 Apr 2015 17:43:54 +0000 (17:43 +0000)]
Revert "[WinEH] Use the parent function when computing frameescape labels"

This reverts commit r235025. The test isn't passing yet.

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

9 years agoAdd range iterators for post order and inverse post order. Use them
Daniel Berlin [Wed, 15 Apr 2015 17:41:42 +0000 (17:41 +0000)]
Add range iterators for post order and inverse post order. Use them

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

9 years ago[WinEH] Use the parent function when computing frameescape labels
Reid Kleckner [Wed, 15 Apr 2015 17:32:01 +0000 (17:32 +0000)]
[WinEH] Use the parent function when computing frameescape labels

Fixes assertions in MC when a local label wasn't defined.

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

9 years agoFix BXJ is undefined in AArch32.
Charlie Turner [Wed, 15 Apr 2015 17:28:23 +0000 (17:28 +0000)]
Fix BXJ is undefined in AArch32.

BXJ was incorrectly said to be unsupported in ARMv8-A. It is not
supported in the A64 instruction set, but it is supported in the T32
and A32 instruction sets, because it's listed as an instruction in the
ARM ARM section F7.1.28.

Using SP as an operand to BXJ changed from UNPREDICTABLE to
PREDICTABLE in v8-A. This patch reflects that update as well.

This was found by MCHammer.

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

9 years agoMake it explicit which sections these relocations are in.
Rafael Espindola [Wed, 15 Apr 2015 17:24:06 +0000 (17:24 +0000)]
Make it explicit which sections these relocations are in.

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

9 years ago[NFC] [SLSR] clean up some tests
Jingyue Wu [Wed, 15 Apr 2015 17:14:03 +0000 (17:14 +0000)]
[NFC] [SLSR] clean up some tests

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

9 years agoMake it clear in which sections these relocations are.
Rafael Espindola [Wed, 15 Apr 2015 16:59:47 +0000 (16:59 +0000)]
Make it clear in which sections these relocations are.

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

9 years ago[SLSR] handle candidate form (B + i * S)
Jingyue Wu [Wed, 15 Apr 2015 16:46:13 +0000 (16:46 +0000)]
[SLSR] handle candidate form (B + i * S)

Summary:
With this patch, SLSR may rewrite

S1: X = B + i * S
S2: Y = B + i' * S

to

S2: Y = X + (i' - i) * S

A secondary improvement: if (i' - i) is a power of 2, emit Y as X + (S << log(i' - i)). (S << log(i' -i)) is in a canonical form and thus more likely GVN'ed than (i' - i) * S.

Test Plan: slsr-add.ll

Reviewers: hfinkel, sanjoy, meheff, broune, eliben

Reviewed By: eliben

Subscribers: llvm-commits

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

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

9 years agoMake it clear where the relocations we are CHECKING are from.
Rafael Espindola [Wed, 15 Apr 2015 16:45:03 +0000 (16:45 +0000)]
Make it clear where the relocations we are CHECKING are from.

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

9 years agoUpdate tests to not be as dependent on section numbers.
Rafael Espindola [Wed, 15 Apr 2015 15:59:37 +0000 (15:59 +0000)]
Update tests to not be as dependent on section numbers.

Many of these predate llvm-readobj. With elf-dump we had to match
a relocation to symbol number and symbol number to symbol name or
section number.

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

9 years ago[X86] add an exedepfix entry for movq == movlps == movlpd
Sanjay Patel [Wed, 15 Apr 2015 15:47:51 +0000 (15:47 +0000)]
[X86] add an exedepfix entry for movq == movlps == movlpd

This is a 1-line patch (with a TODO for AVX because that will affect
even more regression tests) that lets us substitute the appropriate
64-bit store for the float/double/int domains.

It's not clear to me exactly what the difference is between the 0xD6 (MOVPQI2QImr) and
0x7E (MOVSDto64mr) opcodes, but this is apparently the right choice.

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

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

9 years ago[x86] Implement combineRepeatedFPDivisors
Sanjay Patel [Wed, 15 Apr 2015 15:22:55 +0000 (15:22 +0000)]
[x86] Implement combineRepeatedFPDivisors

Set the transform bar at 2 divisions because the fastest current
x86 FP divider circuit is in SandyBridge / Haswell at 10 cycle
latency (best case) relative to a 5 cycle multiplier.
So that's the worst case for this transform (no latency win),
but multiplies are obviously pipelined while divisions are not,
so there's still a big throughput win which we would expect to
show up in typical FP code.

These are the sequences I'm comparing:

  divss   %xmm2, %xmm0
  mulss   %xmm1, %xmm0
  divss   %xmm2, %xmm0

Becomes:

  movss   LCPI0_0(%rip), %xmm3    ## xmm3 = mem[0],zero,zero,zero
  divss   %xmm2, %xmm3
  mulss   %xmm3, %xmm0
  mulss   %xmm1, %xmm0
  mulss   %xmm3, %xmm0

[Ignore for the moment that we don't optimize the chain of 3 multiplies
into 2 independent fmuls followed by 1 dependent fmul...this is the DAG
version of: https://llvm.org/bugs/show_bug.cgi?id=21768 ...if we fix that,
then the transform becomes even more profitable on all targets.]

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

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

9 years ago[MBP] Spell the conditions the same way through out this if statement.
Chandler Carruth [Wed, 15 Apr 2015 13:39:42 +0000 (13:39 +0000)]
[MBP] Spell the conditions the same way through out this if statement.
NFC.

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

9 years ago[MBP] Sink a comment into the if block to which it pertains. This makes
Chandler Carruth [Wed, 15 Apr 2015 13:26:41 +0000 (13:26 +0000)]
[MBP] Sink a comment into the if block to which it pertains. This makes
the content of the comment make much more sense.

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

9 years ago[MBP] Fix a really misleading typo in a comment.
Chandler Carruth [Wed, 15 Apr 2015 13:19:54 +0000 (13:19 +0000)]
[MBP] Fix a really misleading typo in a comment.

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

9 years agoWrite section and section table entries in the same order.
Rafael Espindola [Wed, 15 Apr 2015 13:07:47 +0000 (13:07 +0000)]
Write section and section table entries in the same order.

We had two different orders, which has no value.

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

9 years ago[msp430] Only support the 'm' inline assembly memory constraint. NFC.
Daniel Sanders [Wed, 15 Apr 2015 12:51:28 +0000 (12:51 +0000)]
[msp430] Only support the 'm' inline assembly memory constraint. NFC.

Summary:
MSP430 doesn't seem to have any additional constraints. Therefore remove
the target hook.

No functional change intended.

Subscribers: llvm-commits

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

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

9 years agoClarify that Twine::toVector *appends* the Twine to the given SmallString.
Yaron Keren [Wed, 15 Apr 2015 11:27:32 +0000 (11:27 +0000)]
Clarify that Twine::toVector *appends* the Twine to the given SmallString.

That's the way it works now, since toVector does not clear the given
SmallString before printing to it.

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

9 years agoRevert "Verify sizes when trying to read a VBR"
Filipe Cabecinhas [Wed, 15 Apr 2015 11:10:17 +0000 (11:10 +0000)]
Revert "Verify sizes when trying to read a VBR"

This reverts r234984 since it seems to break some bots (most of them
seemed arm*-selfhost).

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

9 years ago[mips] [IAS] Refactor the function which checks for the availability of AT. NFC.
Toma Tabacu [Wed, 15 Apr 2015 10:48:56 +0000 (10:48 +0000)]
[mips] [IAS] Refactor the function which checks for the availability of AT. NFC.

Summary:
Refactor MipsAsmParser::getATReg to return an internal register number instead of a register index.
Also change all the int's to unsigned, seeing as the current AT register index is stored as an unsigned in MipsAssemblerOptions.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

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

9 years agoVerify sizes when trying to read a VBR
Filipe Cabecinhas [Wed, 15 Apr 2015 08:48:08 +0000 (08:48 +0000)]
Verify sizes when trying to read a VBR

Also added an assert to ReadVBR64.

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

9 years agoFix lib\support\Windows/TimeValue.inc(48): warning C4189:
Yaron Keren [Wed, 15 Apr 2015 07:45:52 +0000 (07:45 +0000)]
Fix lib\support\Windows/TimeValue.inc(48): warning C4189:

'Error' : local variable is initialized but not referenced.

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

9 years agoRe-apply r234898 and fix tests.
Daniel Jasper [Wed, 15 Apr 2015 06:24:07 +0000 (06:24 +0000)]
Re-apply r234898 and fix tests.

This commit makes LLVM not estimate branch probabilities when doing a
single bit bitmask tests.

The code that originally made me discover this is:

  if ((a & 0x1) == 0x1) {
    ..
  }

In this case we don't actually have any branch probability information
and should not assume to have any. LLVM transforms this into:

  %and = and i32 %a, 1
  %tobool = icmp eq i32 %and, 0

So, in this case, the result of a bitwise and is compared against 0,
but nevertheless, we should not assume to have probability
information.

CodeGen/ARM/2013-10-11-select-stalls.ll started failing because the
changed probabilities changed the results of
ARMBaseInstrInfo::isProfitableToIfCvt() and led to an Ifcvt of the
diamond in the test. AFAICT, the test was never meant to test this and
thus changing the test input slightly to not change the probabilities
seems like the best way to preserve the meaning of the test.

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

9 years ago[RuntimeDyld] Add casts to make delta computation 64-bit.
Lang Hames [Wed, 15 Apr 2015 04:46:01 +0000 (04:46 +0000)]
[RuntimeDyld] Add casts to make delta computation 64-bit.

Hopefully this will fix the i686/msvc build failure described at:
http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/803

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