]> granicus.if.org Git - clang/log
clang
9 years agoInstrProf: This call does nothing, remove it
Justin Bogner [Fri, 1 May 2015 01:02:17 +0000 (01:02 +0000)]
InstrProf: This call does nothing, remove it

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236298 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstrProf: Support for setting profile output from command line
Justin Bogner [Thu, 30 Apr 2015 23:49:42 +0000 (23:49 +0000)]
InstrProf: Support for setting profile output from command line

This change is the third of 3 patches to add support for specifying
the profile output from the command line via -fprofile-instr-generate=<path>,
where the specified output path/file will be overridden by the
LLVM_PROFILE_FILE environment variable.

This patch adds the necessary support to the clang frontend, and adds a
new test.

The compiler-rt and llvm parts are r236055 and r236288, respectively.

Patch by Teresa Johnson. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236289 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMake macro dumping robust against a nonexistent macro.
Richard Smith [Thu, 30 Apr 2015 23:42:10 +0000 (23:42 +0000)]
Make macro dumping robust against a nonexistent macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236285 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix -Wpessimizing-move by removing call to std::move
Richard Trieu [Thu, 30 Apr 2015 23:13:52 +0000 (23:13 +0000)]
Fix -Wpessimizing-move by removing call to std::move

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236281 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Add a mechanism to dump information about a macro.
Richard Smith [Thu, 30 Apr 2015 23:10:40 +0000 (23:10 +0000)]
[modules] Add a mechanism to dump information about a macro.

Wire this up to "#pragma clang __debug macro <name>".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236280 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstrProf: Fix handling of profile counters in the body of range based for
Justin Bogner [Thu, 30 Apr 2015 22:58:28 +0000 (22:58 +0000)]
InstrProf: Fix handling of profile counters in the body of range based for

We were assigning the counter for the body of the loop to the loop
variable initialization for some reason here, but our tests completely
lacked coverage for range-for loops. This fixes that and makes the
logic generally more similar to the logic for a regular for.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236277 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-commit the test fix that went with r236274
Reid Kleckner [Thu, 30 Apr 2015 22:42:45 +0000 (22:42 +0000)]
Re-commit the test fix that went with r236274

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236276 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert most of r236271, leaving only the datalayout change in lib/Basic/Targets.cpp
Reid Kleckner [Thu, 30 Apr 2015 22:29:25 +0000 (22:29 +0000)]
Revert most of r236271, leaving only the datalayout change in lib/Basic/Targets.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236274 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUse 4 byte preferred aggregate alignment in datalayout on x86 Win32
Reid Kleckner [Thu, 30 Apr 2015 22:13:05 +0000 (22:13 +0000)]
Use 4 byte preferred aggregate alignment in datalayout on x86 Win32

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236271 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstrProf: Make sure coverage propagates out of foreach loops correctly
Justin Bogner [Thu, 30 Apr 2015 21:31:02 +0000 (21:31 +0000)]
InstrProf: Make sure coverage propagates out of foreach loops correctly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236264 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR19691: initialize MacroDirective::DefInfo::IsPublic member in "invalid" state.
Richard Smith [Thu, 30 Apr 2015 20:53:28 +0000 (20:53 +0000)]
PR19691: initialize MacroDirective::DefInfo::IsPublic member in "invalid" state.

No functionality change; no-one inspects this field yet, and probably no-one
will ever inspect it in the "invalid" state, but ubsan could be unhappy about
this if such a DefInfo is copied.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236256 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR22354: Add a test that we emit copy-ctors for captures in generic lambdas.
Richard Smith [Thu, 30 Apr 2015 20:51:03 +0000 (20:51 +0000)]
PR22354: Add a test that we emit copy-ctors for captures in generic lambdas.

The bug was fixed by r235921.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236254 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix the end location of init-capture annotations in ObjC++
Ben Langmuir [Thu, 30 Apr 2015 18:40:23 +0000 (18:40 +0000)]
Fix the end location of init-capture annotations in ObjC++

And thereby stop asserting.

In ObjC++ modes, we tentatively parse the lambda introducer twice: once
to disambiguate designators, which we also do in C++, and a second time
to disambiguate objc message expressions. During the second tentative
parse, the last cached token will be the annotation token we built in
the first parse. So use getLastLoc() to get the correct end location
for the rebuilt annotation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236246 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove some leftover debugging code.
David Majnemer [Thu, 30 Apr 2015 18:16:38 +0000 (18:16 +0000)]
Remove some leftover debugging code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236243 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't warn about use of deprecated API when the containing context is unavailable.
Jordan Rose [Thu, 30 Apr 2015 17:20:35 +0000 (17:20 +0000)]
Don't warn about use of deprecated API when the containing context is unavailable.

This probably won't come up much, but it seems tidier.

