Commit Graph

22470 Commits

Author SHA1 Message Date
James Molloy b452f78ad2 [ARM-BE] Generate correct NEON intrinsics for big endian systems.
The NEON intrinsics in arm_neon.h are designed to work on vectors
"as-if" loaded by (V)LDR. We load vectors "as-if" (V)LD1, so the
intrinsics are currently incorrect.

This patch adds big-endian versions of the intrinsics that does the
"obvious but dumb" thing of reversing all vector inputs and all
vector outputs. This will produce extra REVs, but we trust the
optimizer to remove them.

llvm-svn: 211893
2014-06-27 11:53:35 +00:00
Alexander Kornienko 9f2a4a0ab0 Don't check clang binary name, as it can be different in some test setups.
Summary: This unbreaks our internal build after these tests were turned on in r211738.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: benlangmuir, cfe-commits

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

llvm-svn: 211887
2014-06-27 11:18:13 +00:00
Alexey Bataev bae9a793fd [OPENMP] Parsing and sema analysis for 'copyprivate' clause.
llvm-svn: 211886
2014-06-27 10:37:06 +00:00
Justin Bogner 80effa415c Driver: Pass -ivfsoverlay to module crashdumps
When we create a crashdump involving modules, we build a VFS to
reproduce the problem with. This updates the reproduction script to
use that VFS.

llvm-svn: 211876
2014-06-27 06:35:05 +00:00
Saleem Abdulrasool 4b68a05f3d Driver: use GNU::Link for the Generic_GCC toolchain
This changes the behaviour of the driver for linking to match that of the
Generic_GCC::Assemble.    The default link should use "ld" rather than "gcc" for
the linker as gcc does.  This avoids the unnecessary round-tripping through gcc.
It also is much more reasonable behaviour from the user's perspective.  This
should have been updated with SVN r195554 which changed the behaviour of
Generic_GCC::Assemble.

The gcc_forward test needs to be updated to mark the fact that -march is a flag
for GCC not ld.  This was updated as a typo fix, but added a check for a flag
that is not a link flag.

The bindings test covers the change for testing, and thus no new test was added.

llvm-svn: 211866
2014-06-27 05:06:41 +00:00
Alexey Bataev 5d495ae49b [OPENMP] Added several test cases in nesting of OpenMP regions test after review from Samuel F Antao.
llvm-svn: 211857
2014-06-27 03:33:10 +00:00
Alp Toker 1d1ac112f0 Account for differences in grep implementations
llvm-svn: 211856
2014-06-27 03:11:38 +00:00
Alp Toker 830c34e269 Restore test from r211844 skipping '.file' directives
At least this answers the question of whether .bc/.ll input processed by the
frontend produces identical output to the original compilation.

llvm-svn: 211853
2014-06-27 02:59:39 +00:00
Alp Toker 8e7e1b87c6 Partially disable test from r211844
ELF assembly contains .line directives that differ based on the input filename.
Weaken the test while considering options.

llvm-svn: 211849
2014-06-27 02:35:57 +00:00
Alp Toker 1a5a520d95 Add test coverage for .bc input in the frontend
Test that we can consume LLVM bitcode and additionally check that it produces
the same output as a direct compilation.

The feature is crashy and has gone untested until now, but we might as well
provide some coverage as long as it remains in tree.

Also test LL source input in the same way because the existing tests for that
don't look convincing.

llvm-svn: 211844
2014-06-27 02:04:28 +00:00
Alp Toker aab3a8f2fb Remove .bc from test config.suffixes
This was unused. Besides, a binary file can't really contain lit ShTests.

llvm-svn: 211843
2014-06-27 02:04:21 +00:00
NAKAMURA Takumi a217a1a68b clang/test/Driver/fuse-ld.c: Really fix to match dos path.
llvm-svn: 211841
2014-06-27 01:32:59 +00:00
Anna Zaks b8de0c4278 Do not inline methods of C++ containers (coming from headers).
This silences false positives (leaks, use of uninitialized value) in simple
code that uses containers such as std::vector and std::list. The analyzer
cannot reason about the internal invariances of those data structures which
leads to false positives. Until we come up with a better solution to that
problem, let's just not inline the methods of the containers and allow objects
to escape whenever such methods are called.

This just extends an already existing flag "c++-container-inlining" and applies
the heuristic not only to constructors and destructors of the containers, but
to all of their methods.

We have a bunch of distinct user reports all related to this issue
(radar://16058651, radar://16580751, radar://16384286, radar://16795491
[PR19637]).

