[PATCH] D98135: [OpenMP][InstrProfiling] Fix a missing instr profiling counter

Xun Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 6 20:40:28 PST 2021


lxfind created this revision.
lxfind added reviewers: ABataev, MaskRay.
Herald added subscribers: hoy, modimo, wenlei, guansong, yaxunl.
lxfind requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

When emitting a function body there needs to be a instr profiling counter emitted. Otherwise instr profiling won't work for this function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98135

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp


Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1028,7 +1028,7 @@
       getThreadIDVariable()->getType()->castAs<PointerType>());
 }
 
-void CGOpenMPRegionInfo::EmitBody(CodeGenFunction &CGF, const Stmt * /*S*/) {
+void CGOpenMPRegionInfo::EmitBody(CodeGenFunction &CGF, const Stmt *S) {
   if (!CGF.HaveInsertPoint())
     return;
   // 1.2.2 OpenMP Language Terminology
@@ -1037,6 +1037,7 @@
   // 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();
+  CGF.incrementProfileCounter(S);
   CodeGen(CGF);
   CGF.EHStack.popTerminate();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98135.328833.patch
Type: text/x-patch
Size: 808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210307/0330b5bf/attachment.bin>


More information about the cfe-commits mailing list