[PATCH] D79921: [OPENMP] Fix mixture of omp and clang pragmas

ISHIGURO, Hiroshi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 01:36:19 PDT 2020


hishiguro updated this revision to Diff 265450.
hishiguro added a comment.

Thank you for your comment. I updated source.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79921/new/

https://reviews.llvm.org/D79921

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/omp_with_loop_pragma.c


Index: clang/test/OpenMP/omp_with_loop_pragma.c
===================================================================
--- clang/test/OpenMP/omp_with_loop_pragma.c
+++ clang/test/OpenMP/omp_with_loop_pragma.c
@@ -3,12 +3,12 @@
 // expected-no-diagnostics
 
 // CHECK: !{{[0-9]+}} = !{!"llvm.loop.vectorize.width", i32 1}
-void sub(double * restrict a, double * restrict b, int n){ 
+void sub(double *restrict a, double *restrict b, int n) {
   int i;
 
 #pragma omp parallel for
 #pragma clang loop vectorize(disable)
-  for(i=0;i<n;i++){
+  for (i = 0; i < n; i++) {
     a[i] = a[i] + b[i];
   }
 }
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===================================================================
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1732,8 +1732,8 @@
   const SourceRange R = S.getSourceRange();
 
   // If attributes are attached, push to the basic block with them.
-  const OMPExecutableDirective *OMPED = dyn_cast<OMPExecutableDirective>(&S);
-  const CapturedStmt *ICS = OMPED->getInnermostCapturedStmt();
+  const auto &OMPED = cast<OMPExecutableDirective>(S);
+  const CapturedStmt *ICS = OMPED.getInnermostCapturedStmt();
   const Stmt *SS = ICS->getCapturedStmt();
   const AttributedStmt *AS = dyn_cast_or_null<AttributedStmt>(SS);
   if (AS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79921.265450.patch
Type: text/x-patch
Size: 1309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200521/393b7102/attachment.bin>


More information about the cfe-commits mailing list