[llvm-branch-commits] [cfe-branch] r242549 - Merging r242382:

Hans Wennborg hans at hanshq.net
Fri Jul 17 10:25:26 PDT 2015


Author: hans
Date: Fri Jul 17 12:25:26 2015
New Revision: 242549

URL: http://llvm.org/viewvc/llvm-project?rev=242549&view=rev
Log:
Merging r242382:
------------------------------------------------------------------------
r242382 | abataev | 2015-07-15 21:19:43 -0700 (Wed, 15 Jul 2015) | 4 lines

[OPENMP] Fixed detection of canonical loops with random access iterators.

Add handling of iterators with copy/move constructors with default arguments + converting template constructors.

------------------------------------------------------------------------

Modified:
    cfe/branches/release_37/   (props changed)
    cfe/branches/release_37/lib/Sema/SemaOpenMP.cpp
    cfe/branches/release_37/test/OpenMP/for_codegen.cpp
    cfe/branches/release_37/test/OpenMP/for_loop_messages.cpp
    cfe/branches/release_37/test/OpenMP/for_simd_loop_messages.cpp
    cfe/branches/release_37/test/OpenMP/parallel_for_loop_messages.cpp
    cfe/branches/release_37/test/OpenMP/parallel_for_simd_loop_messages.cpp
    cfe/branches/release_37/test/OpenMP/simd_loop_messages.cpp

Propchange: cfe/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 17 12:25:26 2015
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:242244,242285,242293,242297,242313,242422
+/cfe/trunk:242244,242285,242293,242297,242313,242382,242422
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_37/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/lib/Sema/SemaOpenMP.cpp?rev=242549&r1=242548&r2=242549&view=diff
==============================================================================
--- cfe/branches/release_37/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/branches/release_37/lib/Sema/SemaOpenMP.cpp Fri Jul 17 12:25:26 2015
@@ -2290,8 +2290,9 @@ bool OpenMPIterationSpaceChecker::SetVar
   VarRef = NewVarRefExpr;
   if (auto *CE = dyn_cast_or_null<CXXConstructExpr>(NewLB))
     if (const CXXConstructorDecl *Ctor = CE->getConstructor())
-      if (Ctor->isCopyConstructor() && CE->getNumArgs() == 1 &&
-          CE->getArg(0) != nullptr)
+      if ((Ctor->isCopyOrMoveConstructor() ||
+           Ctor->isConvertingConstructor(/*AllowExplicit=*/false)) &&
+          CE->getNumArgs() > 0 && CE->getArg(0) != nullptr)
         NewLB = CE->getArg(0)->IgnoreParenImpCasts();
   LB = NewLB;
   return false;