Related to rdar://problem/20713550

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236242 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoBatch up access-related diagnostics on enum constants until the whole enum is parsed.
Jordan Rose [Thu, 30 Apr 2015 17:20:30 +0000 (17:20 +0000)]
Batch up access-related diagnostics on enum constants until the whole enum is parsed.

That way we can take any trailing availability attributes into account.

rdar://problem/20713550

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236241 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MS ABI] Correctly make paths through covariant virtual bases
David Majnemer [Thu, 30 Apr 2015 17:15:48 +0000 (17:15 +0000)]
[MS ABI] Correctly make paths through covariant virtual bases

There can be multiple virtual bases which are on the path to a vfptr
when one vbase virtually inherits from another.  We should prefer the
most derived virtual base which covariantly overrides a method in the
vfptr class;  if we do not lengthen the path this way, we will end up
with too few vftable entries.

This fixes PR21073.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236239 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[AST] Fix some typos
David Majnemer [Thu, 30 Apr 2015 17:15:46 +0000 (17:15 +0000)]
[AST] Fix some typos

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236238 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAVX-512: Added AVX-512 intrinsics and tests
Elena Demikhovsky [Thu, 30 Apr 2015 09:24:29 +0000 (09:24 +0000)]
AVX-512: Added AVX-512 intrinsics and tests
by Asaf Badouh (asaf.badouh@intel.com)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236218 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Don't merge short else blocks.
Daniel Jasper [Thu, 30 Apr 2015 09:24:17 +0000 (09:24 +0000)]
clang-format: Don't merge short else blocks.

Before (with the appropriate flags settings):
  if (a) {
    f();
  } else { g(); }

Before (with other appropriate flags settings):
  if (a) { f(); } else {
    g();
  }

After:
  if (a) {
    f();
  } else {
    g();
  }

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236217 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Mark test as not compatible with MS Windows.
Alexey Bataev [Thu, 30 Apr 2015 08:35:10 +0000 (08:35 +0000)]
[OPENMP] Mark test as not compatible with MS Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236210 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'private' clause in 'task' directive.
Alexey Bataev [Thu, 30 Apr 2015 06:51:57 +0000 (06:51 +0000)]
[OPENMP] Codegen for 'private' clause in 'task' directive.

For tasks codegen for private/firstprivate variables are different rather than for other directives.

1. Build an internal structure of privates for each private variable:
struct .kmp_privates_t. {
  Ty1 var1;
  ...
  Tyn varn;
};
2. Add a new field to kmp_task_t type with list of privates.
struct kmp_task_t {
  void *              shareds;
  kmp_routine_entry_t routine;
  kmp_int32           part_id;
  kmp_routine_entry_t destructors;
  .kmp_privates_t.    privates;
};
3. Create a function with destructors calls for all privates after end of task region.
kmp_int32 .omp_task_destructor.(kmp_int32 gtid, kmp_task_t *tt) {
  ~Destructor(&tt->privates.var1);
  ...
  ~Destructor(&tt->privates.varn);
  return 0;
}
4. Perform default initialization of all private fields (no initialization for POD data, default constructor calls for classes) + provide address of a destructor function after kmpc_omp_task_alloc() and before kmpc_omp_task() calls.
kmp_task_t *new_task = __kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry);

DefaultConstructor(new_task->privates.var1);
new_task->shareds.var1_ref = &new_task->privates.var1;
...
DefaultConstructor(new_task->privates.varn);
new_task->shareds.varn_ref = &new_task->privates.varn;

new_task->destructors = .omp_task_destructor.;
kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *new_task)

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236207 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Allow to use global variables as lcv in loop-based directives.
Alexey Bataev [Thu, 30 Apr 2015 04:23:23 +0000 (04:23 +0000)]
[OPENMP] Allow to use global variables as lcv in loop-based directives.

For proper codegen we need to capture variable in the OpenMP region. In loop-based directives loop control variables are private by default and they must be captured in this region. There was a problem with capturing of globals, used as lcv, as they was not marked as private by default.
Differential Revision: http://reviews.llvm.org/D9336

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236201 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Fixed codegen for 'copyprivate' clause.
Alexey Bataev [Thu, 30 Apr 2015 03:47:32 +0000 (03:47 +0000)]
[OPENMP] Fixed codegen for 'copyprivate' clause.

