platform/upstream/llvm.git
9 years agoNormally an 'optnone' function goes through fast-isel, which does not
Paul Robinson [Mon, 3 Nov 2014 18:19:26 +0000 (18:19 +0000)]
Normally an 'optnone' function goes through fast-isel, which does not
call DAGCombiner. But we ran into a case (on Windows) where the
calling convention causes argument lowering to bail out of fast-isel,
and we end up in CodeGenAndEmitDAG() which does run DAGCombiner.
So, we need to make DAGCombiner check for 'optnone' after all.

Commit includes the test that found this, plus another one that got
missed in the original optnone work.

llvm-svn: 221168

9 years agoIR: MDNode => Value: Instruction::getAllMetadataOtherThanDebugLoc()
Duncan P. N. Exon Smith [Mon, 3 Nov 2014 18:13:57 +0000 (18:13 +0000)]
IR: MDNode => Value: Instruction::getAllMetadataOtherThanDebugLoc()

Change `Instruction::getAllMetadataOtherThanDebugLoc()` from a vector of
`MDNode` to one of `Value`.  Part of PR21433.

llvm-svn: 221167

9 years agoRemove the cortex-a9-mp CPU.
Charlie Turner [Mon, 3 Nov 2014 17:38:00 +0000 (17:38 +0000)]
Remove the cortex-a9-mp CPU.

This CPU definition is redundant. The Cortex-A9 is defined as
supporting multiprocessing extensions. Remove its definition and
update appropriate tests.

LLVM defines both a cortex-a9 CPU and a cortex-a9-mp CPU. The only
difference between the two CPU definitions in ARM.td is that
cortex-a9-mp contains the feature FeatureMP for multiprocessing
extensions.

This is redundant since the Cortex-A9 is defined as having
multiprocessing extensions in the TRMs. armcc also defines the
Cortex-A9 as having multiprocessing extensions by default.

Change-Id: Ifcadaa6c322be0a33d9d2a39cfdd7da1d75981a7
llvm-svn: 221166

9 years agoFix warnings about missing override.
Rafael Espindola [Mon, 3 Nov 2014 17:14:46 +0000 (17:14 +0000)]
Fix warnings about missing override.

llvm-svn: 221165

9 years agoCleanup some unused or trivial functions in DwarfCompileUnit
David Blaikie [Mon, 3 Nov 2014 17:10:38 +0000 (17:10 +0000)]
Cleanup some unused or trivial functions in DwarfCompileUnit

llvm-svn: 221164

9 years agoThis patch reverts r220496 which issues warning on comparing
Fariborz Jahanian [Mon, 3 Nov 2014 17:03:07 +0000 (17:03 +0000)]
This patch reverts r220496 which issues warning on comparing
parameters with nonnull attribute when comparison is always
true/false. Patch causes false positive when parameter is
modified in the function.

llvm-svn: 221163

9 years agoEmit OpenCL local global variables without zeorinitializer
Matt Arsenault [Mon, 3 Nov 2014 16:51:53 +0000 (16:51 +0000)]
Emit OpenCL local global variables without zeorinitializer

Local variables are not initialized, and every target has
been (incorrectly) ignoring the unnecessary request for
zero initialization.

llvm-svn: 221162

9 years agoSink DwarfUnit::CURanges into DwarfCompileUnit
David Blaikie [Mon, 3 Nov 2014 16:40:43 +0000 (16:40 +0000)]
Sink DwarfUnit::CURanges into DwarfCompileUnit

llvm-svn: 221161

9 years agoDon't allow dllimport/export on classes with internal linkage (PR21399)
Hans Wennborg [Mon, 3 Nov 2014 16:09:16 +0000 (16:09 +0000)]
Don't allow dllimport/export on classes with internal linkage (PR21399)

Trying to import or export such classes doesn't make sense, and Clang
would assert trying to export vtables for them.

This is consistent with how we treat functions with internal linkage,
but it is stricter than MSVC so we may have to back down if it breaks
real code.

llvm-svn: 221160

9 years agoTemporary disable formatting error
Tobias Grosser [Mon, 3 Nov 2014 15:42:45 +0000 (15:42 +0000)]
Temporary disable formatting error

This should silence the buildbots until we understand if the clang-format
changes in r221125 have been intentional. See reply on cfe-commits for details.

llvm-svn: 221159

9 years agoRevert "clang-format: [Java] Allow trailing semicolons after enums."
Daniel Jasper [Mon, 3 Nov 2014 15:42:11 +0000 (15:42 +0000)]
Revert "clang-format: [Java] Allow trailing semicolons after enums."

This reverts commit b5bdb2ef59ab922bcb4d6e843fffaee1f7f68a8c.

This doesn't really seem necessary on second though and causes problems
with C++ enum formatting.

llvm-svn: 221158

9 years ago[AArch64] Fix miscompile of comparison with 0xffffffffffffffff
Oliver Stannard [Mon, 3 Nov 2014 15:28:40 +0000 (15:28 +0000)]
[AArch64] Fix miscompile of comparison with 0xffffffffffffffff

Some literals in the AArch64 backend had 15 'f's rather than 16, causing
comparisons with a constant 0xffffffffffffffff to be miscompiled.

llvm-svn: 221157

9 years agoHandle ctor/init_array initialization.
Sid Manning [Mon, 3 Nov 2014 14:56:05 +0000 (14:56 +0000)]
Handle ctor/init_array initialization.

Hexagon was not calling InitializeELF and could not select between
ctors and init_array.

Phabricator revision: http://reviews.llvm.org/D6061

