Commit Graph

24246 Commits

Author SHA1 Message Date
Alexander Musman df7a8e2bc8 Support ‘omp for’ with static chunked schedule kind.
Differential Revision: http://reviews.llvm.org/D7006

llvm-svn: 226795
2015-01-22 08:49:35 +00:00
Alexey Bataev b57056f483 [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226788
2015-01-22 06:17:56 +00:00
Alexey Bataev 02e1ec6966 Revert commit revision 226786
Need to add initialization of AtomicInfo::EvaluationKind field

llvm-svn: 226787
2015-01-22 06:09:48 +00:00
Alexey Bataev 92efdce503 [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226786
2015-01-22 05:44:37 +00:00
Alexey Bataev 137421c8a9 Revert commit r226784.
Accidentally modified file SemaType.cpp must be restored to its original state. 

llvm-svn: 226785
2015-01-22 05:35:53 +00:00
Alexey Bataev 13c7c4930c [OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".
Differential Revision: http://reviews.llvm.org/D6431

llvm-svn: 226784
2015-01-22 05:29:28 +00:00
Richard Smith 1b65dbc477 [modules] If we add an implicit special member to a class through an update
record, and that class declaration is not the canonical definition of the
class, be sure to add the class to the list of classes that are consulted when
we look up a special member in the canonical definition.

llvm-svn: 226778
2015-01-22 03:50:31 +00:00
Richard Smith 9ba845c2e6 Fix test file names so they're picked up by lit.
llvm-svn: 226776
2015-01-22 03:24:07 +00:00
Reid Kleckner 2a2e156318 SEH: Emit the constant filter 1 as a catch-all
Minor optimization of code like __try { ... } __except(1) { ... }.

llvm-svn: 226766
2015-01-22 02:25:56 +00:00
Richard Smith f1f4bc2176 [modules] If we load two declarations with typedef names for linkage purposes
on top of a local declaration of the same entity, we still need to remember
that we loaded the first one or we may fail to merge the second one properly.

llvm-svn: 226765
2015-01-22 02:21:23 +00:00
Justin Bogner 00270df517 InstrProf: Avoid creating profile names for symbols in system headers
We don't emit any coverage mapping for uncovered functions that come
from system headers, but we were creating a GlobalVariable with each
of their names. This is wasteful since the linker will need to dead
strip the unused symbols, and it can lead to issues when merging
coverage with others TUs that do have coverage for those functions.

llvm-svn: 226764
2015-01-22 02:17:23 +00:00
Richard Smith 5156c38570 [modules] It's possible to merge into the pattern of a class template before we
load the definition data from the declaration itself. In that case, merge
properly; don't assume the prior definition is the same as our own.

llvm-svn: 226761
2015-01-22 01:41:56 +00:00
Reid Kleckner 1d59f99f5c Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.

Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
  outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
  implemented.
- __finally blocks will not run after exceptions. Fixing this requires
  work in the LLVM SEH preparation pass.

The IR lowering looks like this:

// C code:
bool safe_div(int n, int d, int *r) {
  __try {
    *r = normal_div(n, d);
  } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
    return false;
  }
  return true;
}

; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
  %ehptrs = bitcast i8* %e to i32**
  %ehrec = load i32** %ehptrs
  %code = load i32* %ehrec
  %matches = icmp eq i32 %code, i32 u0xC0000094
  %matches.i32 = zext i1 %matches to i32
  ret i32 %matches.i32
}

define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
  %rr = invoke i32 @normal_div(i32 %n, i32 %d)
      to label %normal unwind to label %lpad

normal:
  store i32 %rr, i32* %r
  ret i1 1

lpad:
  %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
      catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
  %ehptr = extractvalue {i8*, i32} %ehvals, i32 0
  %sel = extractvalue {i8*, i32} %ehvals, i32 1
  %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
  %matches = icmp eq i32 %sel, %filter_sel
  br i1 %matches, label %eh.except, label %eh.resume

eh.except:
  ret i1 false

eh.resume:
  resume
}

