================ @@ -13528,6 +13528,24 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, return Success(DidOverflow, E); } + case Builtin::BI__builtin_reduce_add: { + APValue Source; + if (!EvaluateAsRValue(Info, E->getArg(0), Source)) + return false; + + unsigned SourceLen = Source.getVectorLength(); + APSInt Reduced = Source.getVectorElt(0).getInt(); + for (unsigned EltNum = 1; EltNum < SourceLen; ++EltNum) { + if (!CheckedIntArithmetic( + Info, E, Reduced, Source.getVectorElt(EltNum).getInt(), + Reduced.getBitWidth() + 1, std::plus<APSInt>(), Reduced)) { + return false; + } ---------------- c8ef wrote:
Aha, you are right! This will align the patch more with llvm code style. https://github.com/llvm/llvm-project/pull/116243 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits