[llvm-branch-commits] [cfe-branch] r286964 - Merging r284110:
Author: abataev
Date: Tue Nov 15 08:12:57 2016
New Revision: 286964
URL: http://llvm.org/viewvc/llvm-project?rev=286964&view=rev
Log:
Merging r284110:
r284110 | abataev | 2016-10-13 09:52:46 + (Thu, 13 Oct 2016) | 9 lines
Fix for PR30639: CGDebugInfo Null dereference with OpenMP array
access, by Erich Keane
OpenMP creates a variable array type with a a null size-expr. The Debug
generation failed to due to this. This patch corrects the openmp
implementation, updates the tests, and adds a new one for this
condition.
Differential Revision: https://reviews.llvm.org/D25373
Added:
cfe/branches/release_39/test/OpenMP/debug-info-openmp-array.cpp
- copied unchanged from r284110,
cfe/trunk/test/OpenMP/debug-info-openmp-array.cpp
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/lib/CodeGen/CGExpr.cpp
cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp
cfe/branches/release_39/test/OpenMP/for_reduction_codegen.cpp
cfe/branches/release_39/test/OpenMP/for_reduction_codegen_UDR.cpp
cfe/branches/release_39/test/OpenMP/parallel_codegen.cpp
cfe/branches/release_39/test/OpenMP/target_firstprivate_codegen.cpp
cfe/branches/release_39/test/OpenMP/target_map_codegen.cpp
Propchange: cfe/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 15 08:12:57 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/lib/CodeGen/CGExpr.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGExpr.cpp?rev=286964&r1=286963&r2=286964&view=diff
==
--- cfe/branches/release_39/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CGExpr.cpp Tue Nov 15 08:12:57 2016
@@ -2105,12 +2105,11 @@ LValue CodeGenFunction::EmitDeclRefLValu
if (auto *FD = LambdaCaptureFields.lookup(VD))
return EmitCapturedFieldLValue(*this, FD, CXXABIThisValue);
else if (CapturedStmtInfo) {
-auto it = LocalDeclMap.find(VD);
-if (it != LocalDeclMap.end()) {
- if (auto RefTy = VD->getType()->getAs()) {
-return EmitLoadOfReferenceLValue(it->second, RefTy);
- }
- return MakeAddrLValue(it->second, T);
+auto I = LocalDeclMap.find(VD);
+if (I != LocalDeclMap.end()) {
+ if (auto RefTy = VD->getType()->getAs())
+return EmitLoadOfReferenceLValue(I->second, RefTy);
+ return MakeAddrLValue(I->second, T);
}
LValue CapLVal =
EmitCapturedFieldLValue(*this, CapturedStmtInfo->lookup(VD),
Modified: cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp?rev=286964&r1=286963&r2=286964&view=diff
==
--- cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp Tue Nov 15 08:12:57
2016
@@ -232,8 +232,15 @@ CodeGenFunction::GenerateOpenMPCapturedS
assert(I->capturesVariableArrayType());
II = &getContext().Idents.get("vla");
}
-if (ArgType->isVariablyModifiedType())
- ArgType = getContext().getVariableArrayDecayedType(ArgType);
+if (ArgType->isVariablyModifiedType()) {
+ bool IsReference = ArgType->isLValueReferenceType();
+ ArgType =
+ getContext().getCanonicalParamType(ArgType.getNonReferenceType());
+ if (IsReference && !ArgType->isPointerType()) {
+ArgType = getContext().getLValueReferenceType(
+ArgType, /*SpelledAsLValue=*/false);
+ }
+}
Args.push_back(ImplicitParamDecl::Create(getContext(), nullptr,
FD->getLocation(), II, ArgType));
++I;
@@ -287,8 +294,14 @@ CodeGenFunction::GenerateOpenMPCapturedS
QualType VarTy = Var->getType();
Address ArgAddr = ArgLVal.getAddress();
if (!VarTy->isReferenceType()) {
-ArgAddr = EmitLoadOfReference(
-ArgAddr, A
[llvm-branch-commits] [cfe-branch] r286970 - Merging r284229:
Author: abataev
Date: Tue Nov 15 08:30:48 2016
New Revision: 286970
URL: http://llvm.org/viewvc/llvm-project?rev=286970&view=rev
Log:
Merging r284229:
r284229 | abataev | 2016-10-14 12:43:59 + (Fri, 14 Oct 2016) | 37 lines
Fix for PR30632: Name mangling issue.
There was a bug in the implementation of captured statements. If it has
a lambda expression in it and the same lambda expression is used outside
the captured region, clang produced an error:
```
error: definition with same mangled name as another definition
```
Here is an example:
```
struct A {
template
void g(const L&) { }
};
template
void f() {
{
A().g([](){});
}
A().g([](){});
}
int main() {
f();
}
```
Error report:
```
main.cpp:3:10: error: definition with same mangled name as another
definition
void g(const L&) { }
^
main.cpp:3:10: note: previous definition is here
```
Patch fixes this bug.
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/lib/Sema/SemaLambda.cpp
cfe/branches/release_39/test/CodeGenCXX/captured-statements.cpp
cfe/branches/release_39/test/OpenMP/for_lastprivate_codegen.cpp
cfe/branches/release_39/test/OpenMP/target_map_codegen.cpp
Propchange: cfe/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 15 08:30:48 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584,286944
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,284229,286103,286106,286129,286584,286944,286953
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/lib/Sema/SemaLambda.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Sema/SemaLambda.cpp?rev=286970&r1=286969&r2=286970&view=diff
==
--- cfe/branches/release_39/lib/Sema/SemaLambda.cpp (original)
+++ cfe/branches/release_39/lib/Sema/SemaLambda.cpp Tue Nov 15 08:30:48 2016
@@ -314,18 +314,21 @@ Sema::getCurrentMangleNumberContext(cons
bool IsInNonspecializedTemplate =
!ActiveTemplateInstantiations.empty() || CurContext->isDependentContext();
switch (Kind) {
- case Normal:
+ case Normal: {
// -- the bodies of non-exported nonspecialized template functions
// -- the bodies of inline functions
if ((IsInNonspecializedTemplate &&
!(ManglingContextDecl && isa(ManglingContextDecl))) ||
isInInlineFunction(CurContext)) {
ManglingContextDecl = nullptr;
+ while (auto *CD = dyn_cast(DC))
+DC = CD->getParent();
return &Context.getManglingNumberContext(DC);
}
ManglingContextDecl = nullptr;
return nullptr;
+ }
case StaticDataMember:
// -- the initializers of nonspecialized static members of template
classes
Modified: cfe/branches/release_39/test/CodeGenCXX/captured-statements.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/CodeGenCXX/captured-statements.cpp?rev=286970&r1=286969&r2=286970&view=diff
==
--- cfe/branches/release_39/test/CodeGenCXX/captured-statements.cpp (original)
+++ cfe/branches/release_39/test/CodeGenCXX/captured-statements.cpp Tue Nov 15
08:30:48 2016
@@ -78,6 +78,7 @@ void test3(int x) {
{
x = [=]() { return x + 1; } ();
}
+ x = [=]() { return x + 1; }();
// CHECK-3: %[[Capture:struct\.anon[\.0-9]*]] = type { i32* }
Modified: cfe/branches/release_39/test/OpenMP/for_lastprivate_codegen.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/for_lastprivate_codegen.cpp?rev=286970&r1=286969&r2=286970&view=diff
==
--- cfe/branches/release_39/test/OpenMP/for_lastprivate_codegen.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/for_lastprivate_codegen.cpp Tue Nov 15
08:30:48 2016
@@ -41,7 +41,7 @@ struct SS {
for (a = 0; a < 2; ++a)
#ifdef LAMBDA
[&]() {
-++this->a, --b, (this)->c /= 1;
+--this->a, ++b, (this)->c *= 2;
#pragma omp parallel
#pragma omp for lastprivate(b)
for (b = 0; b < 2; ++b)
@@ -190,7 +190,7 @@ int main() {
// LAMBDA: call
[llvm-branch-commits] [cfe-branch] r286965 - Merging r286129:
Author: abataev
Date: Tue Nov 15 08:15:56 2016
New Revision: 286965
URL: http://llvm.org/viewvc/llvm-project?rev=286965&view=rev
Log:
Merging r286129:
r286129 | abataev | 2016-11-07 18:15:02 + (Mon, 07 Nov 2016) | 8 lines
[OPENMP] Fixed codegen for __real/__imag expressions in atomic
constructs.
For __real/__imag unary expressions clang emits lvalue with the
associated type from the original complex expression, but not the
underlying builtin integer or float type. This causes crash in codegen
for atomic constructs, if __real/__imag expression are used in atomic
constructs.
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/lib/CodeGen/CGExpr.cpp
cfe/branches/release_39/test/OpenMP/atomic_write_codegen.c
Propchange: cfe/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 15 08:15:56 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/lib/CodeGen/CGExpr.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGExpr.cpp?rev=286965&r1=286964&r2=286965&view=diff
==
--- cfe/branches/release_39/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CGExpr.cpp Tue Nov 15 08:15:56 2016
@@ -2248,13 +2248,15 @@ LValue CodeGenFunction::EmitUnaryOpLValu
return LV;
}
-assert(E->getSubExpr()->getType()->isAnyComplexType());
+QualType T = ExprTy->castAs()->getElementType();
Address Component =
(E->getOpcode() == UO_Real
? emitAddrOfRealComponent(LV.getAddress(), LV.getType())
: emitAddrOfImagComponent(LV.getAddress(), LV.getType()));
-return MakeAddrLValue(Component, ExprTy, LV.getAlignmentSource());
+LValue ElemLV = MakeAddrLValue(Component, T, LV.getAlignmentSource());
+ElemLV.getQuals().addQualifiers(LV.getQuals());
+return ElemLV;
}
case UO_PreInc:
case UO_PreDec: {
Modified: cfe/branches/release_39/test/OpenMP/atomic_write_codegen.c
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/atomic_write_codegen.c?rev=286965&r1=286964&r2=286965&view=diff
==
--- cfe/branches/release_39/test/OpenMP/atomic_write_codegen.c (original)
+++ cfe/branches/release_39/test/OpenMP/atomic_write_codegen.c Tue Nov 15
08:15:56 2016
@@ -78,6 +78,9 @@ float2 float2x;
register int rix __asm__("esp");
int main() {
+// CHECK: store atomic i32 1, i32* getelementptr inbounds ({ i32, i32 }, {
i32, i32 }* @civ, i32 0, i32 1) monotonic,
+#pragma omp atomic write
+ __imag(civ) = 1;
// CHECK: load i8, i8*
// CHECK: store atomic i8
#pragma omp atomic write
___
llvm-branch-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [cfe-branch] r286966 - Merging r286584:
Author: abataev
Date: Tue Nov 15 08:23:10 2016
New Revision: 286966
URL: http://llvm.org/viewvc/llvm-project?rev=286966&view=rev
Log:
Merging r286584:
r286584 | abataev | 2016-11-11 12:36:20 + (Fri, 11 Nov 2016) | 31 lines
Fix for PR28523: unexpected compilation error.
Clang emits error message for the following code:
```
template void parallel_loop(F &&f) { f(0); }
int main() {
int x;
parallel_loop([&](auto y) {
{
x = y;
};
});
}
```
$ clang++ --std=gnu++14 clang_test.cc -o clang_test
clang_test.cc:9:7: error: reference to local variable 'x' declared in enclosing
function 'main'
x = y;
^
clang_test.cc:2:48: note: in instantiation of function template specialization
'main()::(anonymous class)::operator()' requested here
template void parallel_loop(F &&f) { f(0); }
^
clang_test.cc:6:3: note: in instantiation of function template specialization
'parallel_loop<(lambda at clang_test.cc:6:17)>' requested here
parallel_loop([&](auto y) {
^
clang_test.cc:5:7: note: 'x' declared here
int x;
^
1 error generated.
Patch fixes this issue.
Added:
cfe/branches/release_39/test/CodeGenCXX/PR28523.cpp
- copied unchanged from r286584, cfe/trunk/test/CodeGenCXX/PR28523.cpp
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/include/clang/Sema/Sema.h
cfe/branches/release_39/lib/Sema/Sema.cpp
cfe/branches/release_39/lib/Sema/SemaExpr.cpp
cfe/branches/release_39/lib/Sema/SemaExprCXX.cpp
cfe/branches/release_39/lib/Sema/SemaLambda.cpp
Propchange: cfe/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 15 08:23:10 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/include/clang/Sema/Sema.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/include/clang/Sema/Sema.h?rev=286966&r1=286965&r2=286966&view=diff
==
--- cfe/branches/release_39/include/clang/Sema/Sema.h (original)
+++ cfe/branches/release_39/include/clang/Sema/Sema.h Tue Nov 15 08:23:10 2016
@@ -1218,8 +1218,10 @@ public:
/// \brief Retrieve the current block, if any.
sema::BlockScopeInfo *getCurBlock();
- /// \brief Retrieve the current lambda scope info, if any.
- sema::LambdaScopeInfo *getCurLambda();
+ /// Retrieve the current lambda scope info, if any.
+ /// \param IgnoreCapturedRegions true if should find the top-most lambda
scope
+ /// info ignoring all inner captured regions scope infos.
+ sema::LambdaScopeInfo *getCurLambda(bool IgnoreCapturedRegions = false);
/// \brief Retrieve the current generic lambda info, if any.
sema::LambdaScopeInfo *getCurGenericLambda();
Modified: cfe/branches/release_39/lib/Sema/Sema.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Sema/Sema.cpp?rev=286966&r1=286965&r2=286966&view=diff
==
--- cfe/branches/release_39/lib/Sema/Sema.cpp (original)
+++ cfe/branches/release_39/lib/Sema/Sema.cpp Tue Nov 15 08:23:10 2016
@@ -1197,11 +1197,19 @@ BlockScopeInfo *Sema::getCurBlock() {
return CurBSI;
}
-LambdaScopeInfo *Sema::getCurLambda() {
+LambdaScopeInfo *Sema::getCurLambda(bool IgnoreCapturedRegions) {
if (FunctionScopes.empty())
return nullptr;
- auto CurLSI = dyn_cast(FunctionScopes.back());
+ auto I = FunctionScopes.rbegin();
+ if (IgnoreCapturedRegions) {
+auto E = FunctionScopes.rend();
+while (I != E && isa(*I))
+ ++I;
+if (I == E)
+ return nullptr;
+ }
+ auto *CurLSI = dyn_cast(*I);
if (CurLSI && CurLSI->Lambda &&
!CurLSI->Lambda->Encloses(CurContext)) {
// We have switched contexts due to template instantiation.
Modified: cfe/branches/release_39/lib/Sema/SemaExpr.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Sema/SemaExpr.cpp?rev=286966&r1=286965&r2=286966&view=diff
===
[llvm-branch-commits] [cfe-branch] r286972 - Merging r283223:
Author: abataev
Date: Tue Nov 15 08:44:21 2016
New Revision: 286972
URL: http://llvm.org/viewvc/llvm-project?rev=286972&view=rev
Log:
Merging r283223:
r283223 | davidsh | 2016-10-04 10:41:36 -0400 (Tue, 04 Oct 2016) | 1 line
[OpenMP] fix segfault when a variable referenced in reduction clause is a
reference parameter
Differential Revision: http://reviews.llvm.org/D24524
Modified:
cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/for_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/for_simd_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/parallel_for_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/parallel_for_simd_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/parallel_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/parallel_sections_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/sections_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/simd_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/target_parallel_for_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/target_parallel_reduction_messages.cpp
cfe/branches/release_39/test/OpenMP/teams_reduction_messages.cpp
Modified: cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp?rev=286972&r1=286971&r2=286972&view=diff
==
--- cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp Tue Nov 15 08:44:21 2016
@@ -9133,7 +9133,7 @@ OMPClause *Sema::ActOnOpenMPReductionCla
// for all threads of the team.
if (!ASE && !OASE && VD) {
VarDecl *VDDef = VD->getDefinition();
- if (VD->getType()->isReferenceType() && VDDef) {
+ if (VD->getType()->isReferenceType() && VDDef && VDDef->hasInit()) {
DSARefChecker Check(DSAStack);
if (Check.Visit(VDDef->getInit())) {
Diag(ELoc, diag::err_omp_reduction_ref_type_arg) << ERange;
Modified:
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==
---
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp
(original)
+++
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp
Tue Nov 15 08:44:21 2016
@@ -9,6 +9,14 @@ bool foobool(int argc) {
return argc;
}
+void foobar(int &ref) {
+#pragma omp target
+#pragma omp teams
+#pragma omp distribute parallel for reduction(+:ref)
+ for (int i = 0; i < 10; ++i)
+foo();
+}
+
struct S1; // expected-note {{declared here}} expected-note 4 {{forward
declaration of 'S1'}}
extern S1 a;
class S2 {
Modified:
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==
---
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp
(original)
+++
cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp
Tue Nov 15 08:44:21 2016
@@ -9,6 +9,14 @@ bool foobool(int argc) {
return argc;
}
+void foobar(int &ref) {
+#pragma omp target
+#pragma omp teams
+#pragma omp distribute parallel for simd reduction(+:ref)
+ for (int i = 0; i < 10; ++i)
+foo();
+}
+
struct S1; // expected-note {{declared here}} expected-note 4 {{forward
declaration of 'S1'}}
extern S1 a;
class S2 {
Modified:
cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==
--- cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp
(original)
+++ cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp
Tue Nov 15 08:44:21 2016
@@ -9,6 +9,14 @@ bool foobool(int argc) {
return argc;
}
+void foobar(int &ref) {
+#pragma omp target
+#pragma omp teams
+#pragma omp distribute simd r
[llvm-branch-commits] [cfe-branch] r286968 - Merging r286944:
Author: abataev
Date: Tue Nov 15 08:26:49 2016
New Revision: 286968
URL: http://llvm.org/viewvc/llvm-project?rev=286968&view=rev
Log:
Merging r286944:
r286944 | abataev | 2016-11-15 09:11:50 + (Tue, 15 Nov 2016) | 6 lines
[OPENMP] Fixed codegen for 'omp cancel' construct.
If 'omp cancel' construct is used in a worksharing construct it may cause
hanging of the software in case if reduction clause is used. Patch fixes
this problem by avoiding extra reduction processing for branches that
were canceled.
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp
cfe/branches/release_39/lib/CodeGen/CodeGenFunction.h
cfe/branches/release_39/test/OpenMP/cancel_codegen.cpp
Propchange: cfe/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 15 08:26:49 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584,286944
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp?rev=286968&r1=286967&r2=286968&view=diff
==
--- cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp Tue Nov 15 08:26:49
2016
@@ -1767,9 +1767,17 @@ void CodeGenFunction::EmitOMPOuterLoop(b
EmitBlock(LoopExit.getBlock());
// Tell the runtime we are done.
- if (!DynamicOrOrdered)
-RT.emitForStaticFinish(*this, S.getLocEnd());
+ SourceLocation ELoc = S.getLocEnd();
+ auto &&CodeGen = [DynamicOrOrdered, ELoc](CodeGenFunction &CGF) {
+if (!DynamicOrOrdered)
+ CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
+ };
+ CodeGen(*this);
+ OpenMPDirectiveKind DKind = S.getDirectiveKind();
+ if (DKind == OMPD_for || DKind == OMPD_parallel_for ||
+ DKind == OMPD_distribute_parallel_for)
+OMPCancelStack.back().CodeGen = CodeGen;
}
void CodeGenFunction::EmitOMPForOuterLoop(
@@ -1881,6 +1889,7 @@ void CodeGenFunction::EmitOMPDistributeO
void CodeGenFunction::EmitOMPDistributeParallelForDirective(
const OMPDistributeParallelForDirective &S) {
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+ OMPCancelStackRAII CancelRegion(*this);
CGM.getOpenMPRuntime().emitInlinedDirective(
*this, OMPD_distribute_parallel_for,
[&S](CodeGenFunction &CGF, PrePostActionTy &) {
@@ -2073,7 +2082,15 @@ bool CodeGenFunction::EmitOMPWorksharing
[](CodeGenFunction &) {});
EmitBlock(LoopExit.getBlock());
// Tell the runtime we are done.
-RT.emitForStaticFinish(*this, S.getLocStart());
+SourceLocation ELoc = S.getLocEnd();
+auto &&CodeGen = [ELoc](CodeGenFunction &CGF) {
+ CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
+};
+CodeGen(*this);
+OpenMPDirectiveKind DKind = S.getDirectiveKind();
+if (DKind == OMPD_for || DKind == OMPD_parallel_for ||
+DKind == OMPD_distribute_parallel_for)
+ OMPCancelStack.back().CodeGen = CodeGen;
} else {
const bool IsMonotonic =
Ordered || ScheduleKind.Schedule == OMPC_SCHEDULE_static ||
@@ -2127,6 +2144,7 @@ void CodeGenFunction::EmitOMPForDirectiv
};
{
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
+OMPCancelStackRAII CancelRegion(*this);
CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_for, CodeGen,
S.hasCancel());
}
@@ -2263,7 +2281,12 @@ void CodeGenFunction::EmitSections(const
CGF.EmitOMPInnerLoop(S, /*RequiresCleanup=*/false, &Cond, &Inc, BodyGen,
[](CodeGenFunction &) {});
// Tell the runtime we are done.
-CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, S.getLocStart());
+SourceLocation ELoc = S.getLocEnd();
+auto &&CodeGen = [ELoc](CodeGenFunction &CGF) {
+ CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
+};
+CodeGen(CGF);
+C
Re: [llvm-branch-commits] [cfe-branch] r286968 - Merging r286944:
Alexey, this patch is likely the cause of http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/197/steps/check-clang%20asan/logs/stdio On Tue, Nov 15, 2016 at 8:59 AM Alexey Bataev via llvm-branch-commits < [email protected]> wrote: > Author: abataev > Date: Tue Nov 15 08:26:49 2016 > New Revision: 286968 > > URL: http://llvm.org/viewvc/llvm-project?rev=286968&view=rev > Log: > Merging r286944: > > r286944 | abataev | 2016-11-15 09:11:50 + (Tue, 15 Nov 2016) | 6 lines > > [OPENMP] Fixed codegen for 'omp cancel' construct. > > If 'omp cancel' construct is used in a worksharing construct it may cause > hanging of the software in case if reduction clause is used. Patch fixes > this problem by avoiding extra reduction processing for branches that > were canceled. > > > Modified: > cfe/branches/release_39/ (props changed) > cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp > cfe/branches/release_39/lib/CodeGen/CodeGenFunction.h > cfe/branches/release_39/test/OpenMP/cancel_codegen.cpp > > Propchange: cfe/branches/release_39/ > > -- > --- svn:mergeinfo (original) > +++ svn:mergeinfo Tue Nov 15 08:26:49 2016 > @@ -1,4 +1,4 @@ > /cfe/branches/type-system-rewrite:134693-134817 > > -/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584 > > +/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584,286944 > /cfe/trunk/test:170344 > /cfe/trunk/test/SemaTemplate:126920 > > Modified: cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp?rev=286968&r1=286967&r2=286968&view=diff > > == > --- cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp (original) > +++ cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp Tue Nov 15 > 08:26:49 2016 > @@ -1767,9 +1767,17 @@ void CodeGenFunction::EmitOMPOuterLoop(b >EmitBlock(LoopExit.getBlock()); > >// Tell the runtime we are done. > - if (!DynamicOrOrdered) > -RT.emitForStaticFinish(*this, S.getLocEnd()); > + SourceLocation ELoc = S.getLocEnd(); > + auto &&CodeGen = [DynamicOrOrdered, ELoc](CodeGenFunction &CGF) { > +if (!DynamicOrOrdered) > + CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc); > + }; > + CodeGen(*this); > > + OpenMPDirectiveKind DKind = S.getDirectiveKind(); > + if (DKind == OMPD_for || DKind == OMPD_parallel_for || > + DKind == OMPD_distribute_parallel_for) > +OMPCancelStack.back().CodeGen = CodeGen; > } > > void CodeGenFunction::EmitOMPForOuterLoop( > @@ -1881,6 +1889,7 @@ void CodeGenFunction::EmitOMPDistributeO > void CodeGenFunction::EmitOMPDistributeParallelForDirective( > const OMPDistributeParallelForDirective &S) { >OMPLexicalScope Scope(*this, S, /*AsInlined=*/true); > + OMPCancelStackRAII CancelRegion(*this); >CGM.getOpenMPRuntime().emitInlinedDirective( >*this, OMPD_distribute_parallel_for, >[&S](CodeGenFunction &CGF, PrePostActionTy &) { > @@ -2073,7 +2082,15 @@ bool CodeGenFunction::EmitOMPWorksharing > [](CodeGenFunction &) {}); > EmitBlock(LoopExit.getBlock()); > // Tell the runtime we are done. > -RT.emitForStaticFinish(*this, S.getLocStart()); > +SourceLocation ELoc = S.getLocEnd(); > +auto &&CodeGen = [ELoc](CodeGenFunction &CGF) { > + CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc); > +}; > +CodeGen(*this); > +OpenMPDirectiveKind DKind = S.getDirectiveKind(); > +if (DKind == OMPD_for || DKind == OMPD_parallel_for || > +DKind == OMPD_distribute_parallel_for) > + OMPCancelStack.back().CodeGen = CodeGen; >} else { > const bool IsMonotonic = > Ordered || ScheduleKind.Schedule == OMPC_SCHEDULE_static || > @@ -2127,6 +2144,7 @@ void CodeGenFunction::EmitOMPForDirectiv >}; >{ > OMPLexicalScope Scope(*this, S, /*AsInlined=*/true); > +OMPCancelStackRAII CancelRegion(*this); > CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_for, CodeGen, > S.hasCancel()); >} > @@ -2263,7 +2281,12 @@ void CodeGenFunction
[llvm-branch-commits] [cfe-branch] r287033 - Merging r287025:
Author: abataev
Date: Tue Nov 15 15:24:19 2016
New Revision: 287033
URL: http://llvm.org/viewvc/llvm-project?rev=287033&view=rev
Log:
Merging r287025:
r287025 | abataev | 2016-11-15 20:57:18 + (Tue, 15 Nov 2016) | 3 lines
[OPENMP] Fix stack use after delete, NFC.
Fixed possible use of stack variable after deletion.
Modified:
cfe/branches/release_39/ (props changed)
cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp
Propchange: cfe/branches/release_39/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 15 15:24:19 2016
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,284229,286103,286106,286129,286584,286944,286953
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,284229,286103,286106,286129,286584,286944,286953,287025
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp?rev=287033&r1=287032&r2=287033&view=diff
==
--- cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp Tue Nov 15 15:24:19
2016
@@ -2187,6 +2187,7 @@ void CodeGenFunction::EmitSections(const
bool HasLastprivates = false;
auto &&CodeGen = [&S, Stmt, CS, &HasLastprivates](CodeGenFunction &CGF,
PrePostActionTy &) {
+OMPCancelStackRAII CancelRegion(CGF);
auto &C = CGF.CGM.getContext();
auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
// Emit helper vars inits.
@@ -2282,11 +2283,11 @@ void CodeGenFunction::EmitSections(const
[](CodeGenFunction &) {});
// Tell the runtime we are done.
SourceLocation ELoc = S.getLocEnd();
-auto &&CodeGen = [ELoc](CodeGenFunction &CGF) {
+auto &&FinalCodeGen = [ELoc](CodeGenFunction &CGF) {
CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
};
-CodeGen(CGF);
-CGF.OMPCancelStack.back().CodeGen = CodeGen;
+FinalCodeGen(CGF);
+CGF.OMPCancelStack.back().CodeGen = FinalCodeGen;
CGF.EmitOMPReductionClauseFinal(S);
// Emit post-update of the reduction variables if IsLastIter != 0.
emitPostUpdateForReductionClause(
@@ -2324,7 +2325,6 @@ void CodeGenFunction::EmitSections(const
void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
{
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
-OMPCancelStackRAII CancelRegion(*this);
EmitSections(S);
}
// Emit an implicit barrier at the end.
@@ -2433,7 +2433,6 @@ void CodeGenFunction::EmitOMPParallelSec
// Emit directive as a combined directive that consists of two implicit
// directives: 'parallel' with 'sections' directive.
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
-OMPCancelStackRAII CancelRegion(CGF);
CGF.EmitSections(S);
};
emitCommonOMPParallelDirective(*this, S, OMPD_sections, CodeGen);
___
llvm-branch-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
Re: [llvm-branch-commits] [cfe-branch] r286968 - Merging r286944:
Hi, Sorry for this mess. Fixed in r287033. Best regards, Alexey Bataev On 11/15/2016 09:58 PM, Vitaly Buka wrote: Alexey, this patch is likely the cause of http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/197/steps/check-clang%20asan/logs/stdio On Tue, Nov 15, 2016 at 8:59 AM Alexey Bataev via llvm-branch-commits mailto:[email protected]>> wrote: Author: abataev Date: Tue Nov 15 08:26:49 2016 New Revision: 286968 URL: http://llvm.org/viewvc/llvm-project?rev=286968&view=rev Log: Merging r286944: r286944 | abataev | 2016-11-15 09:11:50 + (Tue, 15 Nov 2016) | 6 lines [OPENMP] Fixed codegen for 'omp cancel' construct. If 'omp cancel' construct is used in a worksharing construct it may cause hanging of the software in case if reduction clause is used. Patch fixes this problem by avoiding extra reduction processing for branches that were canceled. Modified: cfe/branches/release_39/ (props changed) cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp cfe/branches/release_39/lib/CodeGen/CodeGenFunction.h cfe/branches/release_39/test/OpenMP/cancel_codegen.cpp Propchange: cfe/branches/release_39/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Nov 15 08:26:49 2016 @@ -1,4 +1,4 @@ /cfe/branches/type-system-rewrite:134693-134817 -/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584 +/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,286103,286106,286129,286584,286944 /cfe/trunk/test:170344 /cfe/trunk/test/SemaTemplate:126920 Modified: cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp?rev=286968&r1=286967&r2=286968&view=diff == --- cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp (original) +++ cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp Tue Nov 15 08:26:49 2016 @@ -1767,9 +1767,17 @@ void CodeGenFunction::EmitOMPOuterLoop(b EmitBlock(LoopExit.getBlock()); // Tell the runtime we are done. - if (!DynamicOrOrdered) -RT.emitForStaticFinish(*this, S.getLocEnd()); + SourceLocation ELoc = S.getLocEnd(); + auto &&CodeGen = [DynamicOrOrdered, ELoc](CodeGenFunction &CGF) { +if (!DynamicOrOrdered) + CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc); + }; + CodeGen(*this); + OpenMPDirectiveKind DKind = S.getDirectiveKind(); + if (DKind == OMPD_for || DKind == OMPD_parallel_for || + DKind == OMPD_distribute_parallel_for) +OMPCancelStack.back().CodeGen = CodeGen; } void CodeGenFunction::EmitOMPForOuterLoop( @@ -1881,6 +1889,7 @@ void CodeGenFunction::EmitOMPDistributeO void CodeGenFunction::EmitOMPDistributeParallelForDirective( const OMPDistributeParallelForDirective &S) { OMPLexicalScope Scope(*this, S, /*AsInlined=*/true); + OMPCancelStackRAII CancelRegion(*this); CGM.getOpenMPRuntime().emitInlinedDirective( *this, OMPD_distribute_parallel_for, [&S](CodeGenFunction &CGF, PrePostActionTy &) { @@ -2073,7 +2082,15 @@ bool CodeGenFunction::EmitOMPWorksharing [](CodeGenFunction &) {}); EmitBlock(LoopExit.getBlock()); // Tell the runtime we are done. -RT.emitForStaticFinish(*this, S.getLocStart()); +SourceLocation ELoc = S.getLocEnd(); +auto &&CodeGen = [ELoc](CodeGenFunction &CGF) { + CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc); +}; +CodeGen(*this); +OpenMPDirectiveKind DKind = S.getDirectiveKind(); +if (DKind == OMPD_for || DKind == OMPD_parallel_for || +DKind == OMPD_distribute_parallel_for) + OMPCancelStack.back().CodeGen = CodeGen; } else { const bool IsMonotonic = Ordered || ScheduleKind.Schedule == OMPC_SCHEDULE_static || @@ -2127,6 +2144,7 @@ void CodeGenFunction::EmitOMPForDirectiv }; { OMPLexicalScope Scope(*this, S, /*AsInlined=*/true); +OMPCancelStackRAII CancelRegion(*this); CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_for, CodeGen, S.hasCancel()); } @@ -2263,7 +2281,12 @@ void CodeGenFunction::EmitSections(const CGF.EmitOMPInnerLoop(S, /*RequiresClea