Fixed initialization of 'single' region completion + changed type of the third argument of __kmpc_copyprivate() runtime function to size_t.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236198 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove dead code: a MacroDirective can't be imported or ambiguous any more.
Richard Smith [Thu, 30 Apr 2015 02:16:23 +0000 (02:16 +0000)]
Remove dead code: a MacroDirective can't be imported or ambiguous any more.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236197 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove XFAIL now that this test passes (fixed by r236184).
Richard Smith [Thu, 30 Apr 2015 01:15:19 +0000 (01:15 +0000)]
Remove XFAIL now that this test passes (fixed by r236184).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236194 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix use of uninitialized variable, found by ubsan selfhost.
Richard Smith [Thu, 30 Apr 2015 00:57:08 +0000 (00:57 +0000)]
Fix use of uninitialized variable, found by ubsan selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236191 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUse a more reliable method to determine whether
Sean Callanan [Thu, 30 Apr 2015 00:44:21 +0000 (00:44 +0000)]
Use a more reliable method to determine whether
a FileID corresponds to a real file or to a
memory buffer.  The old method didn't work when
Clang was built Release, which meant it wasn't
a very good method at all.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236188 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUpdate clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp to pass for targeting...
NAKAMURA Takumi [Wed, 29 Apr 2015 23:55:46 +0000 (23:55 +0000)]
Update clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp to pass for targeting i686.

r236155 missed the suffix in "@llvm.memcpy.p0i8.p0i8.i32".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236184 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd an assert to get information on buildbot failure.
Richard Smith [Wed, 29 Apr 2015 23:40:48 +0000 (23:40 +0000)]
Add an assert to get information on buildbot failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236181 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPropagate a terrible hack to the sparc target feature handling code
Eric Christopher [Wed, 29 Apr 2015 23:32:17 +0000 (23:32 +0000)]
Propagate a terrible hack to the sparc target feature handling code
by erasing the soft-float target feature if the rest of the front
end added it because of defaults or the soft float option.

Add some testing for some of the targets that implement this hack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236179 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix unused variable warning.
Richard Smith [Wed, 29 Apr 2015 23:26:13 +0000 (23:26 +0000)]
Fix unused variable warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236178 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Stop trying to fake up a linear MacroDirective history.
Richard Smith [Wed, 29 Apr 2015 23:20:19 +0000 (23:20 +0000)]
[modules] Stop trying to fake up a linear MacroDirective history.

Modules builds fundamentally have a non-linear macro history. In the interest
of better source fidelity, represent the macro definition information
faithfully: we have a linear macro directive history within each module, and at
any point we have a unique "latest" local macro directive and a collection of
visible imported directives. This also removes the attendent complexity of
attempting to create a correct MacroDirective history (which we got wrong
in the general case).

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236176 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoXFAIL Hexagon until more codegen in place.
Rick Foos [Wed, 29 Apr 2015 22:54:40 +0000 (22:54 +0000)]
XFAIL Hexagon until more codegen in place.

Summary:
Hexagon is being updated, but there is not enough to pass these tests.
These sections are now on top of Colin's list.

Test Plan: Ran changes on hexagon-build-03.

Reviewers: colinl, rfoos

Reviewed By: rfoos

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236173 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r236128, LLVM isn't falling back in the right way
Reid Kleckner [Wed, 29 Apr 2015 21:55:21 +0000 (21:55 +0000)]
Revert r236128, LLVM isn't falling back in the right way

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236167 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[opaque pointer type] update for LLVM API change
David Blaikie [Wed, 29 Apr 2015 21:22:47 +0000 (21:22 +0000)]
[opaque pointer type] update for LLVM API change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236161 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r236060, it caused PR23375.
Nico Weber [Wed, 29 Apr 2015 21:16:40 +0000 (21:16 +0000)]
Revert r236060, it caused PR23375.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236159 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoStop assuming a 64-bit target here.
Richard Smith [Wed, 29 Apr 2015 20:49:22 +0000 (20:49 +0000)]
Stop assuming a 64-bit target here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236155 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR23373: A defaulted union copy constructor that is not trivial must still be
Richard Smith [Wed, 29 Apr 2015 19:26:57 +0000 (19:26 +0000)]
PR23373: A defaulted union copy constructor that is not trivial must still be
emitted as a memcpy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236142 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r236063 due to regression with -fdelayed-template-parsing.
Richard Smith [Wed, 29 Apr 2015 17:48:08 +0000 (17:48 +0000)]
Revert r236063 due to regression with -fdelayed-template-parsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236134 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-land r236052, the linker errors were fixed by LLVM r236123
Reid Kleckner [Wed, 29 Apr 2015 17:17:17 +0000 (17:17 +0000)]
Re-land r236052, the linker errors were fixed by LLVM r236123

Basic __finally blocks don't cause linker errors anymore (although they
are miscompiled).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236128 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebug Info: Represent local anonymous unions as anonymous unions
Adrian Prantl [Wed, 29 Apr 2015 16:52:31 +0000 (16:52 +0000)]
Debug Info: Represent local anonymous unions as anonymous unions
and as artificial local variables in the debug info.

This is a follow-up to r236059. We can't get rid of the local variables
entirely because the gdb buildbot depends on them, but we can mark them
as artificial while still emitting the correct debug info. As I learned
from review comments other compilers also follow this model.

A paired commit in LLVM temporarily relaxes the debug info verifier to
not check the integrity of DW_OP_bit_pieces of artificial variables.

