================
@@ -908,6 +908,69 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
     incrementProfileCounter(&S);
 }
 
+bool CodeGenFunction::checkIfLoopMustProgress(const Expr 
*ControllingExpression,
+                                              bool HasEmptyBody) {
+  if (CGM.getCodeGenOpts().getFiniteLoops() ==
+      CodeGenOptions::FiniteLoopsKind::Never)
+    return false;
+
+  // Now apply rules for plain C (see  6.8.5.6 in C11).
+  // Loops with constant conditions do not have to make progress in any C
+  // version.
+  // As an extension, we consisider loops whose constant expression
+  // can be constant-folded.
+  Expr::EvalResult Result;
+  bool CondIsConstInt =
----------------
cor3ntin wrote:

>  I guess we could also say that if the condition would evaluate to false if 
> we treat it as manifestly constant-evaluated, it's not manifestly 
> constant-evaluated. So we'd amend [expr.const]p20 to say something like: "An 
> expression or conversion is manifestly constant-evaluated if it is [...] the 
> condition of trivially empty iteration statement, is a constant expression 
> when interpreted as a constant-expression, and the constant expression would 
> evaluate to true".

Do we have _any_ motivation for doing so?
In addition of being extremely mind-bendy, there is no practical application.


https://github.com/llvm/llvm-project/pull/90066
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to