[PATCH] D109321: [clang][OpenMP] Fix the bug in codegen for ordered directive

Peixin Qiao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 6 06:27:07 PDT 2021


peixin created this revision.
peixin added reviewers: jhuber6, jdoerfert, kiranchandramohan, Meinersbur, clementval, kiranktp, Leporacanthicus, bryanpkc, arnamoy10, Chuanfeng.
peixin added projects: LLVM, clang.
Herald added subscribers: guansong, yaxunl.
peixin requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.

For the ordered construct with the simd clause, the outlined region
cannot be inlined. Otherwise, there may be unexpected behavior when
the captured statements are vectorized.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109321

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===================================================================
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -5362,8 +5362,8 @@
   CGF.CapturedStmtInfo = &CapStmtInfo;
   llvm::Function *Fn = CGF.GenerateOpenMPCapturedStmtFunction(*S, Loc);
   Fn->setDoesNotRecurse();
-  if (CGM.getCodeGenOpts().OptimizationLevel != 0)
-    Fn->addFnAttr(llvm::Attribute::AlwaysInline);
+  Fn->removeFnAttr(llvm::Attribute::AlwaysInline);
+  Fn->addFnAttr(llvm::Attribute::NoInline);
   return Fn;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109321.370906.patch
Type: text/x-patch
Size: 570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210906/d181bdeb/attachment.bin>


More information about the cfe-commits mailing list