llvm-svn: 211832
2014-06-27 01:03:05 +00:00
Logan Chien ad86372630 Allow different path separator for windows build.
llvm-svn: 211823
2014-06-27 00:19:33 +00:00
Fariborz Jahanian 53f867ac45 Objective-C ARC. Provide diagnostic and fix-it
when casting a retainable object to a objc_bridge_related
CF type with the suggestion of applying the method
specified in the bridging attribute to the object.
// rdar://15932435

llvm-svn: 211807
2014-06-26 21:22:16 +00:00
Justin Bogner f05a499339 Driver: Fix a misleading comment and test for what it actually did
llvm-svn: 211806
2014-06-26 20:59:39 +00:00
Jim Grosbach be83cb8c96 ARM: Correctly identify cortex-m4 as v7em.
Get the predefined macro for the architecture correct.
cortex-m4: __ARM_ARCH_7EM__
cortex-m3: __ARM_ARCH_7M__
cortex-m0: __ARM_ARCH_6M__

rdar://17420090

llvm-svn: 211792
2014-06-26 17:24:16 +00:00
Logan Chien 606769ecc6 Propset the executables for GetProgramPath().
llvm-svn: 211786
2014-06-26 14:38:46 +00:00
Logan Chien eb9162f0bb Implement the -fuse-ld= option.
This commit implements the -fuse-ld= option, so that the user
can specify -fuse-ld=bfd to use ld.bfd.

This commit re-applies r194328 with some test case changes.
It seems that r194328 was breaking macosx or mingw build
because clang can't find ld.bfd or ld.gold in the given sysroot.
We should use -B to specify the executable search path instead.

Patch originally by David Chisnall.

llvm-svn: 211785
2014-06-26 14:23:45 +00:00
Will Schmidt f048751912 Add ppc64/power8 as a target
llvm-svn: 211778
2014-06-26 13:34:10 +00:00
Alexey Bataev d1e40fbfe1 [OPENMP] Initial parsing and sema analysis for 'single' directive.
llvm-svn: 211774
2014-06-26 12:05:45 +00:00
Alexey Bataev 1e0498a92d [OPENMP] Initial parsing and sema analysis for 'section' directive.
llvm-svn: 211767
2014-06-26 08:21:58 +00:00
David Majnemer 07910d6ab5 Sema: Allow dllimport entities in template args for mingw
Previously dllimport variables inside of template arguments relied on
not using the C++11 codepath when -fms-compatibility was set.

While this allowed us to achieve compatibility with MSVC, it did so at
the expense of MingW.

Instead, try to use the DeclRefExpr we dig out of the template argument.
If it has the dllimport attribute, accept it and skip the C++11
null-pointer check.

llvm-svn: 211766
2014-06-26 07:48:46 +00:00
Justin Bogner 40b8ba1496 CodeGen: Improve warnings about uninstrumented files when profiling
Improve the warning when building with -fprofile-instr-use and a file
appears not to have been profiled at all. This keys on whether a
function is defined in the main file or not to avoid false negatives
when one includes a header with functions that have been profiled.

llvm-svn: 211760
2014-06-26 01:45:07 +00:00
Reid Kleckner 69071442f0 Forward -u to the linker on gnutools toolchains
Summary:
The BSDs and Darwin all forward the whole 'u' group, but gcc only
forwards -u so far as I can tell.  I only forward -u, since that's a
minimal change, and many people object to magically recognizing and
forwarding linker arguments.

Reviewers: chandlerc, joerg

Subscribers: cfe-commits

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

llvm-svn: 211756
2014-06-26 01:08:54 +00:00
Ben Langmuir 54cbc706b1 Make -Wincomplete-umbrella go through the VFS
By using vfs::recursive_directory_iterator, this warning will now fire
when some or all of a module's headers are from VFS mappings.

llvm-svn: 211746
2014-06-25 23:53:43 +00:00
David Blaikie e44fd66f8c Make PR20038.cpp test case portable to non-Itanium ABIs
The only call in this function is to the dtor, so there's no need to
name a non-portable mangled function name to match it.

llvm-svn: 211742
2014-06-25 23:19:58 +00:00
Alp Toker 262510a4ac Remove REQUIRES lines from portable tests
These tests are target-independent and shouldn't ever be suppressed.

llvm-svn: 211738
2014-06-25 22:46:44 +00:00
Hans Wennborg 82dd877e8a Don't allow dllimport variables in constant initializers
This is a follow-up to David's r211677. For the following code,
we would end up referring to 'foo' in the initializer for 'arr',
and then fail to link, because 'foo' is dllimport and needs to be
accessed through the __imp_?foo.

  __declspec(dllimport) extern const char foo[];
  const char* f() {
    static const char* const arr[] = { foo };
    return arr[0];
  }

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

