platform/upstream/llvm.git
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.

llvm-svn: 235116

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.

llvm-svn: 235115

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.

llvm-svn: 235114

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.

llvm-svn: 235113

9 years agoDebugInfo: Update for LLVM API change in DIBuilder (r235111)
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 16:36:45 +0000 (16:36 +0000)]
DebugInfo: Update for LLVM API change in DIBuilder (r235111)

LLVM r235111 changed the `DIBuilder` API to stop using `DIDescriptor`
and its subclasses.  Rolled into this was some tightening up of types:

  - Scopes: `DIDescriptor` => `MDScope*`.
  - Generic debug nodes: `DIDescriptor` => `DebugNode*`.
  - Subroutine types: `DICompositeType` => `MDSubroutineType*`.
  - Composite types: `DICompositeType` => `MDCompositeType*`.

Note that `DIDescriptor` wraps `MDNode`, and `DICompositeType` wraps
`MDCompositeTypeBase`.

It's this new type strictness that requires changes here.

llvm-svn: 235112

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.

llvm-svn: 235111

9 years ago[AArch64] Add v8.1a architecture
Vladimir Sukharev [Thu, 16 Apr 2015 15:53:09 +0000 (15:53 +0000)]
[AArch64] Add v8.1a architecture

Add support for AArch64 v8.1 architecture. Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: jmolloy

Subscribers: cfe-commits

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

llvm-svn: 235110

9 years agoAdds lldb support for querying the register mapping from gdbserver remote targets...
Colin Riley [Thu, 16 Apr 2015 15:51:33 +0000 (15:51 +0000)]
Adds lldb support for querying the register mapping from gdbserver remote targets using qXfer:features:read packet. Only enabled if libxml2 enabled in build.

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

llvm-svn: 235109

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.

llvm-svn: 235108

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

llvm-svn: 235107

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.

llvm-svn: 235106

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

llvm-svn: 235105

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

llvm-svn: 235104

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.

llvm-svn: 235103

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

llvm-svn: 235102

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

llvm-svn: 235101

9 years agoXFAIL a test in TestGdbRemoteRegisterState.py on linux to stabilize build bot
Pavel Labath [Thu, 16 Apr 2015 14:47:01 +0000 (14:47 +0000)]
XFAIL a test in TestGdbRemoteRegisterState.py on linux to stabilize build bot

llvm-svn: 235100

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

llvm-svn: 235099

9 years agoFix thumb symbol value fixup in ObjectFileELF
Tamas Berghammer [Thu, 16 Apr 2015 14:06:18 +0000 (14:06 +0000)]
Fix thumb symbol value fixup in ObjectFileELF

llvm-svn: 235098

9 years agoFix printing of the failure address in NativeThreadLinux
Tamas Berghammer [Thu, 16 Apr 2015 14:06:15 +0000 (14:06 +0000)]
Fix printing of the failure address in NativeThreadLinux

llvm-svn: 235097

9 years ago[OPENMP] Fix for checking of data-sharing attributes for canonical var decls only.
Alexey Bataev [Thu, 16 Apr 2015 13:49:42 +0000 (13:49 +0000)]
[OPENMP] Fix for checking of data-sharing attributes for canonical var decls only.

Currently checks for active data-sharing attributes for variables are performed for found var decls. Instead these checks must be performed for canonical decls of these variables to avoid possible troubles with with the differently qualified re-declarations of the same variable, for example:
namespace A { int x; }
namespace B { using A::x; }
Both A::x and B::x actually reference the same object A::x and this fact must be taken into account during data-sharing attributes analysis.

llvm-svn: 235096

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

llvm-svn: 235095

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.

llvm-svn: 235094

9 years agoXFAILing TestGdbRemoteAttach to stabilise linux build bot
Pavel Labath [Thu, 16 Apr 2015 13:03:55 +0000 (13:03 +0000)]
XFAILing TestGdbRemoteAttach to stabilise linux build bot

