r230331 - [OPENMP] Update codegen for 'omp flush' directive.

Alexey Bataev a.bataev at hotmail.com
Tue Feb 24 04:55:09 PST 2015


Author: abataev
Date: Tue Feb 24 06:55:09 2015
New Revision: 230331

URL: http://llvm.org/viewvc/llvm-project?rev=230331&view=rev
Log:
[OPENMP] Update codegen for 'omp flush' directive.
__kmpc_omp_flush() runtime library now has only one argument and is not a vararg
anymore. This update makes the codegen compatible with these changes.

Modified:
    cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
    cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
    cfe/trunk/test/OpenMP/flush_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=230331&r1=230330&r2=230331&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Feb 24 06:55:09 2015
@@ -452,10 +452,10 @@ CGOpenMPRuntime::CreateRuntimeFunction(O
     break;
   }
   case OMPRTL__kmpc_flush: {
-    // Build void __kmpc_flush(ident_t *loc, ...);
+    // Build void __kmpc_flush(ident_t *loc);
     llvm::Type *TypeParams[] = {getIdentTyPointerTy()};
     llvm::FunctionType *FnTy =
-        llvm::FunctionType::get(CGM.VoidTy, TypeParams, /*isVarArg*/ true);
+        llvm::FunctionType::get(CGM.VoidTy, TypeParams, /*isVarArg*/ false);
     RTLFn = CGM.CreateRuntimeFunction(FnTy, "__kmpc_flush");
     break;
   }
@@ -986,11 +986,7 @@ void CGOpenMPRuntime::EmitOMPNumThreadsC
 
 void CGOpenMPRuntime::EmitOMPFlush(CodeGenFunction &CGF, ArrayRef<const Expr *>,
                                    SourceLocation Loc) {
-  // Build call void __kmpc_flush(ident_t *loc, ...)
-  // FIXME: List of variables is ignored by libiomp5 runtime, no need to
-  // generate it, just request full memory fence.
-  llvm::Value *Args[] = {EmitOpenMPUpdateLocation(CGF, Loc),
-                         llvm::ConstantInt::get(CGM.Int32Ty, 0)};
+  // Build call void __kmpc_flush(ident_t *loc)
   auto *RTLFn = CreateRuntimeFunction(OMPRTL__kmpc_flush);
-  CGF.EmitRuntimeCall(RTLFn, Args);
+  CGF.EmitRuntimeCall(RTLFn, EmitOpenMPUpdateLocation(CGF, Loc));
 }

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=230331&r1=230330&r2=230331&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h Tue Feb 24 06:55:09 2015
@@ -82,7 +82,7 @@ private:
     // Call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid,
     // kmp_int32 num_threads);
     OMPRTL__kmpc_push_num_threads,
-    // Call to void __kmpc_flush(ident_t *loc, ...);
+    // Call to void __kmpc_flush(ident_t *loc);
     OMPRTL__kmpc_flush,
     // Call to kmp_int32 __kmpc_master(ident_t *, kmp_int32 global_tid);
     OMPRTL__kmpc_master,

Modified: cfe/trunk/test/OpenMP/flush_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/flush_codegen.cpp?rev=230331&r1=230330&r2=230331&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/flush_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/flush_codegen.cpp Tue Feb 24 06:55:09 2015
@@ -19,16 +19,16 @@ int main() {
   static int a;
 #pragma omp flush
 #pragma omp flush(a)
-  // CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
-  // CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
+  // CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
+  // CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
   return tmain(a);
   // CHECK: call {{.*}} [[TMAIN:@.+]](
   // CHECK: ret
 }
 
 // CHECK: [[TMAIN]]
-// CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
-// CHECK: call void (%{{.+}}*, ...)* @__kmpc_flush(%{{.+}}* {{(@|%).+}}, i32 0)
+// CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
+// CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
 // CHECK: ret
 
 #endif





More information about the cfe-commits mailing list