rdar://problem/20730771

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236125 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebugInfo: Metadata constructs now start with DI*
Duncan P. N. Exon Smith [Wed, 29 Apr 2015 16:40:08 +0000 (16:40 +0000)]
DebugInfo: Metadata constructs now start with DI*

LLVM r236120 renamed debug info IR constructs to use a `DI` prefix, now
that the `DIDescriptor` hierarchy has been gone for about a week.  This
commit was generated using the rename-md-di-nodes.sh upgrade script
attached to PR23080, followed by running clang-format-diff.py on the
`lib/` portion of the patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236121 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Debug Info: Represent local anonymous unions as anonymous unions"
Adrian Prantl [Wed, 29 Apr 2015 15:05:50 +0000 (15:05 +0000)]
Revert "Debug Info: Represent local anonymous unions as anonymous unions"

This reverts commit r236059 as it breaks the gdb buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236110 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert code changes made under r235976.
Bradley Smith [Wed, 29 Apr 2015 14:32:06 +0000 (14:32 +0000)]
Revert code changes made under r235976.

This issue was fixed elsewhere in r235396 in a more general way, hence these
changes no longer do anything. Keep the testcase however, to ensure that we
don't regress this for ARM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236104 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Add ability to align assignment operators.
Daniel Jasper [Wed, 29 Apr 2015 13:06:49 +0000 (13:06 +0000)]
clang-format: Add ability to align assignment operators.

In Objective-C some style guides use a style where assignment operators are
aligned, in an effort to increase code readability. This patch adds an option
to the format library which allows this functionality. It is disabled by
default for all the included styles, so it must be explicitly enabled.

The option will change code such as:
  - (void)method {
      NSNumber *one = @1;
      NSNumber *twentyFive = @25;
  }

to:
  - (void)method {
      NSNumber *one        = @1;
      NSNumber *twentyFive = @25;
  }

Patch by Matt Oakes. Thank you!

Accidentally reformatted all the tests...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236100 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Fix selective indentaiton in nested blocks.
Daniel Jasper [Wed, 29 Apr 2015 08:29:26 +0000 (08:29 +0000)]
clang-format: Fix selective indentaiton in nested blocks.

Buggy case:
  someFunction(
      [] {
        // comment
        int i; // invoke formatting here.
      },       // force line break
      aaa);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236091 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Fix crash on reductions codegen for short circuit reduction operations.
Alexey Bataev [Wed, 29 Apr 2015 05:21:03 +0000 (05:21 +0000)]
[OPENMP] Fix crash on reductions codegen for short circuit reduction operations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236084 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r236052, it caused linker errors when building 32-bit applications.
Nico Weber [Wed, 29 Apr 2015 03:08:32 +0000 (03:08 +0000)]
Revert r236052, it caused linker errors when building 32-bit applications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236082 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd -Wpessimizing-move and -Wredundant-move warnings.
Richard Trieu [Wed, 29 Apr 2015 01:52:17 +0000 (01:52 +0000)]
Add -Wpessimizing-move and -Wredundant-move warnings.

-Wpessimizing-move warns when a call to std::move would prevent copy elision
if the argument was not wrapped in a call.  This happens when moving a local
variable in a return statement when the variable is the same type as the
return type or using a move to create a new object from a temporary object.

-Wredundant-move warns when an implicit move would already be made, so the
std::move call is not needed, such as when moving a local variable in a return
that is different from the return type.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236075 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR20625: Instantiate static constexpr member function of a local struct in a function...
Richard Smith [Wed, 29 Apr 2015 00:07:09 +0000 (00:07 +0000)]
PR20625: Instantiate static constexpr member function of a local struct in a function template earlier.

This is necessary in order to allow the use of a constexpr member function, or
a member function with deduced return type, of a local class within a
surrounding instantiated function template specialization.

Patch by Michael Park!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236063 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoStop emitting the soft-float and soft-float-abi target features
Eric Christopher [Tue, 28 Apr 2015 23:18:33 +0000 (23:18 +0000)]
Stop emitting the soft-float and soft-float-abi target features
for ARM while the backend will only ignore them. No functional
change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236060 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebug Info: Represent local anonymous unions as anonymous unions
Adrian Prantl [Tue, 28 Apr 2015 23:01:24 +0000 (23:01 +0000)]
Debug Info: Represent local anonymous unions as anonymous unions
in the debug info. This patch deletes a hack that emits the members
of local anonymous unions as local variables.

Besides being morally wrong, the existing representation using local
variables breaks internal assumptions about the local variables' storage
size.

Compiling

```
   void fn1() {
     union {
       int i;
       char c;
     };
     i = c;
   }

```

with -g -O3 -verify will cause the verifier to fail after SROA splits
the 32-bit storage for the "local variable" c into two pieces because the
second piece is clearly outside the 8-bit range that is expected for a
variable of type char. Given the choice I'd rather fix the debug
representation than weaken the verifier.