llvm-svn: 211736
2014-06-25 22:19:48 +00:00
Hans Wennborg 9bea9cc73b MS ABI: Propagate class-level DLL attributes to class template specialization bases (PR11170)
Consider the following code:

  template <typename T> class Base {};
  class __declspec(dllexport) class Derived : public Base<int> {}

When the base of an exported or imported class is a class template
specialization, MSVC will propagate the dll attribute to the base.
In the example code, Base<int> becomes a dllexported class.

This commit makes Clang do the proopagation when the base hasn't been
instantiated yet, and warns about it being unsupported otherwise.
This is different from MSVC, which allows changing a specialization
back and forth between dllimport and dllexport and seems to let the
last one win. Changing the dll attribute after instantiation would be
hard for us, and doesn't seem to come up in practice, so I think this
is a reasonable limitation to have.

MinGW doesn't do this kind of propagation.

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

llvm-svn: 211725
2014-06-25 18:25:57 +00:00
David Blaikie 21cd7cfd01 PR20038: DebugInfo: Call sites without DebugLocs for temporary dtors after a conditional
With && at the top level of an expression, the last thing done when
emitting the expression was an unconditional jump to the cleanup block.
To reduce the amount of stepping, the DebugLoc is omitted from the
unconditional jump. This is done by clearing the IRBuilder's
"CurrentDebugLocation"*. If this is not set to some non-empty value
before the cleanup block is emitted, the cleanups don't get a location
either. If a call without a location is emitted in a function with debug
info, and that call is then inlined - bad things happen. (without a
location for the call site, the inliner would just leave the inlined
DebugLocs as they were - pointing to roots in the original function, not
inlined into the current function)

Follow up commit to LLVM will ensure that breaking the invariants of the
DebugLoc chains by having chains that don't lead to the current function
will fail assertions, so we shouldn't accidentally slip any of these
cases in anymore. Those assertions may reveal further cases that need to
be fixed in clang, though I've tried to test heavily to avoid that.

* See r128471, r128513 for the code that clears the
  CurrentDebugLocation. Simply removing this code or moving the code
  into IRBuilder to apply to all unconditional branches would regress
  desired behavior, unfortunately.

llvm-svn: 211722
2014-06-25 17:57:34 +00:00
Serge Pavlov a826147eef Fix treatment of types defined in function prototype
Types defined in function prototype are diagnosed earlier in C++ compilation.
They are put into declaration context where the prototype is introduced. Later on,
when FunctionDecl object is created, these types are moved into the function context.

This patch fixes PR19018 and PR18963.

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

llvm-svn: 211718
2014-06-25 17:09:41 +00:00
Eli Bendersky b198b4e864 Rename loop unrolling and loop vectorizer metadata to have a common prefix.
[Clang part]

These patches rename the loop unrolling and loop vectorizer metadata
such that they have a common 'llvm.loop.' prefix.  Metadata name
changes:

llvm.vectorizer.* => llvm.loop.vectorizer.*
llvm.loopunroll.* => llvm.loop.unroll.*

