summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorSamuel Antao <sfantao@us.ibm.com>2016-01-05 19:16:13 +0000
committerSamuel Antao <sfantao@us.ibm.com>2016-01-05 19:16:13 +0000
commit7d5de9a1ee5b38da43cbfca586d31b24e94c8ed1 (patch)
tree5c538570059a0ebda48ce8fcd4df3d2110244a0e /clang/lib/CodeGen/CGStmtOpenMP.cpp
parenta1c5347982184dd42509d1b8309490f918b4eeb5 (diff)
downloadbcm5719-llvm-7d5de9a1ee5b38da43cbfca586d31b24e94c8ed1.tar.gz
bcm5719-llvm-7d5de9a1ee5b38da43cbfca586d31b24e94c8ed1.zip
[OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and device codegen.
It was causing two regression, so I'm reverting until the cause is found. llvm-svn: 256858
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp39
1 files changed, 9 insertions, 30 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 14917c20c53..82011984f8e 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2571,8 +2571,14 @@ void CodeGenFunction::EmitOMPTargetDirective(const OMPTargetDirective &S) {
llvm::SmallVector<llvm::Value *, 16> CapturedVars;
GenerateOpenMPCapturedVars(CS, CapturedVars);
- llvm::Function *Fn = nullptr;
- llvm::Constant *FnID = nullptr;
+ // Emit target region as a standalone region.
+ auto &&CodeGen = [&CS](CodeGenFunction &CGF) {
+ CGF.EmitStmt(CS.getCapturedStmt());
+ };
+
+ // Obtain the target region outlined function.
+ llvm::Value *Fn =
+ CGM.getOpenMPRuntime().emitTargetOutlinedFunction(S, CodeGen);
// Check if we have any if clause associated with the directive.
const Expr *IfCond = nullptr;
@@ -2587,34 +2593,7 @@ void CodeGenFunction::EmitOMPTargetDirective(const OMPTargetDirective &S) {
Device = C->getDevice();
}
- // Check if we have an if clause whose conditional always evaluates to false
- // or if we do not have any targets specified. If so the target region is not
- // an offload entry point.
- bool IsOffloadEntry = true;
- if (IfCond) {
- bool Val;
- if (ConstantFoldsToSimpleInteger(IfCond, Val) && !Val)
- IsOffloadEntry = false;
- }
- if (CGM.getLangOpts().OMPTargetTriples.empty())
- IsOffloadEntry = false;
-
- assert(CurFuncDecl && "No parent declaration for target region!");
- StringRef ParentName;
- // In case we have Ctors/Dtors we use the complete type variant to produce
- // the mangling of the device outlined kernel.
- if (auto *D = dyn_cast<CXXConstructorDecl>(CurFuncDecl))
- ParentName = CGM.getMangledName(GlobalDecl(D, Ctor_Complete));
- else if (auto *D = dyn_cast<CXXDestructorDecl>(CurFuncDecl))
- ParentName = CGM.getMangledName(GlobalDecl(D, Dtor_Complete));
- else
- ParentName =
- CGM.getMangledName(GlobalDecl(cast<FunctionDecl>(CurFuncDecl)));
-
- CGM.getOpenMPRuntime().emitTargetOutlinedFunction(S, ParentName, Fn, FnID,
- IsOffloadEntry);
-
- CGM.getOpenMPRuntime().emitTargetCall(*this, S, Fn, FnID, IfCond, Device,
+ CGM.getOpenMPRuntime().emitTargetCall(*this, S, Fn, IfCond, Device,
CapturedVars);
}
OpenPOWER on IntegriCloud