Debuggers generally already know how to deal with anonymous unions when
they are members of C++ record types, but they may have problems finding
the local anonymous struct members in the expression evaluator.

rdar://problem/20730771

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236059 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix Sema tests using __try by adding triple
Reid Kleckner [Tue, 28 Apr 2015 22:58:25 +0000 (22:58 +0000)]
Fix Sema tests using __try by adding triple

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236057 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SEH] Add 32-bit lowering code for __try
Reid Kleckner [Tue, 28 Apr 2015 22:19:32 +0000 (22:19 +0000)]
[SEH] Add 32-bit lowering code for __try

This is just the clang-side of 32-bit SEH. LLVM still needs work, and it
will determinstically fail to compile until it's feature complete.

On x86, all outlined handlers have no parameters, but they do implicitly
take the EBP value passed in and use it to address locals of the parent
frame. We model this with llvm.frameaddress(1).

This works (mostly), but __finally block inlining can break it. For now,
we apply the 'noinline' attribute. If we really want to inline __finally
blocks on 32-bit x86, we should teach the inliner how to untangle
frameescape and framerecover.

Promote the error diagnostic from codegen to sema. It now rejects SEH on
non-Windows platforms. LLVM doesn't implement SEH on non-x86 Windows
platforms, but there's nothing preventing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236052 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix the typo in r236044. NFC.
Steven Wu [Tue, 28 Apr 2015 22:07:05 +0000 (22:07 +0000)]
Fix the typo in r236044. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236051 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix -fno-gnu-inline-asm doesn't catch file scope asm
Steven Wu [Tue, 28 Apr 2015 21:49:09 +0000 (21:49 +0000)]
Fix -fno-gnu-inline-asm doesn't catch file scope asm

Summary:
FileScopeAsm should be treated the same as funcion level inline asm.
-fno-gnu-inline-asm should trigger an error if file scope asm is used.
I missed this case from r226340. This should not affect ms-extension
because it is not allowed in the file scope.

Reviewers: bob.wilson, rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236044 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix assertion failure if a lambda array-capture is followed by a this capture.
Richard Smith [Tue, 28 Apr 2015 21:41:14 +0000 (21:41 +0000)]
Fix assertion failure if a lambda array-capture is followed by a this capture.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236043 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAttempt to fix the MSVC build by making ExprIterator
Sean Callanan [Tue, 28 Apr 2015 21:18:01 +0000 (21:18 +0000)]
Attempt to fix the MSVC build by making ExprIterator
inherit correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236035 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoWork around a suspected MSVC miscompile to try to bring the MSVC2013 buildbot back.
Richard Smith [Tue, 28 Apr 2015 21:09:27 +0000 (21:09 +0000)]
Work around a suspected MSVC miscompile to try to bring the MSVC2013 buildbot back.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236034 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor to make MacroState ownership and lifetime clearer.
Richard Smith [Tue, 28 Apr 2015 21:05:07 +0000 (21:05 +0000)]
Refactor to make MacroState ownership and lifetime clearer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236032 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[cuda] Preserve TLS storage class of host variable even if it's a
Artem Belevich [Tue, 28 Apr 2015 20:31:49 +0000 (20:31 +0000)]
[cuda] Preserve TLS storage class of host variable even if it's a
device-side compilation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236029 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoImplemented ASTImporter support for Stmts and fixed
Sean Callanan [Tue, 28 Apr 2015 18:41:46 +0000 (18:41 +0000)]
Implemented ASTImporter support for Stmts and fixed
some bugs in the ASTImporter that this exposed:

- When importing functions, the body (if any) was
  previously ignored.  This patch ensures that the
  body is imported also.

- When a function-local Decl is imported, the first
  thing the ASTImporter does is import its context
  (via ImportDeclParts()).  This can trigger
  importing the Decl again as part of the body of
  the function (but only once, since the function's
  Decl has been added to ImportedDecls).  This patch
  fixes that problem by extending ImportDeclParts()
  to return the imported Decl if it was imported as
  part of importing its context, and the patch adds
  ASTImporter::GetAlreadyImportedOrNull() to support
  this query.  All callers of ImportDeclParts return
  the imported version of the Decl if ImportDeclParts()
  returns it.

- When creating functions, InnerLocStart of the source
  function was re-used without importing.  This is a
  straight up bug, and this patch makes ASTImporter
  import the InnerLocStart and use the imported version.

- When importing FileIDs, the ASTImporter previously
  always tried to re-load the file for the corresponding
  CacheEntry from disk.  This doesn't work if the
  CacheEntry corresponds to a named memory buffer.  This
  patch changes the code so that if the UniqueID for the
  cache entry is invalid (i.e., it is not a disk file)
  the whole entry is treated as if it were invalid, which
  forces an in-memory copy of the buffer.

