r231752 - [OPENMP] Improved code for generating debug info + generation of all OpenMP regions in termination scope

Bataev, Alexey a.bataev at hotmail.com
Mon Mar 9 22:10:35 PDT 2015


Ok, thanks. I'll fix it ASAP.

Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team

10.03.2015 7:44, Rafael Espíndola пишет:
> Sorry, this was failing to link with cmake and I reverted it.
>
> Example of a failed log:
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-debian-fast/builds/24088/steps/build/logs/stdio
>
> On 10 March 2015 at 00:22, Alexey Bataev <a.bataev at hotmail.com 
> <mailto:a.bataev at hotmail.com>> wrote:
>
>     Author: abataev
>     Date: Mon Mar  9 23:22:11 2015
>     New Revision: 231752
>
>     URL: http://llvm.org/viewvc/llvm-project?rev=231752&view=rev
>     Log:
>     [OPENMP] Improved code for generating debug info + generation of
>     all OpenMP regions in termination scope
>     Patch adds proper generation of debug info for all OpenMP regions.
>     Also, all OpenMP regions are generated in a termination scope,
>     because standard does not allow to throw exceptions out of
>     structured blocks, associated with the OpenMP regions
>     Differential Revision: http://reviews.llvm.org/D7935
>
>     Added:
>         cfe/trunk/test/OpenMP/atomic_codegen.cpp   (with props)
>     Modified:
>         cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>         cfe/trunk/lib/CodeGen/CGStmt.cpp
>         cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>         cfe/trunk/test/OpenMP/critical_codegen.cpp
>         cfe/trunk/test/OpenMP/for_codegen.cpp
>         cfe/trunk/test/OpenMP/master_codegen.cpp
>         cfe/trunk/test/OpenMP/parallel_codegen.cpp
>         cfe/trunk/test/OpenMP/simd_codegen.cpp
>         cfe/trunk/test/OpenMP/single_codegen.cpp
>
>     Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
>     +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Mon Mar  9 23:22:11 2015
>     @@ -1047,9 +1047,16 @@ InlinedOpenMPRegionRAII::InlinedOpenMPRe
>          CodeGenFunction &CGF, const OMPExecutableDirective &D)
>          : CGF(CGF) {
>        CGF.CapturedStmtInfo = new CGOpenMPInlinedRegionInfo(D,
>     CGF.CapturedStmtInfo);
>     +  // 1.2.2 OpenMP Language Terminology
>     +  // Structured block - An executable statement with a single
>     entry at the
>     +  // top and a single exit at the bottom.
>     +  // The point of exit cannot be a branch out of the structured
>     block.
>     +  // longjmp() and throw() must not violate the entry/exit criteria.
>     +  CGF.EHStack.pushTerminate();
>      }
>
>      InlinedOpenMPRegionRAII::~InlinedOpenMPRegionRAII() {
>     +  CGF.EHStack.popTerminate();
>        auto *OldCSI =
>      cast<CGOpenMPInlinedRegionInfo>(CGF.CapturedStmtInfo)->getOldCSI();
>        delete CGF.CapturedStmtInfo;
>
>     Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
>     +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Mar  9 23:22:11 2015
>     @@ -2186,6 +2186,8 @@ CodeGenFunction::GenerateCapturedStmtFun
>          llvm::Function::Create(FuncLLVMTy,
>     llvm::GlobalValue::InternalLinkage,
>     CapturedStmtInfo->getHelperName(), &CGM.getModule());
>        CGM.SetInternalFunctionAttributes(CD, F, FuncInfo);
>     +  if (CD->isNothrow())
>     +    F->addFnAttr(llvm::Attribute::NoUnwind);
>
>        // Generate the function.
>        StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args,
>
>     Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
>     +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Mon Mar  9 23:22:11 2015
>     @@ -23,6 +23,20 @@ using namespace CodeGen;
>      //===----------------------------------------------------------------------===//
>      //                              OpenMP Directive Emission
>      //===----------------------------------------------------------------------===//
>     +namespace {
>     +/// \brief RAII for inlined OpenMP regions (like 'omp for', 'omp
>     simd', 'omp
>     +/// critical' etc.). Helps to generate proper debug info and
>     provides correct
>     +/// code generation for such constructs.
>     +class InlinedOpenMPRegionScopeRAII {
>     +  InlinedOpenMPRegionRAII Region;
>     +  CodeGenFunction::LexicalScope DirectiveScope;
>     +
>     +public:
>     +  InlinedOpenMPRegionScopeRAII(CodeGenFunction &CGF,
>     +                               const OMPExecutableDirective &D)
>     +      : Region(CGF, D), DirectiveScope(CGF, D.getSourceRange()) {}
>     +};
>     +} // namespace
>
>      /// \brief Emits code for OpenMP 'if' clause using specified \a
>     CodeGen
>      /// function. Here is the logic:
>     @@ -417,12 +431,7 @@ void CodeGenFunction::EmitOMPSimdDirecti
>          }
>        }
>
>     -  InlinedOpenMPRegionRAII Region(*this, S);
>     -  RunCleanupsScope DirectiveScope(*this);
>     -
>     -  CGDebugInfo *DI = getDebugInfo();
>     -  if (DI)
>     -    DI->EmitLexicalBlockStart(Builder,
>     S.getSourceRange().getBegin());
>     +  InlinedOpenMPRegionScopeRAII Region(*this, S);
>
>        // Emit the loop iteration variable.
>        const Expr *IVExpr = S.getIterationVariable();
>     @@ -466,9 +475,6 @@ void CodeGenFunction::EmitOMPSimdDirecti
>          }
>          EmitOMPSimdFinal(S);
>        }
>     -
>     -  if (DI)
>     -    DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd());
>      }
>
>      void
>     CodeGenFunction::EmitOMPForOuterLoop(OpenMPScheduleClauseKind
>     ScheduleKind,
>     @@ -650,20 +656,13 @@ void CodeGenFunction::EmitOMPWorksharing
>      }
>
>      void CodeGenFunction::EmitOMPForDirective(const OMPForDirective &S) {
>     -  InlinedOpenMPRegionRAII Region(*this, S);
>     -  RunCleanupsScope DirectiveScope(*this);
>     -
>     -  CGDebugInfo *DI = getDebugInfo();
>     -  if (DI)
>     -    DI->EmitLexicalBlockStart(Builder,
>     S.getSourceRange().getBegin());
>     +  InlinedOpenMPRegionScopeRAII Region(*this, S);
>
>        EmitOMPWorksharingLoop(S);
>
>        // Emit an implicit barrier at the end.
>        CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(),
>                                               /*IsExplicit*/ false);
>     -  if (DI)
>     -    DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd());
>      }
>
>      void CodeGenFunction::EmitOMPForSimdDirective(const
>     OMPForSimdDirective &) {
>     @@ -680,8 +679,7 @@ void CodeGenFunction::EmitOMPSectionDire
>
>      void CodeGenFunction::EmitOMPSingleDirective(const
>     OMPSingleDirective &S) {
>        CGM.getOpenMPRuntime().emitSingleRegion(*this, [&]() -> void {
>     -    InlinedOpenMPRegionRAII Region(*this, S);
>     -    RunCleanupsScope Scope(*this);
>     +    InlinedOpenMPRegionScopeRAII Region(*this, S);
>      EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
>          EnsureInsertPoint();
>        }, S.getLocStart());
>     @@ -689,8 +687,7 @@ void CodeGenFunction::EmitOMPSingleDirec
>
>      void CodeGenFunction::EmitOMPMasterDirective(const
>     OMPMasterDirective &S) {
>        CGM.getOpenMPRuntime().emitMasterRegion(*this, [&]() -> void {
>     -    InlinedOpenMPRegionRAII Region(*this, S);
>     -    RunCleanupsScope Scope(*this);
>     +    InlinedOpenMPRegionScopeRAII Region(*this, S);
>      EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
>          EnsureInsertPoint();
>        }, S.getLocStart());
>     @@ -699,8 +696,7 @@ void CodeGenFunction::EmitOMPMasterDirec
>      void CodeGenFunction::EmitOMPCriticalDirective(const
>     OMPCriticalDirective &S) {
>        CGM.getOpenMPRuntime().emitCriticalRegion(
>            *this, S.getDirectiveName().getAsString(), [&]() -> void {
>     -        InlinedOpenMPRegionRAII Region(*this, S);
>     -        RunCleanupsScope Scope(*this);
>     +        InlinedOpenMPRegionScopeRAII Region(*this, S);
>      EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
>              EnsureInsertPoint();
>            }, S.getLocStart());
>     @@ -898,6 +894,7 @@ void CodeGenFunction::EmitOMPAtomicDirec
>            break;
>          }
>        }
>     +  InlinedOpenMPRegionScopeRAII Region(*this, S);
>        EmitOMPAtomicExpr(*this, Kind, IsSeqCst, S.getX(), S.getV(),
>     S.getExpr(),
>                          S.getLocStart());
>      }
>
>     Added: cfe/trunk/test/OpenMP/atomic_codegen.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/atomic_codegen.cpp?rev=231752&view=auto
>     ==============================================================================
>     --- cfe/trunk/test/OpenMP/atomic_codegen.cpp (added)
>     +++ cfe/trunk/test/OpenMP/atomic_codegen.cpp Mon Mar  9 23:22:11 2015
>     @@ -0,0 +1,30 @@
>     +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10
>     -fopenmp=libiomp5 -fexceptions -fcxx-exceptions -gline-tables-only
>     -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
>     +// expected-no-diagnostics
>     +
>     +int a;
>     +int &foo() { return a; }
>     +
>     +// TERM_DEBUG-LABEL: parallel_atomic
>     +void parallel_atomic() {
>     +#pragma omp parallel
>     +  {
>     +#pragma omp atomic read
>     +    // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +    // TERM_DEBUG:     invoke {{.*}}foo{{.*}}()
>     +    // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
>     +    // TERM_DEBUG:     load atomic i32,  i32* @{{.+}} monotonic,
>     {{.*}}!dbg [[READ_LOC:![0-9]+]]
>     +    foo() = a;
>     +#pragma omp atomic write
>     +    // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +    // TERM_DEBUG:     invoke {{.*}}foo{{.*}}()
>     +    // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
>     +    // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +    // TERM_DEBUG:     store atomic i32 {{%.+}}, i32* @{{.+}}
>     monotonic, {{.*}}!dbg [[WRITE_LOC:![0-9]+]]
>     +    // TERM_DEBUG:     [[TERM_LPAD]]:
>     +    // TERM_DEBUG:     call void @__clang_call_terminate
>     +    // TERM_DEBUG:     unreachable
>     +    a = foo();
>     +  }
>     +}
>     +// TERM_DEBUG-DAG: [[READ_LOC]] = !MDLocation(line: 11,
>     +// TERM_DEBUG-DAG: [[WRITE_LOC]] = !MDLocation(line: 17,
>
>     Propchange: cfe/trunk/test/OpenMP/atomic_codegen.cpp
>     ------------------------------------------------------------------------------
>         svn:eol-style = native
>
>     Propchange: cfe/trunk/test/OpenMP/atomic_codegen.cpp
>     ------------------------------------------------------------------------------
>         svn:keywords = Author Date Id Rev URL
>
>     Propchange: cfe/trunk/test/OpenMP/atomic_codegen.cpp
>     ------------------------------------------------------------------------------
>         svn:mime-type = text/plain
>
>     Modified: cfe/trunk/test/OpenMP/critical_codegen.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/critical_codegen.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/test/OpenMP/critical_codegen.cpp (original)
>     +++ cfe/trunk/test/OpenMP/critical_codegen.cpp Mon Mar  9 23:22:11
>     2015
>     @@ -1,6 +1,7 @@
>      // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s
>     -fexceptions -fcxx-exceptions -o - | FileCheck %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o
>     %t %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11
>     -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
>     +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10
>     -fopenmp=libiomp5 -fexceptions -fcxx-exceptions -gline-tables-only
>     -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
>      // expected-no-diagnostics
>
>      #ifndef HEADER
>     @@ -15,6 +16,7 @@
>      void foo() {}
>
>      // CHECK-LABEL: @main
>     +// TERM_DEBUG-LABEL: @main
>      int main() {
>      // CHECK:       [[A_ADDR:%.+]] = alloca i8
>        char a;
>     @@ -26,8 +28,8 @@ int main() {
>      #pragma omp critical
>        a = 2;
>      // CHECK:       call void @__kmpc_critical([[IDENT_T_TY]]*
>     [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]])
>     -// CHECK-NEXT:  call void [[FOO]]()
>     -// CHECK-NEXT:  call void @__kmpc_end_critical([[IDENT_T_TY]]*
>     [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]])
>     +// CHECK-NEXT:  invoke void [[FOO]]()
>     +// CHECK:       call void @__kmpc_end_critical([[IDENT_T_TY]]*
>     [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]])
>      #pragma omp critical(the_name)
>        foo();
>      // CHECK-NOT:   call void @__kmpc_critical
>     @@ -35,13 +37,22 @@ int main() {
>        return a;
>      }
>
>     -// CHECK-LABEL: parallel_critical
>     -void parallel_critical(float *a) {
>     +// CHECK-LABEL:      parallel_critical
>     +// TERM_DEBUG-LABEL: parallel_critical
>     +void parallel_critical() {
>      #pragma omp parallel
>      #pragma omp critical
>     -  // CHECK-NOT: __kmpc_global_thread_num
>     -  for (unsigned i = 131071; i <= 2147483647; i += 127)
>     -    a[i] += i;
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call void @__kmpc_critical({{.+}}), !dbg
>     [[DBG_LOC_START:![0-9]+]]
>     +  // TERM_DEBUG:     invoke void {{.*}}foo{{.*}}()
>     +  // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call void @__kmpc_end_critical({{.+}}), !dbg
>     [[DBG_LOC_END:![0-9]+]]
>     +  // TERM_DEBUG:     [[TERM_LPAD]]:
>     +  // TERM_DEBUG:     call void @__clang_call_terminate
>     +  // TERM_DEBUG:     unreachable
>     +  foo();
>      }
>     -
>     +// TERM_DEBUG-DAG: [[DBG_LOC_START]] = !MDLocation(line: 44,
>     +// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !MDLocation(line: 44,
>      #endif
>
>     Modified: cfe/trunk/test/OpenMP/for_codegen.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_codegen.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/test/OpenMP/for_codegen.cpp (original)
>     +++ cfe/trunk/test/OpenMP/for_codegen.cpp Mon Mar  9 23:22:11 2015
>     @@ -1,6 +1,7 @@
>      // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -triple
>     x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions
>     -o - | FileCheck %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o
>     %t %s
>     -// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11
>     -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
>     +// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11
>     -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
>     +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10
>     -fopenmp=libiomp5 -fexceptions -fcxx-exceptions -gline-tables-only
>     -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
>      //
>      // expected-no-diagnostics
>      #ifndef HEADER
>     @@ -146,13 +147,28 @@ void static_chunked(float *a, float *b,
>      // CHECK: ret void
>      }
>
>     +// TERM_DEBUG-LABEL: foo
>     +int foo() {return 0;};
>     +
>     +// TERM_DEBUG-LABEL: parallel_for
>      void parallel_for(float *a) {
>      #pragma omp parallel
>      #pragma omp for schedule(static, 5)
>     -  // CHECK-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call void
>     @__kmpc_for_static_init_4u({{.+}}), !dbg [[DBG_LOC_START:![0-9]+]]
>     +  // TERM_DEBUG:     invoke i32 {{.*}}foo{{.*}}()
>     +  // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call void @__kmpc_for_static_fini({{.+}}),
>     !dbg [[DBG_LOC_END:![0-9]+]]
>     +  // TERM_DEBUG:     call {{.+}} @__kmpc_cancel_barrier({{.+}}),
>     !dbg [[DBG_LOC_CANCEL:![0-9]+]]
>     +  // TERM_DEBUG:     [[TERM_LPAD]]:
>     +  // TERM_DEBUG:     call void @__clang_call_terminate
>     +  // TERM_DEBUG:     unreachable
>        for (unsigned i = 131071; i <= 2147483647; i += 127)
>     -    a[i] += i;
>     +    a[i] += foo();
>      }
>     -
>     +// TERM_DEBUG-DAG: [[DBG_LOC_START]] = !MDLocation(line: 156,
>     +// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !MDLocation(line: 156,
>     +// TERM_DEBUG-DAG: [[DBG_LOC_CANCEL]] = !MDLocation(line: 156,
>      #endif // HEADER
>
>
>     Modified: cfe/trunk/test/OpenMP/master_codegen.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/master_codegen.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/test/OpenMP/master_codegen.cpp (original)
>     +++ cfe/trunk/test/OpenMP/master_codegen.cpp Mon Mar  9 23:22:11 2015
>     @@ -1,6 +1,7 @@
>      // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s
>     -fexceptions -fcxx-exceptions -o - | FileCheck %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o
>     %t %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11
>     -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
>     +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10
>     -fopenmp=libiomp5 -fexceptions -fcxx-exceptions -gline-tables-only
>     -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
>      // expected-no-diagnostics
>
>      #ifndef HEADER
>     @@ -13,6 +14,7 @@
>      void foo() {}
>
>      // CHECK-LABEL: @main
>     +// TERM_DEBUG-LABEL: @main
>      int main() {
>        // CHECK:       [[A_ADDR:%.+]] = alloca i8
>        char a;
>     @@ -32,8 +34,8 @@ int main() {
>      // CHECK-NEXT:  [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0
>      // CHECK-NEXT:  br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]],
>     label {{%?}}[[EXIT:.+]]
>      // CHECK:       [[THEN]]
>     -// CHECK-NEXT:  call void [[FOO]]()
>     -// CHECK-NEXT:  call void @__kmpc_end_master([[IDENT_T_TY]]*
>     [[DEFAULT_LOC]], i32 [[GTID]])
>     +// CHECK-NEXT:  invoke void [[FOO]]()
>     +// CHECK:       call void @__kmpc_end_master([[IDENT_T_TY]]*
>     [[DEFAULT_LOC]], i32 [[GTID]])
>      // CHECK-NEXT:  br label {{%?}}[[EXIT]]
>      // CHECK:       [[EXIT]]
>      #pragma omp master
>     @@ -43,13 +45,23 @@ int main() {
>        return a;
>      }
>
>     -// CHECK-LABEL: parallel_master
>     -void parallel_master(float *a) {
>     +// CHECK-LABEL:      parallel_master
>     +// TERM_DEBUG-LABEL: parallel_master
>     +void parallel_master() {
>      #pragma omp parallel
>      #pragma omp master
>     -  // CHECK-NOT: __kmpc_global_thread_num
>     -  for (unsigned i = 131071; i <= 2147483647; i += 127)
>     -    a[i] += i;
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call i32 @__kmpc_master({{.+}}), !dbg
>     [[DBG_LOC_START:![0-9]+]]
>     +  // TERM_DEBUG:     invoke void {{.*}}foo{{.*}}()
>     +  // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call void @__kmpc_end_master({{.+}}), !dbg
>     [[DBG_LOC_END:![0-9]+]]
>     +  // TERM_DEBUG:     [[TERM_LPAD]]:
>     +  // TERM_DEBUG:     call void @__clang_call_terminate
>     +  // TERM_DEBUG:     unreachable
>     +  foo();
>      }
>     +// TERM_DEBUG-DAG: [[DBG_LOC_START]] = !MDLocation(line: 52,
>     +// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !MDLocation(line: 52,
>
>      #endif
>
>     Modified: cfe/trunk/test/OpenMP/parallel_codegen.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_codegen.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/test/OpenMP/parallel_codegen.cpp (original)
>     +++ cfe/trunk/test/OpenMP/parallel_codegen.cpp Mon Mar  9 23:22:11
>     2015
>     @@ -62,6 +62,7 @@ int main (int argc, char **argv) {
>      // CHECK-DEBUG-NEXT:  }
>
>      // CHECK-LABEL: define internal void @.omp_outlined.(i32*
>     %.global_tid., i32* %.bound_tid., %struct.anon* %__context)
>     +// CHECK:       #[[FN_ATTRS:[0-9]+]]
>      // CHECK:       [[CONTEXT_ADDR:%.+]] = alloca %struct.anon*
>      // CHECK:       store %struct.anon* %__context, %struct.anon**
>     [[CONTEXT_ADDR]]
>      // CHECK:       [[CONTEXT_PTR:%.+]] = load %struct.anon*,
>     %struct.anon** [[CONTEXT_ADDR]]
>     @@ -74,6 +75,7 @@ int main (int argc, char **argv) {
>      // CHECK-NEXT:  unreachable
>      // CHECK-NEXT:  }
>      // CHECK-DEBUG-LABEL: define internal void @.omp_outlined.(i32*
>     %.global_tid., i32* %.bound_tid., %struct.anon* %__context)
>     +// CHECK-DEBUG:       #[[FN_ATTRS:[0-9]+]]
>      // CHECK-DEBUG:       [[CONTEXT_ADDR:%.+]] = alloca %struct.anon*
>      // CHECK-DEBUG:       store %struct.anon* %__context,
>     %struct.anon** [[CONTEXT_ADDR]]
>      // CHECK-DEBUG:       [[CONTEXT_PTR:%.+]] = load %struct.anon*,
>     %struct.anon** [[CONTEXT_ADDR]]
>     @@ -142,4 +144,7 @@ int main (int argc, char **argv) {
>      // CHECK: define linkonce_odr void [[FOO1]](i8** %argc)
>      // CHECK-DEBUG: define linkonce_odr void [[FOO1]](i8** %argc)
>
>     +// CHECK: attributes #[[FN_ATTRS]] = {{.+}} nounwind
>     +// CHECK-DEBUG: attributes #[[FN_ATTRS]] = {{.+}} nounwind
>     +
>      #endif
>
>     Modified: cfe/trunk/test/OpenMP/simd_codegen.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_codegen.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/test/OpenMP/simd_codegen.cpp (original)
>     +++ cfe/trunk/test/OpenMP/simd_codegen.cpp Mon Mar  9 23:22:11 2015
>     @@ -1,6 +1,7 @@
>      // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s
>     -fexceptions -fcxx-exceptions -o - | FileCheck %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o
>     %t %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11
>     -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
>     +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10
>     -fopenmp=libiomp5 -fexceptions -fcxx-exceptions -gline-tables-only
>     -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
>      //
>      // expected-no-diagnostics
>      #ifndef HEADER
>     @@ -261,8 +262,8 @@ void iter_simple(IterDouble ia, IterDoub
>      //
>      // CHECK: store i32 0, i32* [[IT_OMP_IV:%[^,]+]]
>      // Calculate number of iterations before the loop body.
>     -// CHECK: [[DIFF1:%.+]] = call {{.*}}i32 @{{.*}}IterDouble{{.*}}
>     -// CHECK-NEXT: [[DIFF2:%.+]] = sub nsw i32 [[DIFF1]], 1
>     +// CHECK: [[DIFF1:%.+]] = invoke {{.*}}i32 @{{.*}}IterDouble{{.*}}
>     +// CHECK: [[DIFF2:%.+]] = sub nsw i32 [[DIFF1]], 1
>      // CHECK-NEXT: [[DIFF3:%.+]] = add nsw i32 [[DIFF2]], 1
>      // CHECK-NEXT: [[DIFF4:%.+]] = sdiv i32 [[DIFF3]], 1
>      // CHECK-NEXT: [[DIFF5:%.+]] = sub nsw i32 [[DIFF4]], 1
>     @@ -279,12 +280,12 @@ void iter_simple(IterDouble ia, IterDoub
>      // Start of body: calculate i from index:
>      // CHECK: [[IV1:%.+]] = load i32, i32*
>     [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
>      // Call of operator+ (i, IV).
>     -// CHECK: {{%.+}} = call {{.+}}
>     @{{.*}}IterDouble{{.*}}!llvm.mem.parallel_loop_access
>     ![[ITER_LOOP_ID]]
>     +// CHECK: {{%.+}} = invoke {{.+}} @{{.*}}IterDouble{{.*}}
>      // ... loop body ...
>         *i = *ic * 0.5;
>      // Float multiply and save result.
>      // CHECK: [[MULR:%.+]] = fmul double {{%.+}}, 5.000000e-01
>     -// CHECK-NEXT: call {{.+}} @{{.*}}IterDouble{{.*}}
>     +// CHECK-NEXT: invoke {{.+}} @{{.*}}IterDouble{{.*}}
>      // CHECK: store double [[MULR:%.+]], double* [[RESULT_ADDR:%.+]],
>     !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
>         ++ic;
>      //
>     @@ -403,13 +404,23 @@ void widened(float *a, float *b, float *
>      // CHECK: ret void
>      }
>
>     +// TERM_DEBUG-LABEL: bar
>     +int bar() {return 0;};
>     +
>     +// TERM_DEBUG-LABEL: parallel_simd
>      void parallel_simd(float *a) {
>      #pragma omp parallel
>      #pragma omp simd
>     -  // CHECK-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     invoke i32 {{.*}}bar{{.*}}()
>     +  // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     [[TERM_LPAD]]:
>     +  // TERM_DEBUG:     call void @__clang_call_terminate
>     +  // TERM_DEBUG:     unreachable
>        for (unsigned i = 131071; i <= 2147483647; i += 127)
>     -    a[i] += i;
>     +    a[i] += bar();
>      }
>     -
>     +// TERM_DEBUG: !{{[0-9]+}} = !MDLocation(line: 413,
>      #endif // HEADER
>
>
>     Modified: cfe/trunk/test/OpenMP/single_codegen.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/single_codegen.cpp?rev=231752&r1=231751&r2=231752&view=diff
>     ==============================================================================
>     --- cfe/trunk/test/OpenMP/single_codegen.cpp (original)
>     +++ cfe/trunk/test/OpenMP/single_codegen.cpp Mon Mar  9 23:22:11 2015
>     @@ -1,6 +1,7 @@
>      // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s
>     -fexceptions -fcxx-exceptions -o - | FileCheck %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o
>     %t %s
>      // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple
>     x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11
>     -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
>     +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10
>     -fopenmp=libiomp5 -fexceptions -fcxx-exceptions -gline-tables-only
>     -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
>      // expected-no-diagnostics
>
>      #ifndef HEADER
>     @@ -13,6 +14,7 @@
>      void foo() {}
>
>      // CHECK-LABEL: @main
>     +// TERM_DEBUG-LABEL: @main
>      int main() {
>        // CHECK:       [[A_ADDR:%.+]] = alloca i8
>        char a;
>     @@ -32,8 +34,8 @@ int main() {
>      // CHECK-NEXT:  [[IS_SINGLE:%.+]] = icmp ne i32 [[RES]], 0
>      // CHECK-NEXT:  br i1 [[IS_SINGLE]], label {{%?}}[[THEN:.+]],
>     label {{%?}}[[EXIT:.+]]
>      // CHECK:       [[THEN]]
>     -// CHECK-NEXT:  call void [[FOO]]()
>     -// CHECK-NEXT:  call void @__kmpc_end_single([[IDENT_T_TY]]*
>     [[DEFAULT_LOC]], i32 [[GTID]])
>     +// CHECK-NEXT:  invoke void [[FOO]]()
>     +// CHECK:       call void @__kmpc_end_single([[IDENT_T_TY]]*
>     [[DEFAULT_LOC]], i32 [[GTID]])
>      // CHECK-NEXT:  br label {{%?}}[[EXIT]]
>      // CHECK:       [[EXIT]]
>      #pragma omp single
>     @@ -43,13 +45,23 @@ int main() {
>        return a;
>      }
>
>     -// CHECK-LABEL: parallel_single
>     -void parallel_single(float *a) {
>     +// CHECK-LABEL:      parallel_single
>     +// TERM_DEBUG-LABEL: parallel_single
>     +void parallel_single() {
>      #pragma omp parallel
>      #pragma omp single
>     -  // CHECK-NOT: __kmpc_global_thread_num
>     -  for (unsigned i = 131071; i <= 2147483647; i += 127)
>     -    a[i] += i;
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call i32 @__kmpc_single({{.+}}), !dbg
>     [[DBG_LOC_START:![0-9]+]]
>     +  // TERM_DEBUG:     invoke void {{.*}}foo{{.*}}()
>     +  // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
>     +  // TERM_DEBUG-NOT: __kmpc_global_thread_num
>     +  // TERM_DEBUG:     call void @__kmpc_end_single({{.+}}), !dbg
>     [[DBG_LOC_END:![0-9]+]]
>     +  // TERM_DEBUG:     [[TERM_LPAD]]:
>     +  // TERM_DEBUG:     call void @__clang_call_terminate
>     +  // TERM_DEBUG:     unreachable
>     +  foo();
>      }
>     +// TERM_DEBUG-DAG: [[DBG_LOC_START]] = !MDLocation(line: 52,
>     +// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !MDLocation(line: 52,
>
>      #endif
>
>
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150310/6d29c6f4/attachment.html>


More information about the cfe-commits mailing list