Skip to content

Commit fd150c2

Browse files
author
Sunil Kuravinakop
committed
Replacing getCapturedExprFromImplicitCastExpr() with
CGF->EmitBranchOnBoolExpr().
1 parent f186576 commit fd150c2

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4529,21 +4529,6 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) {
45294529
emitMaster(*this, S);
45304530
}
45314531

4532-
static Expr *getCapturedExprFromImplicitCastExpr(Expr *Cond) {
4533-
4534-
Expr *SubExpr = Cond->IgnoreParenImpCasts();
4535-
4536-
if (auto *DeclRef = dyn_cast<DeclRefExpr>(SubExpr)) {
4537-
if (auto *CapturedExprDecl =
4538-
dyn_cast<OMPCapturedExprDecl>(DeclRef->getDecl())) {
4539-
4540-
// Retrieve the initial expression from the captured expression
4541-
return CapturedExprDecl->getInit();
4542-
}
4543-
}
4544-
return Cond;
4545-
}
4546-
45474532
static Expr *replaceWithNewTraitsOrDirectCall(Stmt *AssocExpr,
45484533
CallExpr *ReplacementFunction) {
45494534
Expr *FinalCall = ReplacementFunction;
@@ -4579,12 +4564,11 @@ static void transformCallInStmt(Stmt *StmtP) {
45794564

45804565
static void emitIfElse(CodeGenFunction *CGF, Expr *Condition,
45814566
Stmt *AssociatedStmt) {
4582-
llvm::Value *CondValue = CGF->EvaluateExprAsBool(Condition);
45834567
llvm::BasicBlock *ThenBlock = CGF->createBasicBlock("if.then");
45844568
llvm::BasicBlock *ElseBlock = CGF->createBasicBlock("if.else");
45854569
llvm::BasicBlock *MergeBlock = CGF->createBasicBlock("if.end");
45864570

4587-
CGF->Builder.CreateCondBr(CondValue, ThenBlock, ElseBlock);
4571+
CGF->EmitBranchOnBoolExpr(Condition, ThenBlock, ElseBlock, 0);
45884572

45894573
// Emit the else block.
45904574
Stmt *ElseStmt = AssociatedStmt;
@@ -4624,17 +4608,14 @@ void CodeGenFunction::EmitOMPDispatchDirective(const OMPDispatchDirective &S) {
46244608
if (const OMPNovariantsClause *NoVariantsC =
46254609
OMPExecutableDirective::getSingleClause<OMPNovariantsClause>(
46264610
Clauses)) {
4627-
Condition =
4628-
getCapturedExprFromImplicitCastExpr(NoVariantsC->getCondition());
4611+
Condition = NoVariantsC->getCondition();
46294612
} else {
46304613
const OMPNocontextClause *NoContextC =
46314614
OMPExecutableDirective::getSingleClause<OMPNocontextClause>(
46324615
Clauses);
4633-
Condition =
4634-
getCapturedExprFromImplicitCastExpr(NoContextC->getCondition());
4616+
Condition = NoContextC->getCondition();
46354617
}
46364618
OMPLexicalScope Scope(*this, S, OMPD_dispatch);
4637-
/* OMPC_novariants or OMPC_nocontext present */
46384619
emitIfElse(this, Condition, AssociatedStmt);
46394620
}
46404621
} else

0 commit comments

Comments
 (0)