Also added test cases, using the new support committed in
236011.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236012 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoImplemented support for testing the ASTImporter's
Sean Callanan [Tue, 28 Apr 2015 18:24:12 +0000 (18:24 +0000)]
Implemented support for testing the ASTImporter's
ability to generate code that CodeGen likes.  Test
cases can use this functionality by calling

// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236011 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix typo in comment.
Nico Weber [Tue, 28 Apr 2015 18:19:18 +0000 (18:19 +0000)]
Fix typo in comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236010 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix PR22047: ObjC: Method unavailability attribute doesn't work with overloaded methods
Jonathan Roelofs [Tue, 28 Apr 2015 18:04:44 +0000 (18:04 +0000)]
Fix PR22047: ObjC: Method unavailability attribute doesn't work with overloaded methods

http://reviews.llvm.org/D9261

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236006 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCombine instantiation context of field initializer with context of class.
Serge Pavlov [Tue, 28 Apr 2015 17:58:47 +0000 (17:58 +0000)]
Combine instantiation context of field initializer with context of class.

Inclass initializer is instantiated in its own LocalInstantiationScope. It
causes problems when instantiating local classes - when instantiation scope
is searched for DeclContext of the field, the search fails. As a solution,
the instantiation scope of field initializer is combined with its outer
scope.

This patch fixes PR23194.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236005 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilencing a -Wuninitialized warning in a different way. This replaces r235981, but...
Aaron Ballman [Tue, 28 Apr 2015 17:34:38 +0000 (17:34 +0000)]
Silencing a -Wuninitialized warning in a different way. This replaces r235981, but is still NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236002 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAVX-512: added intrinsics for KNL and SKX
Elena Demikhovsky [Tue, 28 Apr 2015 13:28:01 +0000 (13:28 +0000)]
AVX-512: added intrinsics for KNL and SKX
by Asaf Badouh (asaf.badouh@intel.com)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235986 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Fix crash on loop control vars explicitly marked as private.
Alexey Bataev [Tue, 28 Apr 2015 13:20:05 +0000 (13:20 +0000)]
[OPENMP] Fix crash on loop control vars explicitly marked as private.

It is allowed to mark loop control vars as private in 'private' or 'lastprivate' clause, so no need to assert here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235985 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilencing a spurious -Wuninitialized warning with this local; NFC.
Aaron Ballman [Tue, 28 Apr 2015 12:36:54 +0000 (12:36 +0000)]
Silencing a spurious -Wuninitialized warning with this local; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235981 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM/AArch64] Enforce alignment for bitfielded structs
Bradley Smith [Tue, 28 Apr 2015 11:24:54 +0000 (11:24 +0000)]
[ARM/AArch64] Enforce alignment for bitfielded structs

When creating a global variable with a type of a struct with bitfields, we must
forcibly set the alignment of the global from the RecordDecl. We must do this so
that the proper bitfield alignment makes its way down to LLVM, since clang will
mangle the bitfields into one large type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235976 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstrProf: Match a bit less strictly - some targets may add signext
Justin Bogner [Tue, 28 Apr 2015 06:55:23 +0000 (06:55 +0000)]
InstrProf: Match a bit less strictly - some targets may add signext

Notably, this bot didn't like it:

  http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/5117

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235968 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstrProf: Mark code regions after throw expressions as unreachable
Justin Bogner [Tue, 28 Apr 2015 06:31:55 +0000 (06:31 +0000)]
InstrProf: Mark code regions after throw expressions as unreachable

We weren't setting regions as being unreachable after C++ throw
expressions, leading to incorrect count propagations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235967 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix memory leak found by asan buildbot.
Richard Smith [Tue, 28 Apr 2015 01:11:23 +0000 (01:11 +0000)]
Fix memory leak found by asan buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235957 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebugInfo: Add a clang test for LLVM fix for PR23332
Duncan P. N. Exon Smith [Tue, 28 Apr 2015 01:09:20 +0000 (01:09 +0000)]
DebugInfo: Add a clang test for LLVM fix for PR23332

Add a clang test for LLVM r235955, which added support for up to 2^16
arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235956 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAllow UBSan+MSan and UBSan+TSan combinations (Clang part).
Alexey Samsonov [Tue, 28 Apr 2015 00:56:36 +0000 (00:56 +0000)]
Allow UBSan+MSan and UBSan+TSan combinations (Clang part).

Embed UBSan runtime into TSan and MSan runtimes in the same as we do
in ASan. Extend UBSan test suite to also run tests for these
combinations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235953 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoms_struct does not imply the MS base-layout ABI; separate these
John McCall [Tue, 28 Apr 2015 00:17:18 +0000 (00:17 +0000)]
ms_struct does not imply the MS base-layout ABI; separate these
conditions in the IRGen struct layout code.