Reviewers: rjmccall, rsmith, majnemer

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

llvm-svn: 226760
2015-01-22 01:36:17 +00:00
Rafael Espindola e855c2ae0a Revert "Try to fix -Asserts build bots."
This reverts commit r226758.

Looks like rnk's 226757 fixed the real issue.
Sorry for the noise.

llvm-svn: 226759
2015-01-22 01:33:41 +00:00
Rafael Espindola b88c11281c Try to fix -Asserts build bots.
llvm-svn: 226758
2015-01-22 01:26:39 +00:00
Reid Kleckner 395dad8213 Give the block inlining test a triple to determinise output
It fails on Windows due to another temporary being emitted first, so the
LLVM internal renaming scheme gives out the name
__block_descriptor_tmp1.

llvm-svn: 226757
2015-01-22 01:19:19 +00:00
Hans Wennborg 9cf7122ff7 Fix compiler_builtins.m test to not rely on including system stdlib.h and malloc.h
Importing _Builtin_intrinsics.sse and avx would transitively pull in those
headers, and the test would fail when building in an environment where
they were not available on the include path.

This fixes PR20995 for me.

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

llvm-svn: 226754
2015-01-22 00:45:20 +00:00
Rafael Espindola e5df59ff78 Emit DeferredDeclsToEmit in a DFS order.
Currently we emit DeferredDeclsToEmit in reverse order. This patch changes that.

The advantages of the change are that

* The output order is a bit closer to the source order. The change to
test/CodeGenCXX/pod-member-memcpys.cpp is a good example.

* If we decide to deffer more, it will not cause as large changes in the
estcases as it would without this patch.

llvm-svn: 226751
2015-01-22 00:24:57 +00:00
Rafael Espindola 701d2dd4b7 Use CHECK-LABEL when possible. NFC.
llvm-svn: 226743
2015-01-21 23:33:55 +00:00
David Blaikie 07c6bfd502 DebugInfo: Remove distinct-call-inlining test case as this is being fixed in LLVM.
This test will start failing shortly once this bug is fixed in LLVM. At
that point this behavior is no longer required in Clang and will be
removed. In the interim, remove this test just to avoid the race between
the LLVM and Clang commits.

After the LLVM commit, I'll cleanup the workaround behavior in Clang.

llvm-svn: 226735
2015-01-21 22:57:22 +00:00
Rafael Espindola 2144377536 Use a CHECK-LABEL. NFC
llvm-svn: 226709
2015-01-21 22:38:24 +00:00
Reid Kleckner 9da9448339 Add the "thunk" attribute to MS ABI virtual member pointers
This attribute implies indicates that the function musttail calls
another function and returns whatever it returns. The return type of the
thunk is meaningless, as the thunk can dynamically call different
functions with different return types. So long as the callers bitcast
the thunk with the correct type, behavior is well defined.

This attribute was necessary to fix PR20944, where the indirect call
combiner noticed that the thunk returned void and replaced the results
of the indirect call instruction with undef.

Over-the-shoulder reviewed by David Majnemer.

llvm-svn: 226707
2015-01-21 22:18:17 +00:00
Francisco Lopes da Silva 24a777238e Add back a FIXME note to lit.cfg.
llvm-svn: 226703
2015-01-21 21:38:05 +00:00
Saleem Abdulrasool 97a01f0161 Fix isTriviallyCopyableType for arrays
Fix isTriviallyCopyableType for arrays. An array of type T is trivially copyable
if T is trivially copyable.

Patch by Agustín Bergé!