@@ -2426,8 +2427,9 @@ static const VarDecl *GetInitVarDecl(con
   E = getExprAsWritten(E);
   if (auto *CE = dyn_cast_or_null<CXXConstructExpr>(E))
     if (const CXXConstructorDecl *Ctor = CE->getConstructor())
-      if (Ctor->isCopyConstructor() && CE->getNumArgs() == 1 &&
-          CE->getArg(0) != nullptr)
+      if ((Ctor->isCopyOrMoveConstructor() ||
+           Ctor->isConvertingConstructor(/*AllowExplicit=*/false)) &&
+          CE->getNumArgs() > 0 && CE->getArg(0) != nullptr)
         E = CE->getArg(0)->IgnoreParenImpCasts();
   auto DRE = dyn_cast_or_null<DeclRefExpr>(E);
   if (!DRE)

Modified: cfe/branches/release_37/test/OpenMP/for_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/OpenMP/for_codegen.cpp?rev=242549&r1=242548&r2=242549&view=diff
==============================================================================
--- cfe/branches/release_37/test/OpenMP/for_codegen.cpp (original)
+++ cfe/branches/release_37/test/OpenMP/for_codegen.cpp Fri Jul 17 12:25:26 2015
@@ -420,8 +420,9 @@ struct Bool {
 template <typename T>
 struct It {
   It() : p(0) {}
-  It(const It &) ;
-  It(It &) ;
+  It(const It &, int = 0) ;
+  template <typename U>
+  It(U &, int = 0) ;
   It &operator=(const It &);
   It &operator=(It &);
   ~It() {}

Modified: cfe/branches/release_37/test/OpenMP/for_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/OpenMP/for_loop_messages.cpp?rev=242549&r1=242548&r2=242549&view=diff
==============================================================================
--- cfe/branches/release_37/test/OpenMP/for_loop_messages.cpp (original)
+++ cfe/branches/release_37/test/OpenMP/for_loop_messages.cpp Fri Jul 17 12:25:26 2015
@@ -562,7 +562,7 @@ int test_with_random_access_iterator() {
   for (Iter1 I = begin1; I >= end1; ++I)
     ++I;
 #pragma omp parallel
-// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
+// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'float')}}
 // expected-error at +4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
 // Initializer is constructor with all default params.
 // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}

Modified: cfe/branches/release_37/test/OpenMP/for_simd_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/OpenMP/for_simd_loop_messages.cpp?rev=242549&r1=242548&r2=242549&view=diff
==============================================================================
--- cfe/branches/release_37/test/OpenMP/for_simd_loop_messages.cpp (original)
+++ cfe/branches/release_37/test/OpenMP/for_simd_loop_messages.cpp Fri Jul 17 12:25:26 2015
@@ -544,7 +544,7 @@ int test_with_random_access_iterator() {
   for (Iter1 I = begin1; I >= end1; ++I)
     ++I;
 #pragma omp parallel
-// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
+// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'float')}}
 // expected-error at +4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
 // Initializer is constructor with all default params.
 // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}

Modified: cfe/branches/release_37/test/OpenMP/parallel_for_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/OpenMP/parallel_for_loop_messages.cpp?rev=242549&r1=242548&r2=242549&view=diff
==============================================================================
--- cfe/branches/release_37/test/OpenMP/parallel_for_loop_messages.cpp (original)
+++ cfe/branches/release_37/test/OpenMP/parallel_for_loop_messages.cpp Fri Jul 17 12:25:26 2015
@@ -467,7 +467,7 @@ int test_with_random_access_iterator() {
 #pragma omp parallel for
   for (Iter1 I = begin1; I >= end1; ++I)
     ++I;
-// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
+// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'float')}}
 // expected-error at +4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
 // Initializer is constructor with all default params.
 // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}

Modified: cfe/branches/release_37/test/OpenMP/parallel_for_simd_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/OpenMP/parallel_for_simd_loop_messages.cpp?rev=242549&r1=242548&r2=242549&view=diff
==============================================================================
--- cfe/branches/release_37/test/OpenMP/parallel_for_simd_loop_messages.cpp (original)
+++ cfe/branches/release_37/test/OpenMP/parallel_for_simd_loop_messages.cpp Fri Jul 17 12:25:26 2015
@@ -467,7 +467,7 @@ int test_with_random_access_iterator() {
 #pragma omp parallel for simd
   for (Iter1 I = begin1; I >= end1; ++I)
     ++I;
-// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
+// expected-error at +5 {{invalid operands to binary expression ('Iter1' and 'float')}}
 // expected-error at +4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
 // Initializer is constructor with all default params.
 // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}

Modified: cfe/branches/release_37/test/OpenMP/simd_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/OpenMP/simd_loop_messages.cpp?rev=242549&r1=242548&r2=242549&view=diff
==============================================================================
--- cfe/branches/release_37/test/OpenMP/simd_loop_messages.cpp (original)
+++ cfe/branches/release_37/test/OpenMP/simd_loop_messages.cpp Fri Jul 17 12:25:26 2015
@@ -456,7 +456,7 @@ int test_with_random_access_iterator() {
     ++I;
 
   // Initializer is constructor with all default params.
-  // expected-error at +4 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
+  // expected-error at +4 {{invalid operands to binary expression ('Iter1' and 'float')}}
   // expected-error at +3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
   // expected-warning at +2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
   #pragma omp simd





More information about the llvm-branch-commits mailing list