llvm-svn: 221156

9 years agoMerge the directive-eabi_attribute.s and directive-eabi_attribute-2.s tests.
Charlie Turner [Mon, 3 Nov 2014 14:52:00 +0000 (14:52 +0000)]
Merge the directive-eabi_attribute.s and directive-eabi_attribute-2.s tests.

test/MC/ARM/directive-eabi_attribute.s had gotten out-of-sync with
test/MC/ARM/directive-eabi_attribute-2.s. The former tests the encoding of
build attributes in object files, and the latter the encoding in assembly
files. Since both these tests need to be updated at the same time, it makes
sense to combine them into a single test. The object file encodings are being
checked against the ouput of -arm-attributes rather than by direct byte
comparisons which makes for easier reading.

Change-Id: I0075de506ae5626fb2fa235383fe5ce6a65a15a9
llvm-svn: 221155

9 years agoDon't dllimport inline functions when targeting MinGW (PR21366)
Hans Wennborg [Mon, 3 Nov 2014 14:24:45 +0000 (14:24 +0000)]
Don't dllimport inline functions when targeting MinGW (PR21366)

It turns out that MinGW never dllimports of exports inline functions.
This means that code compiled with Clang would fail to link with
MinGW-compiled libraries since we might try to import functions that
are not imported.

To fix this, make Clang never dllimport inline functions when targeting
MinGW.

llvm-svn: 221154

9 years agoAdd CRLF support to LineIterator.
Rafael Espindola [Mon, 3 Nov 2014 14:09:47 +0000 (14:09 +0000)]
Add CRLF support to LineIterator.

The MRI scripts have to work with CRLF, and in general it is probably
a good idea to support this in a core utility like LineIterator.

llvm-svn: 221153

9 years ago[clang-tidy] Added -fix-errors option
Alexander Kornienko [Mon, 3 Nov 2014 14:06:31 +0000 (14:06 +0000)]
[clang-tidy] Added -fix-errors option

Summary:
Added -fix-errors option to allow applying fixes when compiler errors
are present. Without this flag -fix would bail out if there are compiler errors.
This is needed to avoid applying wrong fixes if Clang fails to recover from
compilation errors correctly.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: curdeius, cfe-commits

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

llvm-svn: 221152

9 years agoRevert r221150, as it broke sanitizer tests
Oliver Stannard [Mon, 3 Nov 2014 12:19:03 +0000 (12:19 +0000)]
Revert r221150, as it broke sanitizer tests

llvm-svn: 221151

9 years agoEmit .eh_frame with relocations to functions, rather than sections
Oliver Stannard [Mon, 3 Nov 2014 12:02:51 +0000 (12:02 +0000)]
Emit .eh_frame with relocations to functions, rather than sections