llvm-svn: 226696
2015-01-21 19:39:10 +00:00
Rafael Espindola 17c57ecf4a Used CHECK-DAG since the order is not important.
llvm-svn: 226677
2015-01-21 17:12:04 +00:00
Rafael Espindola 469e2ee83a Used CHECK-DAG since the order is not important.
llvm-svn: 226675
2015-01-21 16:56:43 +00:00
Francisco Lopes da Silva 975a9f6ece Initial support for C++ parameter completion
The improved completion in call context now works with:

 - Functions.
 - Member functions.
 - Constructors.
 - New expressions.
 - Function call expressions.
 - Template variants of the previous.

There are still rough edges to be fixed:

 - Provide support for optional parameters.         (fix known)
 - Provide support for member initializers.         (fix known)
 - Provide support for variadic template functions. (fix unknown)
 - Others?

llvm-svn: 226670
2015-01-21 16:24:11 +00:00
Rafael Espindola 11bb53bc77 Don't assume variable name.
Should fix the test in -Asserts builds.

llvm-svn: 226668
2015-01-21 16:18:42 +00:00
Rafael Espindola e20c966cf4 Make the test a bit stricter. NFC.
llvm-svn: 226667
2015-01-21 16:13:57 +00:00
Rafael Espindola 3a0e228cca Make the test a bit stricter. NFC.
llvm-svn: 226666
2015-01-21 16:03:26 +00:00
David Majnemer 475b25eefa AST: Don't ignore alignas on EnumDecls when calculating alignment
We didn't consider any alignment attributes on an EnumDecl when
calculating alignment.

While we are here, ignore alignment specifications on typedef types if
one is used as the underlying type.  Otherwise, weird things happen:

enum Y : int;
Y y;

typedef int __attribute__((aligned(64))) u;
enum Y : u {};

What is the alignment of 'Y'?  It would be more consistent with the
overall design of enums with fixed underlying types to consider the
underlying type's UnqualifiedDesugaredType.

This fixes PR22279.

llvm-svn: 226653
2015-01-21 10:54:38 +00:00
David Majnemer 290d347471 Revert "Sema: err_after_alias is unreachable, remove it"
This reverts commit r226626.  err_after_alias is, in fact, reachable.

llvm-svn: 226633
2015-01-21 01:30:40 +00:00
David Majnemer 8c9cdb6573 MS ABI: Virtual member pointer thunks should be in COMDAT groups
They can be emitted by multiple translation units and thus belong in a
COMDAT group.

llvm-svn: 226630
2015-01-21 01:21:31 +00:00
David Majnemer 3072fc885e MS ABI: Let guard variables be present in COMDATs
A guard variable in a COMDAT'd function should also be in a COMDAT.

llvm-svn: 226629
2015-01-21 01:04:30 +00:00
David Majnemer 740d59ec49 CodeGen: Compiler generated __declspec(uuid) objects should be COMDAT'd
llvm-svn: 226628
2015-01-21 01:04:28 +00:00
David Majnemer 1efd55ff21 Sema: err_after_alias is unreachable, remove it
Examples this would have catched are now handled by the attribute
verification code.

llvm-svn: 226626
2015-01-21 00:52:17 +00:00
Kaelyn Takata 21a886936b Correct all typos in the initialization arguments, even if one could not
be corrected.

This fixes PR22250, which exposed the bug where if there's more than one
TypoExpr in the arguments, once one failed to be corrected none of the
TypoExprs after it would be handled at all thanks to an early return.

llvm-svn: 226624
2015-01-21 00:04:19 +00:00
Ben Langmuir c91ac9ed49 Fix crashes on missing @interface for category
In a few places we didn't check that Category->getClassInterface() was
not null before using it.

llvm-svn: 226605
2015-01-20 20:41:36 +00:00
Kaelyn Takata e7d3dfdb75 Add the test that was supposed to be included with r223162.
The test case is based on the reduction from PR21679 and has to be
freestanding to work correctly, since some of the expected errors (and
some of the problems that were fixed) only occur when the end of the
file is reached.