also, deleting what appears to be a concatenation of a file with itself (How that compiled in the
first place?).

llvm-svn: 235093

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.

llvm-svn: 235092

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.

llvm-svn: 235091

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.

llvm-svn: 235090

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

llvm-svn: 235089

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.

llvm-svn: 235088

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

llvm-svn: 235087

9 years agoupdated copyright date to 2015
Andrey Churbanov [Thu, 16 Apr 2015 11:10:17 +0000 (11:10 +0000)]
updated copyright date to 2015

llvm-svn: 235086

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.

llvm-svn: 235085

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

llvm-svn: 235084

9 years agoAppend to CFLAGS_EXTRAS and LD_EXTRAS when building cmdline.
Robert Flack [Thu, 16 Apr 2015 09:18:12 +0000 (09:18 +0000)]
Append to CFLAGS_EXTRAS and LD_EXTRAS when building cmdline.

When building the command-line for compilations during tests, append to
CFLAGS_EXTRAS and LD_EXTRAS to preserve switches set by the environment
(i.e. for cross compiling to test on another platform).

Test Plan:
TestCPP11EnumTypes.py passes testing from macosx -> linux remotely with cross
compiling args in CFLAGS_EXTRAS and LD_EXTRAS.

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

llvm-svn: 235083

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.

llvm-svn: 235082

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.

llvm-svn: 235081

9 years agoclang-format: add an option for fallback style in vimrc
Daniel Jasper [Thu, 16 Apr 2015 08:26:37 +0000 (08:26 +0000)]
clang-format: add an option for fallback style in vimrc

With this patch, clang-format.py will search and use existing .clang-format
file if there is one and fallback to the specific format style if
not. It should cover the projects which don't have .clang-format
files in their source. As the option fallback-style is available in
clang 3.5 or later, it is safe to use.

Patch by "Chilledheart" (http://reviews.llvm.org/D8489).

llvm-svn: 235080

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.

llvm-svn: 235079

9 years agoclang-format: [JS] handle comments in template strings.
Daniel Jasper [Thu, 16 Apr 2015 08:20:51 +0000 (08:20 +0000)]
clang-format: [JS] handle comments in template strings.

Patch by Martin Probst. Thank you.

llvm-svn: 235078

9 years agoPass normalized target file paths via GDB-remote to a target and denormalize them...
Oleksiy Vyalov [Thu, 16 Apr 2015 07:02:56 +0000 (07:02 +0000)]
Pass normalized target file paths via GDB-remote to a target and denormalize them on the target.

http://reviews.llvm.org/D8980

llvm-svn: 235077

9 years agoclang-format: Undo r214508. It was essentially always removing the
Daniel Jasper [Thu, 16 Apr 2015 07:02:19 +0000 (07:02 +0000)]
clang-format: Undo r214508. It was essentially always removing the
space where we already had the flag ObjCSpaceBeforeProtocolList to
control it. I don't know what I was thinking.

llvm-svn: 235076

9 years ago[OPENMP] Codegen for 'copyin' clause in 'parallel' directive.
Alexey Bataev [Thu, 16 Apr 2015 05:39:01 +0000 (05:39 +0000)]
[OPENMP] Codegen for 'copyin' clause in 'parallel' directive.

Emits the following code for the clause at the beginning of the outlined function for implicit threads:

if (<not a master thread>) {
  ...
  <thread local copy of var> = <master thread local copy of var>;
  ...
}
<sync point>;
Checking for a non-master thread is performed by comparing of the address of the thread local variable with the address of the master's variable. Master thread always uses original variables, so you always know the address of the variable in the master thread.
Differential Revision: http://reviews.llvm.org/D9026

llvm-svn: 235075

9 years ago[OPENMP] Codegen for 'lastprivate' clause in 'for' directive.
Alexey Bataev [Thu, 16 Apr 2015 04:54:05 +0000 (04:54 +0000)]
[OPENMP] Codegen for 'lastprivate' clause in 'for' directive.

#pragma omp for lastprivate(<var>)
for (i = a; i < b; ++b)
  <BODY>;

This construct is translated into something like:

  <last_iter> = alloca i32
  <lastprivate_var> = alloca <type>
  <last_iter> = 0
  ; No initializer for simple variables or a default constructor is called for objects.
  ; For arrays perform element by element initialization by the call of the default constructor.
  ...
  OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration.
  <BODY>
  ...
  OMP_FOR_END
  if (<last_iter> != 0) {
    <var> = <lastprivate_var> ; Update original variable with the lastprivate value.
  }
  call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race.

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

llvm-svn: 235074

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

llvm-svn: 235073

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

llvm-svn: 235072

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.).

