@@ -375,7 +375,8 @@ Expr *SemaAMDGPU::ExpandAMDGPUPredicateBI(CallExpr *CE) {
375375 auto Loc = CE->getExprLoc ();
376376
377377 if (!CE->getBuiltinCallee ())
378- return IntegerLiteral::Create (Ctx, False, BoolTy, Loc);
378+ return *ExpandedPredicates.insert (
379+ IntegerLiteral::Create (Ctx, False, BoolTy, Loc)).first ;
379380
380381 auto P = false ;
381382 auto BI = CE->getBuiltinCallee ();
@@ -398,7 +399,7 @@ Expr *SemaAMDGPU::ExpandAMDGPUPredicateBI(CallExpr *CE) {
398399 }
399400 if (Ctx.getTargetInfo ().getTriple ().isSPIRV ()) {
400401 CE->setType (BoolTy);
401- return CE ;
402+ return *ExpandedPredicates. insert (CE). first ;
402403 }
403404
404405 if (auto TID = Ctx.getTargetInfo ().getTargetID ())
@@ -412,7 +413,7 @@ Expr *SemaAMDGPU::ExpandAMDGPUPredicateBI(CallExpr *CE) {
412413
413414 if (Ctx.getTargetInfo ().getTriple ().isSPIRV ()) {
414415 CE->setType (BoolTy);
415- return CE ;
416+ return *ExpandedPredicates. insert (CE). first ;
416417 }
417418
418419 auto *FD = cast<FunctionDecl>(Arg->getReferencedDeclOfCallee ());
@@ -424,6 +425,11 @@ Expr *SemaAMDGPU::ExpandAMDGPUPredicateBI(CallExpr *CE) {
424425 P = Builtin::evaluateRequiredTargetFeatures (RF, CF);
425426 }
426427
427- return IntegerLiteral::Create (Ctx, P ? True : False, BoolTy, Loc);
428+ return *ExpandedPredicates.insert (
429+ IntegerLiteral::Create (Ctx, P ? True : False, BoolTy, Loc)).first ;
430+ }
431+
432+ bool SemaAMDGPU::IsPredicate (Expr *E) const {
433+ return ExpandedPredicates.contains (E);
428434}
429435} // namespace clang
0 commit comments