llvm-svn: 226603
2015-01-20 20:15:29 +00:00
Hans Wennborg 77dc236605 Implement command line options for stack probe space
This code adds the -mstack-probe-size command line option and implements the /Gs
compiler switch for clang-cl.

This should fix http://llvm.org/bugs/show_bug.cgi?id=21896

Patch by Andrew H!

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

llvm-svn: 226601
2015-01-20 19:45:50 +00:00
Fariborz Jahanian 86dd4565ec Patch fixes PR21932 crash on invalid code. Using
property-dot syntax on 'super' with no super
class. Patch by Jason Haslam.

llvm-svn: 226578
2015-01-20 16:53:34 +00:00
Alexander Kornienko 21de0ae3d4 Re-apply "r226548 - Introduce SPIR calling conventions" reverted in r226558.
The test was fixed after a discussion with the revision author: the check
pattern was made more flexible as the "%call" part is not what we actually want
to check strictly there.

The original patch description:
===
Introduce SPIR calling conventions.

This implements Section 3.7 from the SPIR 1.2 spec:

    SPIR kernels should use "spir_kernel" calling convention.
    Non-kernel functions use "spir_func" calling convention. All
    other calling conventions are disallowed.

The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.
===

llvm-svn: 226561
2015-01-20 11:20:41 +00:00
Alexander Kornienko 22c9d67e34 Reverting r226548 as one of the tests fails in some configurations.
Here's the fail log from our internal setup:
===
  .../tools/clang/clang -cc1 -internal-isystem .../tools/clang/staging/include -nostdsysteminc .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl -triple spir-unknown-unknown -emit-llvm -o -
  FileCheck .../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl
.../tools/clang/test/CodeGenOpenCL/spir-calling-conv.cl:11:12: error: expected string not found in input
 // CHECK: %call = tail call spir_func i32 @get_dummy_id(i32 0)
           ^
<stdin>:6:52: note: scanning from here
define spir_kernel void @foo(i32 addrspace(1)* %A) #0 {
                                                   ^
<stdin>:7:2: note: possible intended match here
 %1 = tail call spir_func i32 @get_dummy_id(i32 0) #2
 ^
===

Here's a failure on a public CI server:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/1183/

llvm-svn: 226558
2015-01-20 10:55:33 +00:00
Alexey Bataev 42971a3342 [OPENMP] Fixed DSA processing for predetermined shared variables.
This patch allows to use predetermined shared variables in private clauses in
parallel or tasks regions.

llvm-svn: 226549
2015-01-20 07:03:46 +00:00
Sameer Sahasrabuddhe 450a58b8af Introduce SPIR calling conventions.
This implements Section 3.7 from the SPIR 1.2 spec:

    SPIR kernels should use "spir_kernel" calling convention.
    Non-kernel functions use "spir_func" calling convention. All
    other calling conventions are disallowed.

The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.

llvm-svn: 226548
2015-01-20 06:44:32 +00:00
Adam Nemet f893edeaea [AVX512] Add sub-vector FP extracts
Analogous to AVX2, these need to be implemented as macros to properly
propagate the immediate index operand.

Part of <rdar://problem/17688758>

llvm-svn: 226496
2015-01-19 20:12:05 +00:00
Adrian Prantl 7c6f944cdf Migrate all uses of DIVariable's FlagIndirectVariable to use a DIExpression
with a DW_OP_deref instead.

llvm-svn: 226474
2015-01-19 17:51:58 +00:00
Rafael Espindola f9b1730d41 Add comdat to thunks.
llvm-svn: 226465
2015-01-19 14:02:14 +00:00
Rafael Espindola 1be4c4546c Make this test a bit stricter. NFC.
llvm-svn: 226463
2015-01-19 13:59:31 +00:00
David Majnemer 6b90356ab4 Add back a check removed in r226436
It shouldn't have been removed, the code which replaced it didn't cover
this case.

llvm-svn: 226442
2015-01-19 10:21:22 +00:00