This was a suggestion from an earlier review
(http://reviews.llvm.org/D4090) which added the loop unrolling
metadata. 

Patch by Mark Heffernan.

llvm-svn: 211712
2014-06-25 15:42:16 +00:00
Alexey Volkov 54ff080e39 Align with new GCC options for x86 Android
32-bit: +ssse3
64-bit: +sse4.2 +popcnt

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

llvm-svn: 211688
2014-06-25 12:15:36 +00:00
James Molloy b8fd41926c CHECK-LABEL'ify this test.
llvm-svn: 211687
2014-06-25 11:50:56 +00:00
James Molloy 7d64a0eec4 [AArch32] Fix a stupid error in an architectural guard
The < 8 instead of <= 8 meant that a bunch of vreinterprets were not available on v8 AArch32. Simplify the guard to just !defined(aarch64) while we're at it, and enable some v8 AArch32 testing.

llvm-svn: 211686
2014-06-25 11:46:24 +00:00
Alexey Bataev d3f8dd2d15 [OPENMP] Initial support for 'sections' directive.
llvm-svn: 211685
2014-06-25 11:44:49 +00:00
David Majnemer 0c43d8077e AST: Initialization with dllimport functions in C
The C++ language requires that the address of a function be the same
across all translation units.  To make __declspec(dllimport) useful,
this means that a dllimported function must also obey this rule.  MSVC
implements this by dynamically querying the import address table located
in the linked executable.  This means that the address of such a
function in C++ is not constant (which violates other rules).

However, the C language has no notion of ODR nor does it permit dynamic
initialization whatsoever.  This requires implementations to _not_
dynamically query the import address table and instead utilize a wrapper
function that will be synthesized by the linker which will eventually
query the import address table.  The effect this has is, to say the
least, perplexing.

Consider the following C program:
__declspec(dllimport) void f(void);

typedef void (*fp)(void);

static const fp var = &f;

const fp fun() { return &f; }

int main() { return fun() == var; }

MSVC will statically initialize "var" with the address of the wrapper
function and "fun" returns the address of the actual imported function.
This means that "main" will return false!

Note that LLVM's optimizers are strong enough to figure out that "main"
should return true.  However, this result is dependent on having
optimizations enabled!

N.B.  This change also permits the usage of dllimport declarators inside
of template arguments; they are sufficiently constant for such a
purpose.  Add tests to make sure we don't regress here.

llvm-svn: 211677
2014-06-25 08:15:07 +00:00
Alexander Kornienko 01ecd3107e Added a test to ensure -Wimplicit-fallthrough works with -fblocks correctly.
llvm-svn: 211676
2014-06-25 08:09:35 +00:00
JF Bastien ab8d0a0dd5 Implement predefined stdint macros
Add predefined stdint macros that match the given patterns:

U?INT{_,_FAST,_LEAST}{8,16,32,64}_{MAX,TYPE}
U?INT{PTR,MAX}_{MAX,TYPE}

http://reviews.llvm.org/D4141

Author: binji
llvm-svn: 211657
2014-06-25 01:31:33 +00:00
Reid Kleckner 6d8d22ae40 Fix parsing nested __if_exists blocks
Rather than having kw___if_exists be a special case of
ParseCompoundStatementBody, we can look for kw___if_exists in the big
switch over for valid statement tokens in ParseStatementOrDeclaration.

Nested __if_exists blocks are used in the DECLARE_REGISTRY_RESOURCEID
macro from atlcom.h.

llvm-svn: 211654
2014-06-25 00:28:35 +00:00
Reid Kleckner 6be648f047 Add a missing test for the __if_exists extension
MSVC does not create a new scope for the body of an __if_exists compound
statement.  Clang already gets this right today, but it was untested.

llvm-svn: 211650
2014-06-25 00:10:50 +00:00
Reid Kleckner 27e1473143 Split tests for __if_exists out into their own file
llvm-svn: 211649
2014-06-25 00:08:10 +00:00
Hans Wennborg 5e64528195 MS ABI: Ignore dll attributes on partial template specializations
llvm-svn: 211648
2014-06-24 23:57:13 +00:00
Richard Trieu f4b81d0029 Provide a better diagnostic when braces are put before the identifier.
When a user types:
  int [4] foo;
assume that the user means:
  int foo[4];

Update the information for 'foo' to prevent additional errors, and provide
a fix-it hint to move the brackets to the correct location.

Additionally, suggest parens for types that require it, such as:
  int [4] *foo;
to:
  int (*foo)[4];

llvm-svn: 211641
2014-06-24 23:14:24 +00:00
Matt Arsenault 56f008d538 Add R600 builtin codegen.
llvm-svn: 211631
2014-06-24 20:45:01 +00:00
Rafael Espindola 0a500af186 Correctly Load Mixed FP-GP Variadic Arguments for x86-64.
According to the x86-64 ABI, structures with both floating point and
integer members are split between floating-point and general purpose
registers, and consecutive 32-bit floats can be packed into a single
floating point register.

In the case of variadic functions these are stored to memory and the position
recorded in the va_list. This was already correctly implemented in
llvm.va_start.

The problem is that the code in clang for implementing va_arg was reading
floating point registers from the wrong location.

Patch by Thomas Jablin.

Fixes PR20018.

llvm-svn: 211626
2014-06-24 20:01:50 +00:00
Brad Smith 5b05db864b Use appropriate default PIE settings for OpenBSD.
llvm-svn: 211624
2014-06-24 19:51:29 +00:00
Alp Toker 51dc8e9b53 Simplify optimization-remark.c test following r211610
With LocTrackingOnly there's no longer a user-facing distinction so the NDEBUG
checks can go away. (Except maybe column info, but -verify only checks line
numbers anyway.)

Also add a RUN line to validate the traditional !LocTrackingOnly case.

llvm-svn: 211622
2014-06-24 19:23:10 +00:00
Simon Atanasyan 3a46afafef [Driver][Mips] Support mips64-linux-gnuabi64 / mips64el-linux-gnuabi64 target triples.
The patch fixes the bug #19869.
http://llvm.org/bugs/show_bug.cgi?id=19869

llvm-svn: 211619
2014-06-24 19:00:12 +00:00