[clang] [Clang] Allow the value of unroll count to be zero in `#pragma GCC unroll` and `#pragma unroll` (PR #88666)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 17 06:21:27 PDT 2024
================
@@ -3903,7 +3904,14 @@ bool Sema::CheckLoopHintExpr(Expr *E, SourceLocation Loc) {
if (R.isInvalid())
return true;
- bool ValueIsPositive = ValueAPS.isStrictlyPositive();
+ // GCC allows the value of unroll count to be 0.
+ // https://gcc.gnu.org/onlinedocs/gcc/Loop-Specific-Pragmas.html says
+ // "The values of 0 and 1 block any unrolling of the loop."
+ // The values doesn't have to be strictly positive in '#pragma GCC unroll' and
+ // '#pragma unroll' cases.
+ bool ValueIsPositive = PragmaNameInfo->isStr("unroll")
----------------
erichkeane wrote:
Thanks! I don't think we should do those changes in THIS patch, but I'd be ok with a followup patch to do that movement.
https://github.com/llvm/llvm-project/pull/88666
More information about the cfe-commits
mailing list