rdar://20636558

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235949 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: put these function declarations somewhere more appropriate.
Richard Smith [Mon, 27 Apr 2015 23:52:41 +0000 (23:52 +0000)]
Refactor: put these function declarations somewhere more appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235946 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Incrementally compute the list of overridden module macros based on
Richard Smith [Mon, 27 Apr 2015 23:21:38 +0000 (23:21 +0000)]
[modules] Incrementally compute the list of overridden module macros based on
the active module macros at the point of definition, rather than reconstructing
it from the macro history. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235941 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove stale FIXMEs from test case
Reid Kleckner [Mon, 27 Apr 2015 23:14:24 +0000 (23:14 +0000)]
Remove stale FIXMEs from test case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235937 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAlways add the target-cpu and target-features sets if they're non-null.
Eric Christopher [Mon, 27 Apr 2015 23:11:34 +0000 (23:11 +0000)]
Always add the target-cpu and target-features sets if they're non-null.
This makes sure that the front end is specific about what they're expecting
the backend to produce. Update a FIXME with the idea that the target-features
could be more precise using backend knowledge.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235936 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCheck whether the operand to a noexcept expression is valid or not. Fixes PR15842.
Aaron Ballman [Mon, 27 Apr 2015 22:31:12 +0000 (22:31 +0000)]
Check whether the operand to a noexcept expression is valid or not. Fixes PR15842.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235931 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIntroduce tsan_cxx and msan_cxx libraries (Clang part).
Alexey Samsonov [Mon, 27 Apr 2015 22:07:50 +0000 (22:07 +0000)]
Introduce tsan_cxx and msan_cxx libraries (Clang part).

For now tsan_cxx and msan_cxx contain only operator new/delete
replacements. In the future, when we add support for running UBSan+TSan
and UBSan+MSan, they will also contain bits ubsan_cxx runtime.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235924 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR23334: Perform semantic checking of lambda capture initialization in the right...
Richard Smith [Mon, 27 Apr 2015 21:27:54 +0000 (21:27 +0000)]
PR23334: Perform semantic checking of lambda capture initialization in the right context.

Previously we'd try to perform checks on the captures from the middle of
parsing the lambda's body, at the point where we detected that a variable
needed to be captured. This was wrong in a number of subtle ways. In
PR23334, we couldn't correctly handle the list of potential odr-uses
resulting from the capture, and our attempt to recover from that resulted
in a use-after-free.

We now defer building the initialization expression until we leave the lambda
body and return to the enclosing context, where the initialization does the
right thing. This patch only covers lambda-expressions, but we should apply
the same change to blocks and captured statements too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235921 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "PR21000: pass -I options to assembler" as the test was failing on hexagon.
Artem Belevich [Mon, 27 Apr 2015 21:11:08 +0000 (21:11 +0000)]
Revert "PR21000: pass -I options to assembler" as the test was failing on hexagon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235919 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR21000: pass -I options to assembler
Artem Belevich [Mon, 27 Apr 2015 20:51:44 +0000 (20:51 +0000)]
PR21000: pass -I options to assembler

Pass -I options to assembly so it can find files included with
.include.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235915 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplify depfile quoting test.
Paul Robinson [Mon, 27 Apr 2015 19:40:04 +0000 (19:40 +0000)]
Simplify depfile quoting test.

With -MG we don't actually need to create the files with funky names.
Also use a more sensible check-prefix for the NMAKE case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235908 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[cuda] Ignore "TLS unsupported by target" errors for host variables during device...
Artem Belevich [Mon, 27 Apr 2015 19:37:53 +0000 (19:37 +0000)]
[cuda] Ignore "TLS unsupported by target" errors for host variables during device compilation.

During device-side CUDA compilation clang currently complains about
all TLS variables, regardless of whether they are __host__ or
__device__.

This patch suppresses "TLS unsupported" errors for host variables
during device compilation and for device variables during host
compilation.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235907 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[cuda] treat file scope __asm as __host__ and ignore it during device-side compilation.
Artem Belevich [Mon, 27 Apr 2015 18:52:00 +0000 (18:52 +0000)]
[cuda] treat file scope __asm as __host__ and ignore it during device-side compilation.

Currently clang emits file-scope asm during *both* host and device
compilation modes which is usually a wrong thing to do.

There's no way to attach any attribute to an __asm statement, so
there's no way to differentiate between host-side and device-side
file-scope asm.  This patch makes clang to match nvcc behavior and
emit file-scope-asm only during host-side compilation.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235905 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSupport generating NMake/Jom-style depfiles.
Paul Robinson [Mon, 27 Apr 2015 18:14:32 +0000 (18:14 +0000)]
Support generating NMake/Jom-style depfiles.

NMake is a Make-like builder that comes with Microsoft Visual Studio.
Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool.
Dependency files for NMake/Jom need to use double-quotes to wrap
filespecs containing special characters, instead of the backslash
escapes that GNU Make wants.

