Commit Graph

175774 Commits

Author SHA1 Message Date
Dmitry Vyukov 909b7490a3 sanitizer: document missing macro
llvm-svn: 210329
2014-06-06 12:16:26 +00:00
Alp Toker 15e62a37f0 Fix typos
llvm-svn: 210328
2014-06-06 12:02:07 +00:00
Pekka Jaaskelainen a304408789 Slight language tweak from Jonathan Humphreys.
llvm-svn: 210327
2014-06-06 11:21:44 +00:00
Alp Toker 7ce5f025a3 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
2014-06-06 11:20:58 +00:00
Timur Iskhodzhanov eae19460a7 Fix C++ style // comments in a couple of C files
llvm-svn: 210325
2014-06-06 11:04:46 +00:00
Timur Iskhodzhanov f2a380325d Remove an unused variable
llvm-svn: 210324
2014-06-06 11:02:48 +00:00
Timur Iskhodzhanov 27700e28de Add -o /dev/null to one of the tests as it fails when run from a read-only checkout
llvm-svn: 210323
2014-06-06 10:58:21 +00:00
Evgeniy Stepanov e5c34ace7f [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
2014-06-06 10:57:21 +00:00
Alp Toker c84c5c9ac1 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
2014-06-06 10:36:38 +00:00
Alp Toker f988d00682 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
2014-06-06 10:36:22 +00:00
Iain Sandoe f419931fa3 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
2014-06-06 09:06:25 +00:00
Timur Iskhodzhanov 460cf8891b Revert r210298 'Correctly set the comdat symbol on COFF' as it asserts on Windows
llvm-svn: 210317
2014-06-06 08:18:18 +00:00
Simon Atanasyan 65e6467e69 [yaml2obj][obj2yaml] Support ELF symbol's visibility flags (default/hidden/protected).
llvm-svn: 210316
2014-06-06 07:41:57 +00:00
Kostya Serebryany 558b3363a7 [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
2014-06-06 07:35:35 +00:00
Alp Toker 27f333d3ad 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
2014-06-06 07:26:57 +00:00
Alp Toker 420d7ccbac 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
2014-06-06 06:58:25 +00:00
Dinesh Dwivedi 3217b6c661 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
2014-06-06 06:54:45 +00:00
Alp Toker 6ae079ee4a 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
2014-06-06 06:39:00 +00:00
Karthik Bhat bf56d44cab 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
2014-06-06 06:20:08 +00:00
Alp Toker 5627ee47f4 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
2014-06-06 05:08:42 +00:00
Alp Toker 6cea318027 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
2014-06-06 05:01:47 +00:00
Alp Toker b27bdade9f config.h: remove clang-specific macro definitions
These had no business in LLVM core.

llvm-svn: 210307
2014-06-06 04:50:41 +00:00
Nikola Smiljanic 357af64d78 Add first set of tests for FriendDecl source range and location.
llvm-svn: 210306
2014-06-06 04:40:35 +00:00
Alexey Bataev 15e4ee7852 Rnamed Class to TestClass
llvm-svn: 210305
2014-06-06 03:41:14 +00:00
Nikola Smiljanic 69fdc9ff89 PR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant ellipsis in parameter pack.
llvm-svn: 210304
2014-06-06 02:58:59 +00:00
Rafael Espindola df540cbf92 Update for llvm api change.
llvm-svn: 210303
2014-06-06 01:20:47 +00:00
Rafael Espindola 42a4c9f9e0 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
2014-06-06 01:20:28 +00:00
Alexey Samsonov f251e0051c [TSan] Reduce the stack frame size of ReportDeadlock
llvm-svn: 210301
2014-06-05 23:24:46 +00:00
Alexey Samsonov 6c0ddfe9a6 Fix markup for -debug-only option
llvm-svn: 210300
2014-06-05 23:12:43 +00:00
Alexey Samsonov 45d638a3fd Fix null dereference with -debug-only=dwarfdebug
llvm-svn: 210299
2014-06-05 23:10:19 +00:00
Rafael Espindola 942f4bc488 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
2014-06-05 23:09:25 +00:00
Bill Schmidt 72dfa16aa9 [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
2014-06-05 22:57:38 +00:00
Richard Smith f15acc5f5c PR19936: Fix a really dumb bug where we would profile dependent operator* expressions incorrectly.
llvm-svn: 210296
2014-06-05 22:43:40 +00:00
Alp Toker 84ea12b5dc Remove old proposal notices
Let's just go ahead and assume the answer was 'I do'

llvm-svn: 210295
2014-06-05 22:11:20 +00:00
Alp Toker 27506271b4 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
2014-06-05 22:11:12 +00:00
Alp Toker fb8d02b179 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
2014-06-05 22:10:59 +00:00
Eric Christopher 66f676e9e5 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
2014-06-05 22:10:58 +00:00
Jingyue Wu 84465473e7 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
2014-06-05 22:07:33 +00:00
Eric Christopher f438164d30 Remove caching of the subtarget for X86FrameLowering.
llvm-svn: 210290
2014-06-05 22:00:31 +00:00
Eric Christopher c22a04c063 Remove duplicate copy of InstrItineraryData from the TargetMachine,
it's already on the subtarget.

llvm-svn: 210289
2014-06-05 21:42:54 +00:00
Tom Roeder 4b239ed3ec Adding explicit triples to the ARM jumptable tests
llvm-svn: 210288
2014-06-05 21:40:13 +00:00
Rafael Espindola c286f4bf2a 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
2014-06-05 21:29:49 +00:00
Joey Gouly 5798b26c65 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
2014-06-05 21:23:42 +00:00
Kevin Enderby 980b25840f 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
2014-06-05 21:21:57 +00:00
Alexey Samsonov 8f4f1cf778 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
2014-06-05 20:53:34 +00:00
Richard Smith 8eb1d322e2 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
2014-06-05 20:13:13 +00:00
Bill Schmidt a1184635ce [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
2014-06-05 19:46:04 +00:00
Tom Roeder 544d1c22be Removing spurious dependency of IPO on JumpInstrTables
llvm-svn: 210281
2014-06-05 19:43:57 +00:00
Tom Roeder 44cb65fff1 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
2014-06-05 19:29:43 +00:00
Bill Schmidt f7e289c0f2 [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
2014-06-05 19:07:40 +00:00