llvm-svn: 235071

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.

llvm-svn: 235070

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`.

llvm-svn: 235069

9 years agoDebugInfo: Prepare for DIDescriptor to be gutted in LLVM
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:53:23 +0000 (01:53 +0000)]
DebugInfo: Prepare for DIDescriptor to be gutted in LLVM

All the API is about to be dropped from `DIDescriptor` in LLVM, so stop
using it.

llvm-svn: 235068

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.

llvm-svn: 235067

9 years agoDebugInfo: Prepare for DIScope to be gutted in LLVM
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:36:36 +0000 (01:36 +0000)]
DebugInfo: Prepare for DIScope to be gutted in LLVM

An upcoming LLVM commit will gut `DIScope`, so just use `MDScope*`
directly.

llvm-svn: 235066

9 years agoMake -arch work on MacOSX.
Greg Clayton [Thu, 16 Apr 2015 01:18:05 +0000 (01:18 +0000)]
Make -arch work on MacOSX.

llvm-svn: 235065

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.

llvm-svn: 235064

9 years agoDebugInfo: Prepare for DIType to be gutted
Duncan P. N. Exon Smith [Thu, 16 Apr 2015 01:00:56 +0000 (01:00 +0000)]
DebugInfo: Prepare for DIType to be gutted

`DIType` and its subclasses are about to be gutted in LLVM.  Prepare for
that by treating these like the raw pointers they wrap.

llvm-svn: 235063

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.

llvm-svn: 235062

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.

llvm-svn: 235061

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

llvm-svn: 235060

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.

llvm-svn: 235059

9 years agoDebugInfo: Prepare for LLVM change removing DIType::isValid()
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:48:50 +0000 (23:48 +0000)]
DebugInfo: Prepare for LLVM change removing DIType::isValid()

This is being replaced with a null check.

llvm-svn: 235058

9 years agoComment parsing: fix an assertion failure on a verbatim block terminated with "**/"
Dmitri Gribenko [Wed, 15 Apr 2015 23:45:43 +0000 (23:45 +0000)]
Comment parsing: fix an assertion failure on a verbatim block terminated with "**/"

llvm-svn: 235057

9 years agoFix OS default in Makefile.rules for Windows. http://reviews.llvm.org/D9043
Adrian McCarthy [Wed, 15 Apr 2015 23:38:23 +0000 (23:38 +0000)]
Fix OS default in Makefile.rules for Windows. reviews.llvm.org/D9043

llvm-svn: 235056

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.

llvm-svn: 235055

9 years agoDebugInfo: Prepare for LLVM gutting DICompileUnit/DIFile
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 23:19:15 +0000 (23:19 +0000)]
DebugInfo: Prepare for LLVM gutting DICompileUnit/DIFile

An upcoming LLVM commit will gut `DICompileUnit` and `DIFile`, so start
treating them more like pointers.

llvm-svn: 235054

9 years agoDon't crash when a selectany symbol would get common linkage
Nico Weber [Wed, 15 Apr 2015 23:04:24 +0000 (23:04 +0000)]
Don't crash when a selectany symbol would get common linkage

Things can't both be in comdats and have common linkage, so never give things
in comdats common linkage. Common linkage is only used in .c files, and the
only thing that can trigger a comdat in c is selectany from what I can tell.
Fixes PR23243.

Also address an over-the-shoulder review comment from rnk by moving the
hasAttr<SelectAnyAttr>() in Decl.cpp around a bit. It only makes a minor
difference for selectany on global variables, so it goes well with the rest of
this patch.

http://reviews.llvm.org/D9042

llvm-svn: 235053

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

llvm-svn: 235052

9 years agoFix for PR20402 in -Wconsumed.
DeLesley Hutchins [Wed, 15 Apr 2015 22:32:44 +0000 (22:32 +0000)]
Fix for PR20402 in -Wconsumed.
https://llvm.org/bugs/show_bug.cgi?id=20402
Patch by Chris Wailes.

llvm-svn: 235051

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.

llvm-svn: 235050

9 years agoCreate a frontend flag to disable CUDA cross-target call checks
Eli Bendersky [Wed, 15 Apr 2015 22:27:06 +0000 (22:27 +0000)]
Create a frontend flag to disable CUDA cross-target call checks

For CUDA source, Sema checks that the targets of call expressions make sense
(e.g. a host function can't call a device function).

Adding a flag that lets us skip this check. Motivation: for source-to-source
translation tools that have to accept code that's not strictly kosher CUDA but
is still accepted by nvcc. The source-to-source translation tool can then fix
the code and leave calls that are semantically valid for the actual compilation
stage.

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

llvm-svn: 235049

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.

llvm-svn: 235048

9 years agoclang-format a line containing nothing but a "{". No behavior change.
Nico Weber [Wed, 15 Apr 2015 21:53:00 +0000 (21:53 +0000)]
clang-format a line containing nothing but a "{". No behavior change.

llvm-svn: 235047

9 years agoMake __declspec(selectany) turn variable declartions into definitions.
Nico Weber [Wed, 15 Apr 2015 21:50:06 +0000 (21:50 +0000)]
Make __declspec(selectany) turn variable declartions into definitions.

Fixes PR23242.

llvm-svn: 235046

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.

llvm-svn: 235044

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.

llvm-svn: 235043

9 years agoDebugInfo: Pass DebugLocs when creating intrinsics
Duncan P. N. Exon Smith [Wed, 15 Apr 2015 21:18:30 +0000 (21:18 +0000)]
DebugInfo: Pass DebugLocs when creating intrinsics

Update for LLVM API change r235041 that makes `DIBuilder` require a
`DebugLoc` to create a debug info intrinsic.

llvm-svn: 235042

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.

llvm-svn: 235041

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.

llvm-svn: 235040

9 years agoFix docs typo in FunctionTemplateSpecializationInfo
Jonathan Roelofs [Wed, 15 Apr 2015 20:47:22 +0000 (20:47 +0000)]
Fix docs typo in FunctionTemplateSpecializationInfo

llvm-svn: 235039

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

llvm-svn: 235038

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.

llvm-svn: 235037

9 years ago[TestRvalueReferences] Fix an expectation.
Siva Chandra [Wed, 15 Apr 2015 18:35:29 +0000 (18:35 +0000)]
[TestRvalueReferences] Fix an expectation.

Summary:
If 'i' is an rvalue reference to an 'int', evaluating it with the
'expression' command will return an 'int' value and not an 'int &&'.
Before this patch, an 'int &&' type was expected.

Enabled the test for clang and gcc as all parts of the test now pass
when the testcase is compiled with them.

Test Plan: dotest.py -C <gcc|clang> -p TestRvalueReferences

Reviewers: spyffe, chaoren

Subscribers: lldb-commits

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

llvm-svn: 235036

9 years ago[Mips] Make tests more tolerant to offsets, symbol sizes etc
Simon Atanasyan [Wed, 15 Apr 2015 18:32:22 +0000 (18:32 +0000)]
[Mips] Make tests more tolerant to offsets, symbol sizes etc

No functional changes.

llvm-svn: 235035

9 years ago[TestMiBreak] Print a formatted string via printf in the test case.
Siva Chandra [Wed, 15 Apr 2015 18:32:17 +0000 (18:32 +0000)]
[TestMiBreak] Print a formatted string via printf in the test case.

Summary:
If the string is not formatted, these can happen when compiled with GCC:
1. If it is a null string "", then GCC completely removes the call to
printf even with -O0.
2. If the string is a single character string, say "\n" for example,
then GCC replaces the call to printf with a call to putchar.
3. If the string length is greater than 1, but is not formatted, then
GCC replaces the call to printf with a call to puts.

All the above will fail the test as we want a breakpoint on "printf" to
hit.

Test Plan: dotest.py -C gcc -p TestMiBreak

Reviewers: chying, ki.stfu

Reviewed By: ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 235034

9 years ago[Mips] clang-format the code
Simon Atanasyan [Wed, 15 Apr 2015 18:32:05 +0000 (18:32 +0000)]
[Mips] clang-format the code

llvm-svn: 235033

9 years ago[Mips] Remove redundant `.got` section lookup
Simon Atanasyan [Wed, 15 Apr 2015 18:31:59 +0000 (18:31 +0000)]
[Mips] Remove redundant `.got` section lookup

No functional changes.

llvm-svn: 235032

9 years ago[Mips] Create _GLOBAL_OFFSET_TABLE_ only if the .got section exists
Simon Atanasyan [Wed, 15 Apr 2015 18:31:53 +0000 (18:31 +0000)]
[Mips] Create _GLOBAL_OFFSET_TABLE_ only if the .got section exists

llvm-svn: 235031

9 years ago[Mips] Check `_gp_disp` symbol using a trivial string comparison
Simon Atanasyan [Wed, 15 Apr 2015 18:31:44 +0000 (18:31 +0000)]
[Mips] Check `_gp_disp` symbol using a trivial string comparison

No functional changes.

llvm-svn: 235030

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.

llvm-svn: 235029

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.

llvm-svn: 235028

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.

llvm-svn: 235027

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

llvm-svn: 235026

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.

llvm-svn: 235025

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.

llvm-svn: 235024

9 years ago[Objective-C Sema]This patch fixes the warning when clang issues
Fariborz Jahanian [Wed, 15 Apr 2015 17:26:21 +0000 (17:26 +0000)]
[Objective-C Sema]This patch fixes the warning when clang issues
"multiple methods named '<selector>' found" warning by noting
the method that is actualy used. It also cleans up and refactors
code in this area and selects a method that matches actual arguments
in case of receiver being a forward class object.
rdar://19265430

llvm-svn: 235023

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.

llvm-svn: 235022

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

llvm-svn: 235021

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.

llvm-svn: 235020

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

llvm-svn: 235019

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.

llvm-svn: 235018

9 years agoAdd comments to LLDB-MI disassembly.
Ilia K [Wed, 15 Apr 2015 16:17:50 +0000 (16:17 +0000)]
Add comments to LLDB-MI disassembly.

Summary:
This patch adds the comments which are included in LLDB disassembly, but are currently missing in MI, e.g.

 ^done,asm_insns=[...,{address="0x00000000004004ff",func-name="main",offset="18",size="2",inst="jmp 0x40050b ; <+30> at main.c:7"}]

 instead of

 ^done,asm_insns=[...,{address="0x00000000004004ff",func-name="main",offset="18",size="2",inst="jmp 0x40050b"}]

Thanks, Ewan

Patch from ewan@codeplay.com

Reviewers: abidh, EwanCrawford

Subscribers: ted, lldb-commits, deepak2427

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

llvm-svn: 235017

9 years agoImprove MiBreakTestCase tests to expect =breakpoint-modified event after r234483
Ilia K [Wed, 15 Apr 2015 16:10:53 +0000 (16:10 +0000)]
Improve MiBreakTestCase tests to expect =breakpoint-modified event after r234483

llvm-svn: 235016