Adds the -MV option, which specifies to use double-quotes as needed
instead of backslash escapes when writing the dependency file.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235903 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MS ABI] Use 'continue' instead of 'return false' where intended
Reid Kleckner [Mon, 27 Apr 2015 17:19:49 +0000 (17:19 +0000)]
[MS ABI] Use 'continue' instead of 'return false' where intended

This was a bug in r218285 that prevented us from seeing subsequent
virtual bases in the class hierarchy, leading to crashes later.

Also add some comments to this function, now that we better understand
what it's trying to do.

Fixes PR21062 and PR21064.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235899 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Simplified iteration over clauses, NFC.
Alexey Bataev [Mon, 27 Apr 2015 08:00:32 +0000 (08:00 +0000)]
[OPENMP] Simplified iteration over clauses, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235838 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'taskwait' directive.
Alexey Bataev [Mon, 27 Apr 2015 05:22:09 +0000 (05:22 +0000)]
[OPENMP] Codegen for 'taskwait' directive.

Emit the following code for 'taskwait' directive within tied task:
call i32 @__kmpc_omp_taskwait(<loc>, i32 <thread_id>);
Differential Revision: http://reviews.llvm.org/D9245

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235836 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'reduction' clause in 'sections' directive.
Alexey Bataev [Mon, 27 Apr 2015 05:04:13 +0000 (05:04 +0000)]
[OPENMP] Codegen for 'reduction' clause in 'sections' directive.

Emit a code for reduction clause. Next code should be emitted for reductions:

static kmp_critical_name lock = { 0 };

void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
    *(Type0*)lhs[0] = ReductionOperation0(*(Type0*)lhs[0], *(Type0*)rhs[0]);
      ...
        *(Type<n>-1*)lhs[<n>-1] =
          ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1],
            *(Type<n>-1*)rhs[<n>-1]);
}

...
void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
  <LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]);
  ...
  <LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]);
  __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
  break;
case 2:
  Atomic(<LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]));
  ...
  Atomic(<LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]));
  break;
default:;
}
Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation.
If sections directive has only single section, then original shared variables are used instead with barrier at the end of the directive.
Differential Revision: http://reviews.llvm.org/D9242

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235835 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'lastprivate' clause in 'sections' directive.
Alexey Bataev [Mon, 27 Apr 2015 04:34:03 +0000 (04:34 +0000)]
[OPENMP] Codegen for 'lastprivate' clause in 'sections' directive.

#pragma omp sections lastprivate(<var>)
<BODY>;
This construct is translated into something like:

<last_iter> = alloca i32
<init for lastprivates>;
<last_iter> = 0
; No initializer for simple variables or a default constructor is called for objects.
; For arrays perform element by element initialization by the call of the default constructor.
...
OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration.
<BODY>
...
OMP_FOR_END
if (<last_iter> != 0) {
  <final copy for lastprivate>; Update original variable with the lastprivate value.
}
call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race.
If there is only one section, there is no special code generation, original shared variables are used + barrier is emitted at the end of the directive.
Differential Revision: http://reviews.llvm.org/D9240

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235834 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'private' clause in 'sections' directive.
Alexey Bataev [Mon, 27 Apr 2015 04:12:12 +0000 (04:12 +0000)]
[OPENMP] Codegen for 'private' clause in 'sections' directive.

If there are 2 or more sections in a 'section' directive the following code is generated:

<default init for privates>
@__kmpc_for_static_init_4();
<BODY for sections directive>
@__kmpc_for_static_fini()
If there is only one section, the following code is generated:

if (@__kmpc_single()) {
  <default init for privates>
  @__kmpc_end_single();
}
Differential Revision: http://reviews.llvm.org/D9239

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235833 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'private' clause in 'single' directive.
Alexey Bataev [Mon, 27 Apr 2015 03:48:52 +0000 (03:48 +0000)]
[OPENMP] Codegen for 'private' clause in 'single' directive.
Emit the following code for 'single' directive with 'private' clause:

if (@__kmpc_single()) {
  <default init for privates>
  @__kmpc_end_single();
}
Differential Revision: http://reviews.llvm.org/D9238

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235832 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MS ABI] Rephrase the mangling of array types in parameters
David Majnemer [Mon, 27 Apr 2015 03:07:47 +0000 (03:07 +0000)]
[MS ABI] Rephrase the mangling of array types in parameters

Make the canonicalization of array types more consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235831 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Sema] Do not permit binding a reference to a compound literal
David Majnemer [Sun, 26 Apr 2015 07:35:03 +0000 (07:35 +0000)]
[Sema] Do not permit binding a reference to a compound literal

We could probably make this work if we cared enough.  However, we are
far outside any language rules at this point.

This fixes PR21834.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235818 91177308-0d34-0410-b5e6-96231b3b80d8