When LLVM emits DWARF call frame information, it currently creates a local,
section-relative symbol in the code section, which is pointed to by a
relocation on the .eh_frame section. However, for C++ we emit some functions in
section groups, and the SysV ABI has some rules to make it easier to remove
these sections
(http://www.sco.com/developers/gabi/latest/ch4.sheader.html#section_group_rules):

  A symbol table entry with STB_LOCAL binding that is defined relative to one
  of a group's sections, and that is contained in a symbol table section that is
  not part of the group, must be discarded if the group members are discarded.
  References to this symbol table entry from outside the group are not allowed.

This means that we need to use the function symbol for the relocation, not a
temporary symbol.

There was a comment in the code claiming that the local symbol was used to
avoid creating a relocation, but a relocation must be created anyway as the
code and CFI are in different sections.

llvm-svn: 221150

9 years ago[OCaml] Fix mismatched CAMLparam/CAMLreturn.
Peter Zotov [Mon, 3 Nov 2014 11:47:14 +0000 (11:47 +0000)]
[OCaml] Fix mismatched CAMLparam/CAMLreturn.

Also, revert r221142--it was an incorrect fix to this bug
which fixed tests by accident.

llvm-svn: 221149

9 years agoTest commit.
Charlie Turner [Mon, 3 Nov 2014 10:58:05 +0000 (10:58 +0000)]
Test commit.

Fixes two typos.

Change-Id: I129f647de8933e1d8f0dc9941bcb91602edce7e2
llvm-svn: 221148

9 years agoCMake: Add libm to list of system libs printed by llvm-config.
Peter Collingbourne [Mon, 3 Nov 2014 10:38:26 +0000 (10:38 +0000)]
CMake: Add libm to list of system libs printed by llvm-config.

This is required by the interpreter library, and also matches the autoconf
behavior.

llvm-svn: 221147

9 years ago[mips] Remove unused prototype and variable. NFC.
Daniel Sanders [Mon, 3 Nov 2014 10:14:57 +0000 (10:14 +0000)]
[mips] Remove unused prototype and variable. NFC.

llvm-svn: 221146

9 years ago[OCaml] Add -g on DEBUG_SYMBOLS=1, not ENABLE_OPTIMIZED.
Peter Zotov [Mon, 3 Nov 2014 10:06:19 +0000 (10:06 +0000)]
[OCaml] Add -g on DEBUG_SYMBOLS=1, not ENABLE_OPTIMIZED.

Thanks echristo for pointing this out.

llvm-svn: 221145

9 years agoUnbreak build.
Peter Zotov [Mon, 3 Nov 2014 09:58:41 +0000 (09:58 +0000)]
Unbreak build.

A bug in lit.cfg was introduced in r221137.

llvm-svn: 221144

9 years ago[OCaml] Don't use deprecated non-caml_namespaced functions.
Peter Zotov [Mon, 3 Nov 2014 09:51:47 +0000 (09:51 +0000)]
[OCaml] Don't use deprecated non-caml_namespaced functions.

llvm-svn: 221143

9 years ago[OCaml] Initialize local roots prior to raising.
Peter Zotov [Mon, 3 Nov 2014 09:51:44 +0000 (09:51 +0000)]
[OCaml] Initialize local roots prior to raising.

On 4.02, the OCaml unwinder otherwise gets confused and segfaults.

llvm-svn: 221142

9 years ago[OCaml] Core package should depend on LLVMTransformUtils for LLVMCloneModule.
Peter Zotov [Mon, 3 Nov 2014 09:51:41 +0000 (09:51 +0000)]
[OCaml] Core package should depend on LLVMTransformUtils for LLVMCloneModule.

llvm-svn: 221141

9 years ago[OCaml] Fix ocamlc -custom builds when configured as --enable-shared.
Peter Zotov [Mon, 3 Nov 2014 09:51:37 +0000 (09:51 +0000)]
[OCaml] Fix ocamlc -custom builds when configured as --enable-shared.

llvm-svn: 221140

9 years ago[OCaml] Avoid embedding absolute paths into executables.
Peter Zotov [Mon, 3 Nov 2014 09:51:34 +0000 (09:51 +0000)]
[OCaml] Avoid embedding absolute paths into executables.

Bindings built out-of-tree, e.g. via OPAM, should append
a line to META.llvm like the following:

linkopts = "-cclib -L$libdir -cclib -Wl,-rpath,$libdir"

where $libdir is the lib/ directory where LLVM libraries are
installed.

llvm-svn: 221139

9 years ago[OCaml] Don't build stub libraries twice.
Peter Zotov [Mon, 3 Nov 2014 09:51:28 +0000 (09:51 +0000)]
[OCaml] Don't build stub libraries twice.

The default Makefile.rules BUILD_ARCHIVE machinery was
unintentionally enabled.

llvm-svn: 221138

9 years ago[OCaml] Run tests twice, with ocamlc and ocamlopt (if available)
Peter Zotov [Mon, 3 Nov 2014 09:50:53 +0000 (09:50 +0000)]
[OCaml] Run tests twice, with ocamlc and ocamlopt (if available)

ocamlc and ocamlopt expose a distinct set of buildsystem bugs, e.g.
only ocamlc would detect -custom or -dllib-related bugs, and as all
buildbots will have ocamlopt, these bugs will stay hidden.

This change should add no more than 30 seconds of testing time.

llvm-svn: 221137

9 years ago[OCaml] META: remove exists_if(toplevel).
Peter Zotov [Mon, 3 Nov 2014 09:50:02 +0000 (09:50 +0000)]
[OCaml] META: remove exists_if(toplevel).

ocamlfind ignores the predicates in this case, making the package
unavailable for batch compilation as well.

llvm-svn: 221136

9 years ago[OCaml] ExecutionEngine package should not depend on interpreter.
Peter Zotov [Mon, 3 Nov 2014 09:49:42 +0000 (09:49 +0000)]
[OCaml] ExecutionEngine package should not depend on interpreter.

Interpreter support was removed in r220957.

llvm-svn: 221135

9 years agoForgot to add input file for test added in r221133
David Majnemer [Mon, 3 Nov 2014 07:58:16 +0000 (07:58 +0000)]
Forgot to add input file for test added in r221133

llvm-svn: 221134

9 years agollvm-vtabledump: Handle Itanium VTables
David Majnemer [Mon, 3 Nov 2014 07:23:25 +0000 (07:23 +0000)]
llvm-vtabledump: Handle Itanium VTables

Add support in the vtable dumper for the Itanium ABI.

llvm-svn: 221133

9 years ago[x86] Add cx16 feature to KNL, SKX, and CoreAVXi CPUs.
Craig Topper [Mon, 3 Nov 2014 07:05:28 +0000 (07:05 +0000)]
[x86] Add cx16 feature to KNL, SKX, and CoreAVXi CPUs.

llvm-svn: 221132

9 years ago[x86] Realphabetize the feature string decoding function since it was mostly in alpha...
Craig Topper [Mon, 3 Nov 2014 07:05:26 +0000 (07:05 +0000)]
[x86] Realphabetize the feature string decoding function since it was mostly in alphabetical order.

llvm-svn: 221131

9 years agoAdd FSGSBASE intrinsics to x86 intrinsic headers.
Craig Topper [Mon, 3 Nov 2014 06:51:41 +0000 (06:51 +0000)]
Add FSGSBASE intrinsics to x86 intrinsic headers.

llvm-svn: 221130

9 years agoInstCombine: Combine (X | Y) - X to (~X & Y)
David Majnemer [Mon, 3 Nov 2014 05:53:55 +0000 (05:53 +0000)]
InstCombine: Combine (X | Y) - X to (~X & Y)

This implements the transformation from (X | Y) - X to (~X & Y).

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

llvm-svn: 221129

9 years ago[LinkerScript] Change ErrorOr usage to fix MSVC2012 buildbots
Rafael Auler [Mon, 3 Nov 2014 05:26:18 +0000 (05:26 +0000)]
[LinkerScript] Change ErrorOr usage to fix MSVC2012 buildbots

Number parsing functions used an ErrorOr<> idiom that is not supported in
MSVC2012. This patch fixes this.

llvm-svn: 221128

9 years agoRemove definitions from Intrin.h that already exist in one of the other x86 intrinsic...
Craig Topper [Mon, 3 Nov 2014 04:19:58 +0000 (04:19 +0000)]
Remove definitions from Intrin.h that already exist in one of the other x86 intrinsic headers. Add a run line with Broadwell as the cpu type to ms-intrin.cpp test to catch some of these in the future.

llvm-svn: 221127

9 years ago[lld] Teach LLD how to parse most linker scripts
Rafael Auler [Mon, 3 Nov 2014 04:09:51 +0000 (04:09 +0000)]
[lld] Teach LLD how to parse most linker scripts

This patch does *not* implement any semantic actions, but it is a first step to
teach LLD how to read complete linker scripts. The additional linker scripts
statements whose parsing is now supported are:

* SEARCH_DIR directive
* SECTIONS directive
* Symbol definitions inside SECTIONS including PROVIDE and PROVIDE_HIDDEN
* C-like expressions used in many places in linker scripts
* Input to output sections mapping

The goal of this commit was guided towards completely parsing a default GNU ld
linker script and the linker script used to link the FreeBSD kernel. Thus, it
also adds a test case based on the default linker script used in GNU ld for
x86_64 ELF targets. I tested SPEC userland programs linked by GNU ld, using the
linker script dump'ed by this parser, and everything went fine. I then tested
linking the FreeBSD kernel with a dump'ed linker script, installed the new
kernel and booted it, everything went fine.

Directives that still need to be implemented:
* MEMORY
* PHDRS

Reviewers: silvas, shankarke and ruiu

http://reviews.llvm.org/D5852

llvm-svn: 221126

9 years agoclang-format: [Java] Allow trailing semicolons after enums.
Daniel Jasper [Mon, 3 Nov 2014 03:00:42 +0000 (03:00 +0000)]
clang-format: [Java] Allow trailing semicolons after enums.

Before:
  enum SomeThing { ABC, CDE }
  ;

After:
  enum SomeThing { ABC, CDE };

llvm-svn: 221125

9 years agoclang-format: [Java] Fix more generics formatting.
Daniel Jasper [Mon, 3 Nov 2014 02:45:58 +0000 (02:45 +0000)]
clang-format: [Java] Fix more generics formatting.

Before:
  < T extends B > T getInstance(Class<T> type);

After:
  <T extends B> T getInstance(Class<T> type);

llvm-svn: 221124

9 years agoSink range list handling down from DwarfUnit into its only use, in DwarfCompileUnit.
David Blaikie [Mon, 3 Nov 2014 02:41:49 +0000 (02:41 +0000)]
Sink range list handling down from DwarfUnit into its only use, in DwarfCompileUnit.

llvm-svn: 221123

9 years agoclang-format: [Java] Fix static generic methods.
Daniel Jasper [Mon, 3 Nov 2014 02:35:14 +0000 (02:35 +0000)]
clang-format: [Java] Fix static generic methods.

Before:
  public static<R> ArrayList<R> get() {}

After:
  public static <R> ArrayList<R> get() {}

llvm-svn: 221122

9 years agoclang-format: [Java] Fix class declaration formatting.
Daniel Jasper [Mon, 3 Nov 2014 02:27:28 +0000 (02:27 +0000)]
clang-format: [Java] Fix class declaration formatting.

Before:
  @SomeAnnotation()
  abstract
      class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb implements cccccccccccc {
  }

After:
  @SomeAnnotation()
  abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb
      implements cccccccccccc {
  }

llvm-svn: 221121

9 years agoUse ErrorOr for the ::create factory on instrumented and sample profilers.
Diego Novillo [Mon, 3 Nov 2014 00:51:45 +0000 (00:51 +0000)]
Use ErrorOr for the ::create factory on instrumented and sample profilers.

Summary:
As discussed in
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141027/242445.html,
the creation of reader and writer instances is better done using
ErrorOr. There are no functional changes, but several callers needed to
be adjusted.

Reviewers: bogner

Subscribers: llvm-commits

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

llvm-svn: 221120

9 years agoR600: Don't unnecessarily repeat the register class
Matt Arsenault [Sun, 2 Nov 2014 23:46:59 +0000 (23:46 +0000)]
R600: Don't unnecessarily repeat the register class

llvm-svn: 221119

9 years agoR600/SI: Use REG_SEQUENCE instead of INSERT_SUBREGs
Matt Arsenault [Sun, 2 Nov 2014 23:46:54 +0000 (23:46 +0000)]
R600/SI: Use REG_SEQUENCE instead of INSERT_SUBREGs

llvm-svn: 221118

9 years agoSupport REG_SEQUENCE in tablegen.
Matt Arsenault [Sun, 2 Nov 2014 23:46:51 +0000 (23:46 +0000)]
Support REG_SEQUENCE in tablegen.

The problem is mostly that variadic output instruction
aren't handled, so it is rejected for having an inconsistent
number of operands, and then the right number of operands
isn't emitted.

llvm-svn: 221117

9 years agoFix typo
Matt Arsenault [Sun, 2 Nov 2014 23:46:47 +0000 (23:46 +0000)]
Fix typo

llvm-svn: 221116

9 years agoFix missing C++ mode comment
Matt Arsenault [Sun, 2 Nov 2014 23:46:44 +0000 (23:46 +0000)]
Fix missing C++ mode comment

llvm-svn: 221115

9 years agoclang-format: Fix false positive in lambda detection.
Daniel Jasper [Sun, 2 Nov 2014 22:46:42 +0000 (22:46 +0000)]
clang-format: Fix false positive in lambda detection.

Before:
  delete [] a -> b;

After:
  delete[] a->b;

This fixes part of llvm.org/PR21419.

llvm-svn: 221114

9 years agoclang-format: [Java] Support enums without trailing semicolon.
Daniel Jasper [Sun, 2 Nov 2014 22:31:39 +0000 (22:31 +0000)]
clang-format: [Java] Support enums without trailing semicolon.

Before:
  class SomeClass {
    enum SomeThing { ABC, CDE } void f() {
    }
  }

After:
  class SomeClass {
    enum SomeThing { ABC, CDE }
    void f() {
    }
  }

This fixed llvm.org/PR21458.

llvm-svn: 221113

9 years agoclang-format: [Java] Don't break imports.
Daniel Jasper [Sun, 2 Nov 2014 22:13:03 +0000 (22:13 +0000)]
clang-format: [Java] Don't break imports.

This fixes llvm.org/PR21453.

llvm-svn: 221112

9 years agoFix the Makefile build by actually building ABI/SysV-ppc
Filipe Cabecinhas [Sun, 2 Nov 2014 22:03:15 +0000 (22:03 +0000)]
Fix the Makefile build by actually building ABI/SysV-ppc

llvm-svn: 221111

9 years agoclang-format: [Java] Add space between "synchronized" and "(".
Daniel Jasper [Sun, 2 Nov 2014 22:00:57 +0000 (22:00 +0000)]
clang-format: [Java] Add space between "synchronized" and "(".

Before:
  synchronized(mData) {
    // ...
  }

After:
  synchronized (mData) {
    // ...
  }

This fixes llvm.org/PR21455.

llvm-svn: 221110

9 years agoclang-format: [Java] Support generics with "?".
Daniel Jasper [Sun, 2 Nov 2014 21:52:57 +0000 (21:52 +0000)]
clang-format: [Java] Support generics with "?".

Before:
  @Override
  public Map < String,
          ? > getAll() {
    // ...
  }

After:
  @Override
  public Map<String, ?> getAll() {
    // ...
  }

This fixes llvm.org/PR21454.

llvm-svn: 221109

9 years agoclang-format: permit setting the path to clang in vimrc
Saleem Abdulrasool [Sun, 2 Nov 2014 21:27:59 +0000 (21:27 +0000)]
clang-format: permit setting the path to clang in vimrc

If g:clang_format_path is set in the vimrc, that path will take precedence over
the hard coded path (which is reliant on the PATH environment variable).  This
provides an easy mechanism for switching the selected clang-format binary during
development.

llvm-svn: 221108

9 years agodocs: remove double carriage-return
Saleem Abdulrasool [Sun, 2 Nov 2014 21:27:52 +0000 (21:27 +0000)]
docs: remove double carriage-return

The double carriage return would silence a warning due to a missing
.clang-format.  Permit the error to bubble through.

llvm-svn: 221107

9 years agoclang-format: [Java] Support try/catch/finally blocks.
Daniel Jasper [Sun, 2 Nov 2014 19:21:48 +0000 (19:21 +0000)]
clang-format: [Java] Support try/catch/finally blocks.

llvm-svn: 221104

9 years agoclang-format: [Java] Don't break after extends/implements.
Daniel Jasper [Sun, 2 Nov 2014 19:16:41 +0000 (19:16 +0000)]
clang-format: [Java] Don't break after extends/implements.

Before:
  abstract class SomeClass extends SomeOtherClass implements
      SomeInterface {}

After:
  abstract class SomeClass extends SomeOtherClass
      implements SomeInterface {}

llvm-svn: 221103

9 years agoRe-commit r221056 and others with fix, "[mips] Move F128 argument handling into MipsC...
Daniel Sanders [Sun, 2 Nov 2014 16:09:29 +0000 (16:09 +0000)]
Re-commit r221056 and others with fix, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."

sret arguments can never originate from an f128 argument so we detect
sret arguments and push false into OriginalArgWasF128.

llvm-svn: 221102

9 years agoMark string_view::to_string as const. Fixes PR21428
Marshall Clow [Sun, 2 Nov 2014 15:35:32 +0000 (15:35 +0000)]
Mark string_view::to_string as const. Fixes PR21428

llvm-svn: 221101

9 years ago[PowerPC] Change PPCTargetInfo::hasFeature() to use StringSwitch
Bill Schmidt [Sun, 2 Nov 2014 14:56:41 +0000 (14:56 +0000)]
[PowerPC] Change PPCTargetInfo::hasFeature() to use StringSwitch

Implement post-commit comment on r220989 from Eric Christopher.

llvm-svn: 221099

9 years agoRevert r221096 bringing back r221014 with a fix.
Rafael Espindola [Sun, 2 Nov 2014 13:28:57 +0000 (13:28 +0000)]
Revert r221096 bringing back r221014 with a fix.

The issue was that linkAppendingVarProto does the full linking job, including
deleting the old dst variable. The fix is just to call it and return early
if we have a GV with appending linkage.

original message:

    Refactor duplicated code in liking GlobalValues.

    There is quiet a bit of logic that is common to any GlobalValue but was
    duplicated for Functions, GlobalVariables and GlobalAliases.

    While at it, merge visibility even when comdats are used, fixing pr21415.

llvm-svn: 221098

9 years ago[cmake] Pass -O3 when linking.
Rafael Espindola [Sun, 2 Nov 2014 12:14:22 +0000 (12:14 +0000)]
[cmake] Pass -O3 when linking.

Gold and bfd ld enable misc optimizations. lld ignores the option for now.

llvm-svn: 221097

9 years agoRevert r221014: "Refactor duplicated code in liking GlobalValues."
Chandler Carruth [Sun, 2 Nov 2014 09:10:31 +0000 (09:10 +0000)]
Revert r221014: "Refactor duplicated code in liking GlobalValues."

This commit introduces heap-use-after-free detected by ASan. Here is the output
for one of several tests that detect it:

******************** TEST 'LLVM :: Linker/AppendingLinkage.ll' FAILED ********************
Command Output (stderr):
--
=================================================================
==2122==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c00000b9c8 at pc 0x0000005d05d1 bp 0x7fff64ed27c0 sp 0x7fff64ed27b8
READ of size 4 at 0x60c00000b9c8 thread T0
    #0 0x5d05d0 in llvm::GlobalValue::setUnnamedAddr(bool) /usr/local/google/home/chandlerc/src/llvm/build/../include/llvm/IR/GlobalValue.h:115:35
    #1 0x69fff1 in (anonymous namespace)::ModuleLinker::linkGlobalValueProto(llvm::GlobalValue*) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1041:5
    #2 0x697229 in (anonymous namespace)::ModuleLinker::run() /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1485:9
    #3 0x696542 in llvm::Linker::linkInModule(llvm::Module*) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1621:10
    #4 0x4a2db7 in main /usr/local/google/home/chandlerc/src/llvm/build/../tools/llvm-link/llvm-link.cpp:116:9
    #5 0x7f4ae61e5ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
    #6 0x41eb71 in _start (/usr/local/google/home/chandlerc/src/llvm/build/bin/llvm-link+0x41eb71)

0x60c00000b9c8 is located 72 bytes inside of 128-byte region [0x60c00000b980,0x60c00000ba00)
freed by thread T0 here:
    #0 0x4a1e6b in operator delete(void*) /usr/local/google/home/chandlerc/src/llvm/opt-build/../projects/compiler-rt/lib/asan/asan_new_delete.cc:94:3
    #1 0x5d1a7a in llvm::iplist<llvm::GlobalVariable, llvm::ilist_traits<llvm::GlobalVariable> >::erase(llvm::ilist_iterator<llvm::GlobalVariable>) /usr/local/google/home/chandlerc/src/llvm/build/../inclu
de/llvm/ADT/ilist.h:466:5
    #2 0x5d1980 in llvm::GlobalVariable::eraseFromParent() /usr/local/google/home/chandlerc/src/llvm/build/../lib/IR/Globals.cpp:204:3
    #3 0x6a8a4d in (anonymous namespace)::ModuleLinker::linkAppendingVarProto(llvm::GlobalVariable*, llvm::GlobalVariable const*) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.
cpp:980:3
    #4 0x6a7403 in (anonymous namespace)::ModuleLinker::linkGlobalVariableProto(llvm::GlobalVariable const*, llvm::GlobalValue*, bool) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkMod
ules.cpp:1074:11
    #5 0x69ff4e in (anonymous namespace)::ModuleLinker::linkGlobalValueProto(llvm::GlobalValue*) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1028:13
    #6 0x697229 in (anonymous namespace)::ModuleLinker::run() /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1485:9
    #7 0x696542 in llvm::Linker::linkInModule(llvm::Module*) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1621:10
    #8 0x4a2db7 in main /usr/local/google/home/chandlerc/src/llvm/build/../tools/llvm-link/llvm-link.cpp:116:9
    #9 0x7f4ae61e5ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287

previously allocated by thread T0 here:
    #0 0x4a192b in operator new(unsigned long) /usr/local/google/home/chandlerc/src/llvm/opt-build/../projects/compiler-rt/lib/asan/asan_new_delete.cc:62:35
    #1 0x61d85c in llvm::User::operator new(unsigned long, unsigned int) /usr/local/google/home/chandlerc/src/llvm/build/../lib/IR/User.cpp:57:19
    #2 0x6a7525 in (anonymous namespace)::ModuleLinker::linkGlobalVariableProto(llvm::GlobalVariable const*, llvm::GlobalValue*, bool) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkMod
ules.cpp:1100:3
    #3 0x69ff4e in (anonymous namespace)::ModuleLinker::linkGlobalValueProto(llvm::GlobalValue*) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1028:13
    #4 0x697229 in (anonymous namespace)::ModuleLinker::run() /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1485:9
    #5 0x696542 in llvm::Linker::linkInModule(llvm::Module*) /usr/local/google/home/chandlerc/src/llvm/build/../lib/Linker/LinkModules.cpp:1621:10
    #6 0x4a2db7 in main /usr/local/google/home/chandlerc/src/llvm/build/../tools/llvm-link/llvm-link.cpp:116:9
    #7 0x7f4ae61e5ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287

SUMMARY: AddressSanitizer: heap-use-after-free /usr/local/google/home/chandlerc/src/llvm/build/../include/llvm/IR/GlobalValue.h:115 llvm::GlobalValue::setUnnamedAddr(bool)
Shadow bytes around the buggy address:
  0x0c187fff96e0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c187fff96f0: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa
  0x0c187fff9700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
  0x0c187fff9710: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c187fff9720: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
=>0x0c187fff9730: fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd
  0x0c187fff9740: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c187fff9750: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c187fff9760: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c187fff9770: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c187fff9780: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  ASan internal:           fe
==2122==ABORTING

llvm-svn: 221096

9 years agoFormatting
David Blaikie [Sun, 2 Nov 2014 08:52:37 +0000 (08:52 +0000)]
Formatting

llvm-svn: 221095

9 years agoAdd DwarfUnit::isDwoUnit and use it to generalize string creation
David Blaikie [Sun, 2 Nov 2014 08:51:37 +0000 (08:51 +0000)]
Add DwarfUnit::isDwoUnit and use it to generalize string creation

Currently we only need to emit skeleton strings into the CU header and
we do this by explicitly calling "addLocalString". With gmlt-in-fission,
we'll be emitting a bunch of other strings from other codepaths where
it's not statically known that these strings will be local or not.

Introduce a virtual function to indicate whether this unit is a DWO unit
or not (I'm not sure if we have a good term for this, the
opposite/alternative to 'skeleton' unit) and use that to generalize the
string emission logic so that strings can be correctly emitted in both
the skeleton and dwo unit when in split dwarf mode.

And to demonstrate that this works, switch the existing special callers
of addLocalString in the skeleton builder to addString - and they still
work. Yay.

llvm-svn: 221094

9 years agoRemove the last mention of LineTablesOnly from DwarfUnit, sinking it into DwarfCompil...
David Blaikie [Sun, 2 Nov 2014 08:18:06 +0000 (08:18 +0000)]
Remove the last mention of LineTablesOnly from DwarfUnit, sinking it into DwarfCompileUnit

This is a useful distinction/invariant/delination to make because
LineTablesOnly mode is never relevant to type units, so it's clear that
we're not doing weird line-tables-only-with-types by making this API
choice.

It also lays the foundations nicely for adding gmlt-like data to fission
skeleton CUs while limiting the effects to CUs and not TUs.

llvm-svn: 221093

9 years agoSink DwarfUnit::applySubprogramAttributesToDefinition into DwarfCompileUnit
David Blaikie [Sun, 2 Nov 2014 08:09:09 +0000 (08:09 +0000)]
Sink DwarfUnit::applySubprogramAttributesToDefinition into DwarfCompileUnit

llvm-svn: 221092

9 years agoUse Alias Analysis to hoist 2 loads from diamond to the common predecessor basic...
Elena Demikhovsky [Sun, 2 Nov 2014 08:03:05 +0000 (08:03 +0000)]
Use Alias Analysis to hoist 2 loads from diamond to the common predecessor basic block.
Alias Analysis allows to detect real barriers for load hoisting.

Review in http://reviews.llvm.org/D5991

llvm-svn: 221091

9 years agoSink DwarfUnit::addExpr into DwarfCompileUnit
David Blaikie [Sun, 2 Nov 2014 07:11:55 +0000 (07:11 +0000)]
Sink DwarfUnit::addExpr into DwarfCompileUnit

llvm-svn: 221090

9 years agoFix the build from the last commit
David Blaikie [Sun, 2 Nov 2014 07:08:12 +0000 (07:08 +0000)]
Fix the build from the last commit

llvm-svn: 221089

9 years agoSink DwarfUnit::applyVariableAttributes into DwarfCompileUnit
David Blaikie [Sun, 2 Nov 2014 07:06:51 +0000 (07:06 +0000)]
Sink DwarfUnit::applyVariableAttributes into DwarfCompileUnit

llvm-svn: 221088

9 years agoSink DwarfUnit::addLocationList down into DwarfCompileUnit
David Blaikie [Sun, 2 Nov 2014 07:03:19 +0000 (07:03 +0000)]
Sink DwarfUnit::addLocationList down into DwarfCompileUnit

llvm-svn: 221087

9 years agoSink DwarfUnit::addComplexAddress down into DwarfCompileUnit
David Blaikie [Sun, 2 Nov 2014 06:58:44 +0000 (06:58 +0000)]
Sink DwarfUnit::addComplexAddress down into DwarfCompileUnit

llvm-svn: 221086

9 years agoPush DwarfUnit::addAddress down into DwarfCompileUnit
David Blaikie [Sun, 2 Nov 2014 06:46:40 +0000 (06:46 +0000)]
Push DwarfUnit::addAddress down into DwarfCompileUnit

llvm-svn: 221085

9 years agoSink DwarfUnit::addVariableAddress into DwarfCompileUnit since type units don't have...
David Blaikie [Sun, 2 Nov 2014 06:37:23 +0000 (06:37 +0000)]
Sink DwarfUnit::addVariableAddress into DwarfCompileUnit since type units don't have variables

llvm-svn: 221084

9 years agoDebugInfo: Sink accelerator table lists down (GlobalNames/Types) into DwarfCompileUnit
David Blaikie [Sun, 2 Nov 2014 06:16:39 +0000 (06:16 +0000)]
DebugInfo: Sink accelerator table lists down (GlobalNames/Types) into DwarfCompileUnit

llvm-svn: 221083

9 years agoAdd DwarfUnit::addGlobalType to match DwarfUnit::addGlobalName
David Blaikie [Sun, 2 Nov 2014 06:06:14 +0000 (06:06 +0000)]
Add DwarfUnit::addGlobalType to match DwarfUnit::addGlobalName

(these will shortly become virtual, with a null implementation in
DwarfUnit (since type units don't have accelerator tables in the current
schema) and the current implementation down in DwarfCompileUnit, moving
the actual maps there too)

llvm-svn: 221082

9 years agoRevert r221056 and others, "[mips] Move F128 argument handling into MipsCCState as...
NAKAMURA Takumi [Sun, 2 Nov 2014 04:43:54 +0000 (04:43 +0000)]
Revert r221056 and others, "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."

  r221056 "[mips] Move F128 argument handling into MipsCCState as we did for returns. NFC."
  r221058 "[mips] Fix unused variable warning introduced in r221056"
  r221059 "[mips] Move all ByVal handling into CCState and tablegen-erated code. NFC."
  r221061 "Renamed CCState members that appear to misspell 'Processed' as 'Proceed'. NFC."

It cuased an undefined behavior in LLVM :: CodeGen/Mips/return-vector.ll.

llvm-svn: 221081

9 years agoDebugInfo: Refactor index type DIE initialization by rolling it into the accessor
David Blaikie [Sun, 2 Nov 2014 03:09:13 +0000 (03:09 +0000)]
DebugInfo: Refactor index type DIE initialization by rolling it into the accessor

llvm-svn: 221080

9 years agoBe sure to initialize DwarfCompileUnit::LabelBegin now that it may be skipped in...
David Blaikie [Sun, 2 Nov 2014 02:40:26 +0000 (02:40 +0000)]
Be sure to initialize DwarfCompileUnit::LabelBegin now that it may be skipped in initSection

llvm-svn: 221079

9 years agoDon't bother creating LabelBegin for .dwo units
David Blaikie [Sun, 2 Nov 2014 02:26:24 +0000 (02:26 +0000)]
Don't bother creating LabelBegin for .dwo units

This would help catch cases where we might otherwise try to reference a
dwo CU label, which would be weird - because without relocations in the
dwo file it's not generally meaningful to talk about the CU offsets
there (or, if it is, we can do so in absolute terms without using a
relocation to compute it).

llvm-svn: 221078

9 years agoDocs: update va_arg example with valid x86_64 va_list type.
Tim Northover [Sun, 2 Nov 2014 01:21:51 +0000 (01:21 +0000)]
Docs: update va_arg example with valid x86_64 va_list type.

The given example was overflowing its alloca and segfaulting if actually run on
x86, so it's a good idea to provide something that works there too.

Patch by Ramkumar Ramachandra.

llvm-svn: 221077

9 years agoDrop DwarfCompileUnit::getLocalLabel* in favor of just mapping through the skeleton...
David Blaikie [Sun, 2 Nov 2014 01:21:43 +0000 (01:21 +0000)]
Drop DwarfCompileUnit::getLocalLabel* in favor of just mapping through the skeleton explicitly.

Confusing to do this two different ways - I'm not too wedded to either
one, but here goes.

llvm-svn: 221076

9 years agoSink DwarfUnit::LabelBegin down into DwarfCompileUnit since that's the only place...
David Blaikie [Sun, 2 Nov 2014 01:21:40 +0000 (01:21 +0000)]
Sink DwarfUnit::LabelBegin down into DwarfCompileUnit since that's the only place it's needed.

llvm-svn: 221075

9 years agoUpdate test to use llvm-readobj. NFC.
Rafael Espindola [Sun, 2 Nov 2014 01:12:02 +0000 (01:12 +0000)]
Update test to use llvm-readobj. NFC.

llvm-svn: 221074

9 years agoUpdate for LLVM API change in r221024
Ed Maste [Sun, 2 Nov 2014 00:24:22 +0000 (00:24 +0000)]
Update for LLVM API change in r221024

llvm-svn: 221073

9 years agoSink dwarf unit length emission down into DwarfUnit::emitHeader
David Blaikie [Sat, 1 Nov 2014 23:59:23 +0000 (23:59 +0000)]
Sink dwarf unit length emission down into DwarfUnit::emitHeader

This allows the CU label to be emitted only for compile units, as
they're the only ones that need it (so they can be referenced from
pubnames)

llvm-svn: 221072

9 years agoTest 221067 in a fixed-target test so as not to fail on targets with different DWARF...
David Blaikie [Sat, 1 Nov 2014 23:50:59 +0000 (23:50 +0000)]
Test 221067 in a fixed-target test so as not to fail on targets with different DWARF encodings

llvm-svn: 221071

9 years agoFix the build of the gold plugin.
Rafael Espindola [Sat, 1 Nov 2014 23:49:44 +0000 (23:49 +0000)]
Fix the build of the gold plugin.

I did the previous patch on OS X and didn't noticed the issue.

llvm-svn: 221070

9 years agoInstCombine: Don't assume that m_ZExt matches an Instruction
David Majnemer [Sat, 1 Nov 2014 23:46:05 +0000 (23:46 +0000)]
InstCombine: Don't assume that m_ZExt matches an Instruction

m_ZExt might bind against a ConstantExpr instead of an Instruction.
Assuming this, using cast<Instruction>, results in InstCombine crashing.

Instead, introduce ZExtOperator to bridge both Instruction and
ConstantExpr ZExts.

This fixes PR21445.

llvm-svn: 221069

9 years agoRemove test coverage added in 221067 due to it being non-portable.
David Blaikie [Sat, 1 Nov 2014 23:42:30 +0000 (23:42 +0000)]
Remove test coverage added in 221067 due to it being non-portable.

Will try to find a portable way to test this (or a fixed-target test I
can add such coverage to) shortly.

llvm-svn: 221068

9 years agoRemove DwarfUnit::LabelEnd in favor of computing the length of the section directly
David Blaikie [Sat, 1 Nov 2014 23:07:14 +0000 (23:07 +0000)]
Remove DwarfUnit::LabelEnd in favor of computing the length of the section directly

This was a compile-unit specific label (unused in type units) and seems
unnecessary anyway when we can more easily directly compute the size of
the compile unit.

llvm-svn: 221067

9 years agoAdd _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match Intel documentation names...
Craig Topper [Sat, 1 Nov 2014 22:50:57 +0000 (22:50 +0000)]
Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match Intel documentation names for these intrinsics.

llvm-svn: 221066