[clang] [openmp] [Clang][OpenMP] Mixed signed/unsigned trip counts fix (PR #226462)

Amit Tiwari via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 28 02:37:26 PDT 2026


================
@@ -17420,21 +17420,16 @@ SemaOpenMP::ActOnOpenMPFlattenDirective(ArrayRef<OMPClause *> Clauses,
   auto MakeDivisorInIVTy = [&](unsigned I) -> Expr * {
     Expr *N = MakeNumIterationsInIVTy(I);
     Expr *NCmp = MakeNumIterationsInIVTy(I);
-    auto MakeOne = [&]() -> ExprResult {
-      return SemaRef.PerformImplicitConversion(
-          SemaRef.ActOnIntegerConstant(CondLoc, 1).get(), IVTy,
-          AssignmentAction::Converting, /*AllowExplicit=*/true);
+    auto MakeOne = [&]() -> Expr * {
+      return IntegerLiteral::Create(Context, llvm::APInt(IVWidth, 1), IVTy,
+                                    CondLoc);
     };
-    ExprResult OneCmp = MakeOne();
-    ExprResult OneVal = MakeOne();
-    if (!OneCmp.isUsable() || !OneVal.isUsable())
-      return N;
     ExprResult TooSmall =
-        SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, NCmp, OneCmp.get());
+        SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, NCmp, MakeOne());
     if (!TooSmall.isUsable())
----------------
loopacino wrote:

Modified.

https://github.com/llvm/llvm-project/pull/226462


More information about the cfe-commits mailing list