================ @@ -4368,8 +4363,19 @@ template <class Emitter> bool Compiler<Emitter>::visitIfStmt(const IfStmt *IS) { if (!visitDeclStmt(CondDecl)) return false; - if (!this->visitBool(IS->getCond())) - return false; + // Compile condition. + if (IS->isNonNegatedConsteval()) { + if (!this->emitIsConstantContext(IS)) + return false; + } else if (IS->isNegatedConsteval()) { + if (!this->emitIsConstantContext(IS)) + return false; + if (!this->emitInv(IS)) + return false; + } else { + if (!this->visitBool(IS->getCond())) + return false; + } ---------------- tbaederr wrote:
I understand your concern but I think this is conceptually no different than ```c++ constexpr int f(bool b) { if (!b) { goto a; a:; } else { } return 1; } ``` where the current interpreter would also only evaluate one of the branches while the bytecode interpreter needs to generate code for both. https://github.com/llvm/llvm-project/pull/104707 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits