platform/upstream/llvm.git
10 years agoAdd -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings
Richard Trieu [Fri, 6 Jun 2014 21:39:26 +0000 (21:39 +0000)]
Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings
to detect underfined behavior involving pointers.

llvm-svn: 210372

10 years agoX86: Don't turn shifts into ands if there's another use that may not check for equality.
Benjamin Kramer [Fri, 6 Jun 2014 21:08:55 +0000 (21:08 +0000)]
X86: Don't turn shifts into ands if there's another use that may not check for equality.

Fixes PR19964.

llvm-svn: 210371

10 years ago[TSan] Make lit-tests more self-contained
Alexey Samsonov [Fri, 6 Jun 2014 21:04:55 +0000 (21:04 +0000)]
[TSan] Make lit-tests more self-contained

llvm-svn: 210370

10 years agoFix DOS-style newlines.
Eli Bendersky [Fri, 6 Jun 2014 20:31:48 +0000 (20:31 +0000)]
Fix DOS-style newlines.

A previous patch r210330 (and possibly another) introduced DOS-style newlines
into a UNIX newline formatted file.

Patch by Mark Heffernan (http://reviews.llvm.org/D4046)

llvm-svn: 210369

10 years agoMS ABI: Update the thunk linkage computation
Hans Wennborg [Fri, 6 Jun 2014 20:04:01 +0000 (20:04 +0000)]
MS ABI: Update the thunk linkage computation

As suggested by Reid:

 - class has GVA_Internal linkage -> internal
 - thunk has return adjustment -> weak_odr, to handle evil corner case [1]
 - all other normal methods -> linkonce_odr

 1. Evil corner case:

  struct Incomplete;
  struct A { int a; virtual A *bar(); };
  struct B { int b; virtual B *foo(Incomplete); };
  struct C : A, B { int c; virtual C *foo(Incomplete); };
  C c;

Here, the thunk for C::foo() will be emitted when C::foo() is defined, which
might be in a different translation unit, so it needs to be weak_odr.

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

llvm-svn: 210368

10 years agoFix a few issues with comdat handling on COFF.
Rafael Espindola [Fri, 6 Jun 2014 19:26:12 +0000 (19:26 +0000)]
Fix a few issues with comdat handling on COFF.

* Section association cannot use just the section name as many
sections can have the same name. With this patch, the comdat symbol in
an assoc section is interpreted to mean a symbol in the associated
section and the mapping is discovered from it.

* Comdat symbols were not being set correctly. Instead we were getting
whatever was output first for that section.

A consequence is that associative sections now must use .section to
set the association. Using .linkonce would not work since it is not
possible to change a sections comdat symbol (it is used to decide if
we should create a new section or reuse an existing one).

This includes r210298, which was reverted because it was asserting
on an associated section having the same comdat as the associated
section.

llvm-svn: 210367

10 years agoHave TargetSelectionDAGInfo take a DataLayout initializer rather than
Eric Christopher [Fri, 6 Jun 2014 19:04:48 +0000 (19:04 +0000)]
Have TargetSelectionDAGInfo take a DataLayout initializer rather than
a TargetMachine since the only thing it wants is DataLayout.

llvm-svn: 210366

10 years agotsan: fix argument passing in Go interface
Dmitry Vyukov [Fri, 6 Jun 2014 18:53:52 +0000 (18:53 +0000)]
tsan: fix argument passing in Go interface
Go calling convention does not support bools (it probably works, but uptrs are safer)

llvm-svn: 210365

10 years agoMatch the full hex offsets in test/DebugInfo/X86/gnu-public-names.ll
David Blaikie [Fri, 6 Jun 2014 18:45:14 +0000 (18:45 +0000)]
Match the full hex offsets in test/DebugInfo/X86/gnu-public-names.ll

These checks were accidentally skipping the 0x prefix in the hex
offsets, then cunningly ignoring the prefix in the use of those captured
values.

Except in the case of the unit length, where the match was only matching
the leading '0' before the x in the 0x prefix, then matching that
against the length. We can't actually express the length association
here, as the length field in the Compile Unit header does not include
the length field itself, but the length field in the pubnames section
/does/ include the size of the length field in the Compile Unit header -
so the two numbers are actually 4 bytes different. Just skip matching
that.

llvm-svn: 210364

10 years agoFix a typo made in Programmer's Manual made in r210354. Spotted
Dan Liew [Fri, 6 Jun 2014 18:44:21 +0000 (18:44 +0000)]
Fix a typo made in Programmer's Manual made in r210354. Spotted
by Paul Robinson.

llvm-svn: 210363

10 years agoRemove DWARF3 testing of test/DebugInfo/X86/gnu-public-names.ll
David Blaikie [Fri, 6 Jun 2014 18:22:04 +0000 (18:22 +0000)]
Remove DWARF3 testing of test/DebugInfo/X86/gnu-public-names.ll

This was added to test that DW_AT_GNU_pubnames used sec_offset in DWARF4
and data4 in DWARF3 and below. Since then we've updated
DW_AT_GNU_pubnames to be a flag, rather than a section offset anyway.

Granted this still differs between DWARF 3 and DWARF 4
(FORM_flag_present versun FORM_flag) but it doesn't seem worthwhile
testing that codepath again here. It's covered adequately in many other
test cases.

And while I'm here, don't hardcode the byte size of the compile unit -
it's not relevant to this test and just makes it brittle if/when
anything changes in the way this CU is emitted.

llvm-svn: 210362

10 years agoFixed a bug in lowering shuffle_vectors to insertps
Filipe Cabecinhas [Fri, 6 Jun 2014 18:07:06 +0000 (18:07 +0000)]
Fixed a bug in lowering shuffle_vectors to insertps

Summary:
We were being too strict and not accounting for undefs.
Added a test case and fixed another one where we improved codegen.

Reviewers: grosbach, nadav, delena

Subscribers: llvm-commits

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

llvm-svn: 210361

10 years agoUn-xfail passing ARM Android tests
Greg Fitzgerald [Fri, 6 Jun 2014 18:06:58 +0000 (18:06 +0000)]
Un-xfail passing ARM Android tests

llvm-svn: 210360

10 years agotsan: fix CurrentStackId
Dmitry Vyukov [Fri, 6 Jun 2014 18:05:12 +0000 (18:05 +0000)]
tsan: fix CurrentStackId
FuncEnter adds FuncEnter entry to trace that nobody removes later

llvm-svn: 210359

10 years agotsan: fix mutex in Go mode
Dmitry Vyukov [Fri, 6 Jun 2014 18:04:05 +0000 (18:04 +0000)]
tsan: fix mutex in Go mode
In Go it's legal to unlock from a different goroutine.

llvm-svn: 210358

10 years agotest/SemaCXX/undefined-internal.cpp: Remove target triple.
Hans Wennborg [Fri, 6 Jun 2014 17:51:25 +0000 (17:51 +0000)]
test/SemaCXX/undefined-internal.cpp: Remove target triple.

This test seems to run fine in both MS and Itanium C++ ABI mode these days.

llvm-svn: 210357

10 years agoDefer codegen of inline method definitions to the end of current top level declaration
Hans Wennborg [Fri, 6 Jun 2014 17:36:17 +0000 (17:36 +0000)]
Defer codegen of inline method definitions to the end of current top level declaration

We would previously fail to emit a definition of bar() for the following code:

  struct __declspec(dllexport) S {
    void foo() {
      t->bar();
    }
    struct T {
      void bar() {}
    };
    T *t;
  };

Note that foo() is an exported method, but bar() is not. However, foo() refers
to bar() so we need to emit its definition. We would previously fail to
realise that bar() is used.

By deferring the method definitions until the end of the top level declaration,
we can simply call EmitTopLevelDecl on them and rely on the usual mechanisms
to decide whether the method should be emitted or not.

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

llvm-svn: 210356

10 years agoRetain an expression pack expansion when the parameter pack expansion code asks
Richard Smith [Fri, 6 Jun 2014 17:33:35 +0000 (17:33 +0000)]
Retain an expression pack expansion when the parameter pack expansion code asks
us to.

llvm-svn: 210355

10 years agoMention the IRBuilder in Programmer's Manual with a few small examples.
Dan Liew [Fri, 6 Jun 2014 17:25:47 +0000 (17:25 +0000)]
Mention the IRBuilder in Programmer's Manual with a few small examples.

llvm-svn: 210354

10 years agotsan: disable reporting of mutex misuses in Go
Dmitry Vyukov [Fri, 6 Jun 2014 17:23:27 +0000 (17:23 +0000)]
tsan: disable reporting of mutex misuses in Go

llvm-svn: 210353

10 years agotsan: minor optimizations for Go runtime
Dmitry Vyukov [Fri, 6 Jun 2014 16:06:19 +0000 (16:06 +0000)]
tsan: minor optimizations for Go runtime

llvm-svn: 210351

10 years agoPR14841: If partial substitution of explicitly-specified template arguments
Richard Smith [Fri, 6 Jun 2014 16:00:50 +0000 (16:00 +0000)]
PR14841: If partial substitution of explicitly-specified template arguments
results in a template having too many arguments, but all the trailing arguments
are packs, that's OK if we have a partial pack substitution: the trailing pack
expansions may end up empty.

llvm-svn: 210350

10 years agotsan: fix out-of-bounds access in Go runtime
Dmitry Vyukov [Fri, 6 Jun 2014 15:56:08 +0000 (15:56 +0000)]
tsan: fix out-of-bounds access in Go runtime
FuncEntry can resize the shadow stack, while "thr->shadow_stack_pos[0] = pc" writes out-of-bounds.

llvm-svn: 210349

10 years agotsan: fix mapping of meta shadow for Go
Dmitry Vyukov [Fri, 6 Jun 2014 15:54:49 +0000 (15:54 +0000)]
tsan: fix mapping of meta shadow for Go
Go maps heap and data+bss, these regions are not adjacent.
data+bss is mapped first.

llvm-svn: 210348

10 years agotsan: flush metamap per-thread cache when thread finishes
Dmitry Vyukov [Fri, 6 Jun 2014 15:52:10 +0000 (15:52 +0000)]
tsan: flush metamap per-thread cache when thread finishes

llvm-svn: 210347

10 years agotsan: fix clang warning:
Dmitry Vyukov [Fri, 6 Jun 2014 15:51:20 +0000 (15:51 +0000)]
tsan: fix clang warning:
comparison of unsigned expression >= 0 is always true

llvm-svn: 210346

10 years agotsan: fix Go build with TSAN_COLLECT_STATS
Dmitry Vyukov [Fri, 6 Jun 2014 15:50:29 +0000 (15:50 +0000)]
tsan: fix Go build with TSAN_COLLECT_STATS
Go does not have cur_thread function.

llvm-svn: 210345

10 years agotsan: allow to build Go runtime with clang + enable SSE3
Dmitry Vyukov [Fri, 6 Jun 2014 15:49:49 +0000 (15:49 +0000)]
tsan: allow to build Go runtime with clang + enable SSE3

llvm-svn: 210344

10 years agoFix typo in a test from r210342.
Michael Zolotukhin [Fri, 6 Jun 2014 15:49:47 +0000 (15:49 +0000)]
Fix typo in a test from r210342.

llvm-svn: 210343

10 years ago[SLP] Enable vectorization of GEP expressions.
Michael Zolotukhin [Fri, 6 Jun 2014 15:34:24 +0000 (15:34 +0000)]
[SLP] Enable vectorization of GEP expressions.

The use cases look like the following:
    x->a = y->a + 10
    x->b = y->b + 12

llvm-svn: 210342

10 years ago[PPC64LE] Implement little-endian semantics for vec_pack family
Bill Schmidt [Fri, 6 Jun 2014 15:10:47 +0000 (15:10 +0000)]
[PPC64LE] Implement little-endian semantics for vec_pack family

The PowerPC vector-pack instructions are defined architecturally with
a big-endian bias, in that the vector element numbering is assumed to
be "left to right" regardless of whether the processor is in
big-endian or little-endian mode.  This definition is unnatural for
little-endian code generation.

To facilitate ease of porting, the vec_pack and related interfaces are
designed to use natural element ordering, so that elements are
numbered according to little-endian design principles when code is
generated for a little-endian target.  The vec_pack calls are
implemented as calls to vec_perm, specifying selection of the
odd-numbered vector elements.  For little endian, this means the
odd-numbered elements counting from the right end of the register.
Since the underlying instructions count from the left end, we must
instead select the even-numbered vector elements for little endian to
achieve the desired semantics.

The correctness of this code is tested by the new pack.c test added in
a previous patch.  I plan to later make the existing ppc32 Altivec
compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210340

10 years agoFix RecursiveASTVisitor to visit types in ObjCPropertyDecl
Alp Toker [Fri, 6 Jun 2014 15:05:09 +0000 (15:05 +0000)]
Fix RecursiveASTVisitor to visit types in ObjCPropertyDecl

Patch by Mathieu Baudet!

llvm-svn: 210339

10 years agoReplacing r210333 with an improved solution; we should never reach this code with...
Aaron Ballman [Fri, 6 Jun 2014 15:01:47 +0000 (15:01 +0000)]
Replacing r210333 with an improved solution; we should never reach this code with any other loop hint options.

llvm-svn: 210338

10 years ago[PPC64LE] Implement little-endian semantics for vec_mul[eo]
Bill Schmidt [Fri, 6 Jun 2014 14:45:06 +0000 (14:45 +0000)]
[PPC64LE] Implement little-endian semantics for vec_mul[eo]

The PowerPC vector-multiply-even and vector-multiply-odd instructions
are defined architecturally with a big-endian bias, in that the vector
element numbering is assumed to be "left to right" regardless of
whether the processor is in big-endian or little-endian mode.  This
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_mule and vec_mulo interfacs are
designed to use natural element ordering, so that elements are
numbered according to little-endian design principles when code is
generated for a little-endian target.  The desired semantics can be
achieved by using the opposite instruction for little-endian mode.
That is, when a call to vec_mule appears in the code, a
vector-multiply-odd is generated, and when a call to vec_mulo appears
in the code, a vector-multiply-even is generated.

The correctness of this code is tested by the new mult-even-odd.c test
added in a previous patch.  I plan to later make the existing ppc32
Altivec compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210337

10 years ago[PPC64LE] Fix lowering of BUILD_VECTOR and SHUFFLE_VECTOR for little endian
Bill Schmidt [Fri, 6 Jun 2014 14:06:26 +0000 (14:06 +0000)]
[PPC64LE] Fix lowering of BUILD_VECTOR and SHUFFLE_VECTOR for little endian

This patch fixes a couple of lowering issues for little endian
PowerPC.  The code for lowering BUILD_VECTOR contains a number of
optimizations that are only valid for big endian.  For now, we disable
those optimizations for correctness.  In the future, we will add
analogous optimizations that are correct for little endian.

When lowering a SHUFFLE_VECTOR to a VPERM operation, we again need to
make the now-familiar transformation of swapping the input operands
and complementing the permute control vector.  Correctness of this
transformation is tested by the accompanying test case.

llvm-svn: 210336

10 years ago[msan] Fix wrong endianness when printing shadow.
Evgeniy Stepanov [Fri, 6 Jun 2014 14:06:14 +0000 (14:06 +0000)]
[msan] Fix wrong endianness when printing shadow.

llvm-svn: 210335

10 years agoclang-format: Fix incorrect indentation.
Daniel Jasper [Fri, 6 Jun 2014 13:49:04 +0000 (13:49 +0000)]
clang-format: Fix incorrect indentation.

Before (JavaScript example, but can extend to other languages):
  return {
    a: 'E',
    b: function() {
      return function() {
      f();  // This is wrong.
      };
    }
  };

After:
  return {
    a: 'E',
    b: function() {
      return function() {
        f();  // This is better.
      };
    }
  };

llvm-svn: 210334

10 years agoQuieting a false-positive which was causing the sanitizer bots to go red.
Aaron Ballman [Fri, 6 Jun 2014 13:39:32 +0000 (13:39 +0000)]
Quieting a false-positive which was causing the sanitizer bots to go red.

llvm-svn: 210333

10 years ago[msan] Partial revert of r210331.
Evgeniy Stepanov [Fri, 6 Jun 2014 13:35:25 +0000 (13:35 +0000)]
[msan] Partial revert of r210331.

Bots did not like it.

llvm-svn: 210332

10 years ago[msan] Better diagnostic for invalid origin id.
Evgeniy Stepanov [Fri, 6 Jun 2014 12:58:44 +0000 (12:58 +0000)]
[msan] Better diagnostic for invalid origin id.

llvm-svn: 210331

10 years agoAdding a new #pragma for the vectorize and interleave optimization hints.
Aaron Ballman [Fri, 6 Jun 2014 12:40:24 +0000 (12:40 +0000)]
Adding a new #pragma for the vectorize and interleave optimization hints.

Patch thanks to Tyler Nowicki!

llvm-svn: 210330

10 years agosanitizer: document missing macro
Dmitry Vyukov [Fri, 6 Jun 2014 12:16:26 +0000 (12:16 +0000)]
sanitizer: document missing macro

llvm-svn: 210329

10 years agoFix typos
Alp Toker [Fri, 6 Jun 2014 12:02:07 +0000 (12:02 +0000)]
Fix typos

llvm-svn: 210328

10 years agoSlight language tweak from Jonathan Humphreys.
Pekka Jaaskelainen [Fri, 6 Jun 2014 11:21:44 +0000 (11:21 +0000)]
Slight language tweak from Jonathan Humphreys.

llvm-svn: 210327

10 years agoDon't generate assembly in backend diagnostic tests
Alp Toker [Fri, 6 Jun 2014 11:20:58 +0000 (11:20 +0000)]
Don't generate assembly in backend diagnostic tests

A leftover -S was generating unwanted output in the source tree overriding
-only flags that normally disable output.

This reverts commit r210323 and implements the proper fix.

Reported by Timur Iskhodzhanov!

llvm-svn: 210326

10 years agoFix C++ style // comments in a couple of C files
Timur Iskhodzhanov [Fri, 6 Jun 2014 11:04:46 +0000 (11:04 +0000)]
Fix C++ style // comments in a couple of C files

llvm-svn: 210325

10 years agoRemove an unused variable
Timur Iskhodzhanov [Fri, 6 Jun 2014 11:02:48 +0000 (11:02 +0000)]
Remove an unused variable

llvm-svn: 210324

10 years agoAdd -o /dev/null to one of the tests as it fails when run from a read-only checkout
Timur Iskhodzhanov [Fri, 6 Jun 2014 10:58:21 +0000 (10:58 +0000)]
Add -o /dev/null to one of the tests as it fails when run from a read-only checkout

llvm-svn: 210323

10 years ago[asan] Make ReplaceSystemMalloc optional on Android.
Evgeniy Stepanov [Fri, 6 Jun 2014 10:57:21 +0000 (10:57 +0000)]
[asan] Make ReplaceSystemMalloc optional on Android.

Don't fail if __libc_malloc_dispatch is missing; continue running
with normal linux interceptors instead.

llvm-svn: 210322

10 years agoTouch configure to force clang's config.h.in reconfiguration on the build servers
Alp Toker [Fri, 6 Jun 2014 10:36:38 +0000 (10:36 +0000)]
Touch configure to force clang's config.h.in reconfiguration on the build servers

Gutted that this is needed, folks who care about keeping the legacy build
system alive should sort this out already.

llvm-svn: 210321

10 years agoRevert "Revert "Devise a package-private means to determine the LLVM version string""
Alp Toker [Fri, 6 Jun 2014 10:36:22 +0000 (10:36 +0000)]
Revert "Revert "Devise a package-private means to determine the LLVM version string""

We probably just need to touch LLVM's configure this time to work around the
totally inadequate Makefile build server integration.

This reverts commit r210314.

llvm-svn: 210320

10 years agolld test for configure & make
Iain Sandoe [Fri, 6 Jun 2014 09:06:25 +0000 (09:06 +0000)]
lld test for configure & make

r210177 added lld Makefiles, r210245 added automatic build when the source is present.

This revision completes the set by adding the lld test and unittests to the check-all target.

llvm-svn: 210318

10 years agoRevert r210298 'Correctly set the comdat symbol on COFF' as it asserts on Windows
Timur Iskhodzhanov [Fri, 6 Jun 2014 08:18:18 +0000 (08:18 +0000)]
Revert r210298 'Correctly set the comdat symbol on COFF' as it asserts on Windows

llvm-svn: 210317

10 years ago[yaml2obj][obj2yaml] Support ELF symbol's visibility flags (default/hidden/protected).
Simon Atanasyan [Fri, 6 Jun 2014 07:41:57 +0000 (07:41 +0000)]
[yaml2obj][obj2yaml] Support ELF symbol's visibility flags (default/hidden/protected).

llvm-svn: 210316

10 years ago[asan] initialize fake_stack_ to 0 before we call SetThreadStackAndTls, because that...
Kostya Serebryany [Fri, 6 Jun 2014 07:35:35 +0000 (07:35 +0000)]
[asan] initialize fake_stack_ to 0 before we call SetThreadStackAndTls, because that may actually try to use fake_stack_ (still don't know how). Yet another case where we desperately want https://sourceware.org/glibc/wiki/ThreadPropertiesAPI

llvm-svn: 210315

10 years agoRevert "Devise a package-private means to determine the LLVM version string"
Alp Toker [Fri, 6 Jun 2014 07:26:57 +0000 (07:26 +0000)]
Revert "Devise a package-private means to determine the LLVM version string"

This didn't work out on the build servers. Investigating

This reverts commit r210313.

llvm-svn: 210314

10 years agoDevise a package-private means to determine the LLVM version string
Alp Toker [Fri, 6 Jun 2014 06:58:25 +0000 (06:58 +0000)]
Devise a package-private means to determine the LLVM version string

This will unbreak clang vendor builds as a follow-up to r210238, now that we
can't poke into LLVM's private config.h (nor should the string be exposed by
llvm-config.h).

This hopefully removes for good the last include of LLVM's config.h.

llvm-svn: 210313

10 years agoAdded select flavour for ABS and NEG(ABS)
Dinesh Dwivedi [Fri, 6 Jun 2014 06:54:45 +0000 (06:54 +0000)]
Added select flavour for ABS and NEG(ABS)

This patch can identify
  ABS(X) ==> (X >s 0) ? X : -X and (X >s -1) ? X : -X
  ABS(X) ==> (X <s 0) ? -X : X and (X <s 1) ? -X : X
  NABS(X) ==> (X >s 0) ? -X : X and (X >s -1) ? -X : X
  NABS(X) ==> (X <s 0) ? X : -X and (X <s 1) ? X : -X

and can transform
  ABS(ABS(X)) -> ABS(X)
  NABS(NABS(X)) -> NABS(X)

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

llvm-svn: 210312

10 years agoMake LINK_POLLY_INTO_TOOLS work with the CMake build
Alp Toker [Fri, 6 Jun 2014 06:39:00 +0000 (06:39 +0000)]
Make LINK_POLLY_INTO_TOOLS work with the CMake build

The option check was being performed after config.h/llvm-config.h substitution,
generating incorrect macro definitions.

Fixes PR19614.

llvm-svn: 210311

10 years agoFix PR19657 (scalar loads not combined into vector load)
Karthik Bhat [Fri, 6 Jun 2014 06:20:08 +0000 (06:20 +0000)]
Fix PR19657 (scalar loads not combined into vector load)
If we have common uses on separate paths in the tree; process the one with greater common depth first.
This makes sure that we do not assume we need to extract a load when it is actually going to be part of a vectorized tree.

Review: http://reviews.llvm.org/D3800
llvm-svn: 210310

10 years agoRemove clang-specific libxml2 check from CMake
Alp Toker [Fri, 6 Jun 2014 05:08:42 +0000 (05:08 +0000)]
Remove clang-specific libxml2 check from CMake

clang's own CMake setup handles this as of r210308.

The CMAKE_CROSSCOMPILING special-case will no longer be hard-coded. This was
clearly site-specific to someone's local configuration and should be passed in
at configure time if needed with e.g. -DLIBXML2_LIBRARIES=... (the libxml2
target I tried here doesn't even support liblzma so it's *way* off).

llvm-svn: 210309

10 years agoAlways check for libxml2 in CMake
Alp Toker [Fri, 6 Jun 2014 05:01:47 +0000 (05:01 +0000)]
Always check for libxml2 in CMake

This is clang's business and LLVM will soon be updated not to perform the check
for us.

llvm-svn: 210308

10 years agoconfig.h: remove clang-specific macro definitions
Alp Toker [Fri, 6 Jun 2014 04:50:41 +0000 (04:50 +0000)]
config.h: remove clang-specific macro definitions

These had no business in LLVM core.

llvm-svn: 210307

10 years agoAdd first set of tests for FriendDecl source range and location.
Nikola Smiljanic [Fri, 6 Jun 2014 04:40:35 +0000 (04:40 +0000)]
Add first set of tests for FriendDecl source range and location.

llvm-svn: 210306

10 years agoRnamed Class to TestClass
Alexey Bataev [Fri, 6 Jun 2014 03:41:14 +0000 (03:41 +0000)]
Rnamed Class to TestClass

llvm-svn: 210305

10 years agoPR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant...
Nikola Smiljanic [Fri, 6 Jun 2014 02:58:59 +0000 (02:58 +0000)]
PR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant ellipsis in parameter pack.

llvm-svn: 210304

10 years agoUpdate for llvm api change.
Rafael Espindola [Fri, 6 Jun 2014 01:20:47 +0000 (01:20 +0000)]
Update for llvm api change.

llvm-svn: 210303

10 years agoAllow aliases to be unnamed_addr.
Rafael Espindola [Fri, 6 Jun 2014 01:20:28 +0000 (01:20 +0000)]
Allow aliases to be unnamed_addr.

Alias with unnamed_addr were in a strange state. It is stored in GlobalValue,
the language reference talks about "unnamed_addr aliases" but the verifier
was rejecting them.

It seems natural to allow unnamed_addr in aliases:

* It is a property of how it is accessed, not of the data itself.
* It is perfectly possible to write code that depends on the address
of an alias.

This patch then makes unname_addr legal for aliases. One side effect is that
the syntax changes for a corner case: In globals, unnamed_addr is now printed
before the address space.

llvm-svn: 210302

10 years ago[TSan] Reduce the stack frame size of ReportDeadlock
Alexey Samsonov [Thu, 5 Jun 2014 23:24:46 +0000 (23:24 +0000)]
[TSan] Reduce the stack frame size of ReportDeadlock

llvm-svn: 210301

10 years agoFix markup for -debug-only option
Alexey Samsonov [Thu, 5 Jun 2014 23:12:43 +0000 (23:12 +0000)]
Fix markup for -debug-only option

llvm-svn: 210300

10 years agoFix null dereference with -debug-only=dwarfdebug
Alexey Samsonov [Thu, 5 Jun 2014 23:10:19 +0000 (23:10 +0000)]
Fix null dereference with -debug-only=dwarfdebug

llvm-svn: 210299

10 years agoCorrectly set the comdat symbol on COFF.
Rafael Espindola [Thu, 5 Jun 2014 23:09:25 +0000 (23:09 +0000)]
Correctly set the comdat symbol on COFF.

We extended the .section syntax to allow multiple sections with the
same name but different comdats, but currently we don't make sure that
the output section has that comdat symbol.

That happens to work with the code llc produces currently because it looks like

.section secName, "dr", one_only, "COMDATSym"
.globl COMDATSym
COMDATSym:
....

but that is not very friendly to anyone coding in assembly or even to
llc once we get comdat support in the IR.

This patch changes the coff object writer to make sure the comdat symbol is
output just after the section symbol, as required by the coff spec.

llvm-svn: 210298

10 years ago[PPC64LE] Add test case for r210282 commit
Bill Schmidt [Thu, 5 Jun 2014 22:57:38 +0000 (22:57 +0000)]
[PPC64LE] Add test case for r210282 commit

Chandler correctly pointed out that I need an LLVM IR test for
r210282, which modified the vperm -> shuffle transform for little
endian PowerPC.  This patch provides that test.

llvm-svn: 210297

10 years agoPR19936: Fix a really dumb bug where we would profile dependent operator* expressions...
Richard Smith [Thu, 5 Jun 2014 22:43:40 +0000 (22:43 +0000)]
PR19936: Fix a really dumb bug where we would profile dependent operator* expressions incorrectly.

llvm-svn: 210296

10 years agoRemove old proposal notices
Alp Toker [Thu, 5 Jun 2014 22:11:20 +0000 (22:11 +0000)]
Remove old proposal notices

Let's just go ahead and assume the answer was 'I do'

llvm-svn: 210295

10 years agoProvide fallback locations for backend remarks
Alp Toker [Thu, 5 Jun 2014 22:11:12 +0000 (22:11 +0000)]
Provide fallback locations for backend remarks

Instead of disembodied diagnostics when debug info is disabled it's now
possible to identify the associated function's location in order to provide
some amount of of context.

We use the definition's body right brace location to differentiate the fallback
from diagnostics that genuinely relate to the function declaration itself (a
convention also used by gcc).

llvm-svn: 210294

10 years agoImplement -Wframe-larger-than backend diagnostic
Alp Toker [Thu, 5 Jun 2014 22:10:59 +0000 (22:10 +0000)]
Implement -Wframe-larger-than backend diagnostic

Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning.
This is the first GCC-compatible backend diagnostic built around LLVM's
reporting feature.

This commit adds infrastructure to perform reverse lookup from mangled names
emitted after LLVM IR generation. We use that to resolve precise locations and
originating AST functions, lambdas or block declarations to produce seamless
codegen-guided diagnostics.

An associated change, StringMap now maintains unique mangled name strings
instead of allocating copies. This is a net memory saving in C++ and a small
hit for C where we no longer reuse IdentifierInfo storage, pending further
optimisation.

llvm-svn: 210293

10 years agoRemove X86Subtarget from the X86FrameLowering constructor since
Eric Christopher [Thu, 5 Jun 2014 22:10:58 +0000 (22:10 +0000)]
Remove X86Subtarget from the X86FrameLowering constructor since
we can just pass in the values we already know and we're not
caching the subtarget anymore.

llvm-svn: 210292

10 years agoFixed several correctness issues in SeparateConstOffsetFromGEP
Jingyue Wu [Thu, 5 Jun 2014 22:07:33 +0000 (22:07 +0000)]
Fixed several correctness issues in SeparateConstOffsetFromGEP

Most issues are on mishandling s/zext.

Fixes:

1. When rebuilding new indices, s/zext should be distributed to
sub-expressions. e.g., sext(a +nsw (b +nsw 5)) = sext(a) + sext(b) + 5 but not
sext(a + b) + 5. This also affects the logic of recursively looking for a
constant offset, we need to include s/zext into the context of the searching.

2. Function find should return the bitwidth of the constant offset instead of
always sign-extending it to i64.

3. Stop shortcutting zext'ed GEP indices. LLVM conceptually sign-extends GEP
indices to pointer-size before computing the address. Therefore, gep base,
zext(a + b) != gep base, a + b

Improvements:

1. Add an optimization for splitting sext(a + b): if a + b is proven
non-negative (e.g., used as an index of an inbound GEP) and one of a, b is
non-negative, sext(a + b) = sext(a) + sext(b)

2. Function Distributable checks whether both sext and zext can be distributed
to operands of a binary operator. This helps us split zext(sext(a + b)) to
zext(sext(a) + zext(sext(b)) when a + b does not signed or unsigned overflow.

Refactoring:

Merge some common logic of handling add/sub/or in find.

Testing:

Add many tests in split-gep.ll and split-gep-and-gvn.ll to verify the changes
we made.

llvm-svn: 210291

10 years agoRemove caching of the subtarget for X86FrameLowering.
Eric Christopher [Thu, 5 Jun 2014 22:00:31 +0000 (22:00 +0000)]
Remove caching of the subtarget for X86FrameLowering.

llvm-svn: 210290

10 years agoRemove duplicate copy of InstrItineraryData from the TargetMachine,
Eric Christopher [Thu, 5 Jun 2014 21:42:54 +0000 (21:42 +0000)]
Remove duplicate copy of InstrItineraryData from the TargetMachine,
it's already on the subtarget.

llvm-svn: 210289

10 years agoAdding explicit triples to the ARM jumptable tests
Tom Roeder [Thu, 5 Jun 2014 21:40:13 +0000 (21:40 +0000)]
Adding explicit triples to the ARM jumptable tests

llvm-svn: 210288

10 years agoAdd a testcase where there is an overflow when combining two constants.
Rafael Espindola [Thu, 5 Jun 2014 21:29:49 +0000 (21:29 +0000)]
Add a testcase where there is an overflow when combining two constants.

I noticed that a proposed optimization would have prevented this.

llvm-svn: 210287

10 years agoWhen an inline-asm diagnostic is reported by the backend, report it with the
Joey Gouly [Thu, 5 Jun 2014 21:23:42 +0000 (21:23 +0000)]
When an inline-asm diagnostic is reported by the backend, report it with the
correct severity.

Previously all inline-asm diagnostics were reported as errors.

llvm-svn: 210286

10 years agoAdd "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.
Kevin Enderby [Thu, 5 Jun 2014 21:21:57 +0000 (21:21 +0000)]
Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.

This is a first step in seeing if it is possible to make llvm-nm produce
the same output as darwin's nm(1).  Darwin's default format is bsd but its
-m output prints the longer Mach-O specific details.  For now I added the
"-format darwin" to do this (whos name may need to change in the future).
As there are other Mach-O specific flags to nm(1) which I'm hoping to add some
how in the future.  But I wanted to see if I could get the correct output for
-m flag using llvm-nm and the libObject interfaces.

I got this working but would love to hear what others think about this approach
to getting object/format specific details printed with llvm-nm.

llvm-svn: 210285

10 years agoMangle predefined string constants names to merge them at link-time
Alexey Samsonov [Thu, 5 Jun 2014 20:53:34 +0000 (20:53 +0000)]
Mangle predefined string constants names to merge them at link-time

Summary:
This change generalizes the code used to create global LLVM
variables referencing predefined strings (e.g. __FUNCTION__): now it
just calls GetAddrOfConstantStringFromLiteral method. As a result,
global variables for these predefined strings may get mangled names
and linkonce_odr linkage. Fix the test accordingly.

Test Plan: clang regression tests

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: cfe-commits

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

llvm-svn: 210284

10 years agoCleanup, and always create a DecltypeType for a decltype expression, rather
Richard Smith [Thu, 5 Jun 2014 20:13:13 +0000 (20:13 +0000)]
Cleanup, and always create a DecltypeType for a decltype expression, rather
than omitting it the first time we see a decltype type with a particular
expression.

llvm-svn: 210283

10 years ago[PPC64LE] Correct vperm -> shuffle transform for little endian
Bill Schmidt [Thu, 5 Jun 2014 19:46:04 +0000 (19:46 +0000)]
[PPC64LE] Correct vperm -> shuffle transform for little endian

As discussed in cfe commit r210279, the correct little-endian
semantics for the vec_perm Altivec interfaces are implemented by
reversing the order of the input vectors and complementing the permute
control vector.  This converts the desired permute from little endian
element order into the big endian element order that the underlying
PowerPC vperm instruction uses.  This is represented with a
ppc_altivec_vperm intrinsic function.

The instruction combining pass contains code to convert a
ppc_altivec_vperm intrinsic into a vector shuffle operation when the
intrinsic has a permute control vector (mask) that is a constant.
However, the vector shuffle operation assumes that vector elements are
in natural order for their endianness, so for little endian code we
will get the wrong result with the existing transformation.

This patch reverses the semantic change to vec_perm that was performed
in altivec.h by once again swapping the input operands and
complementing the permute control vector, returning the element
ordering to little endian.

The correctness of this code is tested by the new perm.c test added in
a previous patch, and by other tests in the test suite that fail
without this patch.

llvm-svn: 210282

10 years agoRemoving spurious dependency of IPO on JumpInstrTables
Tom Roeder [Thu, 5 Jun 2014 19:43:57 +0000 (19:43 +0000)]
Removing spurious dependency of IPO on JumpInstrTables

llvm-svn: 210281

10 years agoAdd a new attribute called 'jumptable' that creates jump-instruction tables for funct...
Tom Roeder [Thu, 5 Jun 2014 19:29:43 +0000 (19:29 +0000)]
Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute.
It includes a pass that rewrites all indirect calls to jumptable functions to pass through these tables.

This also adds backend support for generating the jump-instruction tables on ARM and X86.
Note that since the jumptable attribute creates a second function pointer for a
function, any function marked with jumptable must also be marked with unnamed_addr.

llvm-svn: 210280

10 years ago[PPC64LE] Implement little-endian semantics for vec_perm
Bill Schmidt [Thu, 5 Jun 2014 19:07:40 +0000 (19:07 +0000)]
[PPC64LE] Implement little-endian semantics for vec_perm

The PowerPC vperm (vector permute) instruction is defined
architecturally with a big-endian bias, in that the two input vectors
are assumed to be concatenated "left to right" and the elements of the
combined input vector are assumed to be numbered from "left to right"
(i.e., with element 0 referencing the high-order element).  This
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_perm interface is designed to
use natural element ordering, so that elements are numbered according
to little-endian design principles when code is generated for a
little-endian target.  The desired semantics can be achieved with the
vperm instruction provided that the two input vector registers are
reversed, and the permute control vector is complemented.  The
complementing is performed using an xor with a vector containing all
one bits.

Only the rightmost 5 bits of each element of the permute control
vector are relevant, so it would be possible to complement the vector
with respect to a <16xi8> vector containing all 31s.  However, when
the permute control vector is not a constant, using 255 instead has
the advantage that the vec_xor can be recognized during code
generation as a vnor instruction.  (Power8 introduces a vnand
instruction which could alternatively be generated.)

The correctness of this code is tested by the new perm.c test added in
a previous patch.  I plan to later make the existing ppc32 Altivec
compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210279

10 years agoAdd hasLocalStorage/hasGlobalStorage matchers.
Samuel Benzaquen [Thu, 5 Jun 2014 18:22:14 +0000 (18:22 +0000)]
Add hasLocalStorage/hasGlobalStorage matchers.

Summary:
Add hasLocalStorage/hasGlobalStorage matchers for VarDecl nodes.
Update the doc. Also add them to the dynamic registry.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210278

10 years agoFix bot for named register test
Renato Golin [Thu, 5 Jun 2014 16:52:20 +0000 (16:52 +0000)]
Fix bot for named register test

llvm-svn: 210275

10 years agoAdd pointer types to global named register
Renato Golin [Thu, 5 Jun 2014 16:45:22 +0000 (16:45 +0000)]
Add pointer types to global named register

This patch adds support for pointer types in global named registers variables.
It'll be lowered as a pair of read/write_register and inttoptr/ptrtoint calls.
Also adds some early checks on types on SemaDecl to avoid the assert.

Tests changed accordingly. (PR19837)

llvm-svn: 210274

10 years agoDocument how to select build configuration with Visual C++ IDE or command line.
Yaron Keren [Thu, 5 Jun 2014 16:42:26 +0000 (16:42 +0000)]
Document how to select build configuration with Visual C++ IDE or command line.

llvm-svn: 210273

10 years agoAdded gdb-remote test for software breakpoints.
Todd Fiala [Thu, 5 Jun 2014 16:34:13 +0000 (16:34 +0000)]
Added gdb-remote test for software breakpoints.

Tests $Z0 and $z0.  Extends test exe get-code-address-hex:
to take a function name.

Enabled for debugserver, disabled for llgs.  Implementing
in llgs branch next.

llvm-svn: 210272

10 years ago[PPC64LE] Temporarily disable VSX support in little-endian mode
Bill Schmidt [Thu, 5 Jun 2014 16:21:13 +0000 (16:21 +0000)]
[PPC64LE] Temporarily disable VSX support in little-endian mode

This is a preliminary patch for the PowerPC64LE support.  In stage 1
of the vector support, we will support the VMX (Altivec) instruction
set, but will not yet support the VSX instructions.  This is merely a
staging issue to provide functional vector support as soon as
possible.

llvm-svn: 210271

10 years ago[mips] Add macros _MIPS_ISA and __mips_isa_rev (same expansion as defined by GCC).
Matheus Almeida [Thu, 5 Jun 2014 14:59:18 +0000 (14:59 +0000)]
[mips] Add macros _MIPS_ISA and __mips_isa_rev (same expansion as defined by GCC).

Summary: The Linux Kernel is one example of a piece of software that relies on them.

Reviewers: atanasyan

Reviewed By: atanasyan

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

llvm-svn: 210270

10 years agoFix equalsNode() to accept pointers to derived types.
Samuel Benzaquen [Thu, 5 Jun 2014 14:47:08 +0000 (14:47 +0000)]
Fix equalsNode() to accept pointers to derived types.

Summary:
Move the 'const' in the AST_*MATCHER_P* macros to the right of ParamType to
avoiad applying the constness on the wrong level when ParamType is a pointer.
Change equalsNode() to explicitly accept 'const Decl*' or 'const Stmt*'.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210269

10 years agoRemove unused defines from lldb driver.
Todd Fiala [Thu, 5 Jun 2014 14:46:04 +0000 (14:46 +0000)]
Remove unused defines from lldb driver.

See http://reviews.llvm.org/D3965 for details.

Change by Thiago Farina.

llvm-svn: 210268