================
@@ -263,6 +264,72 @@ static void terminateBody(CIRGenBuilderTy &builder,
mlir::Region &r,
b->erase();
}
+mlir::LogicalResult CIRGenFunction::emitIfStmt(const IfStmt &s) {
+ mlir::LogicalResult res = mlir::success();
+ // The else branch of a consteval if statement is always the only branch
+ // that can be runtime evaluated.
+ const Stmt *ConstevalExecuted;
+ if (s.isConsteval()) {
+ ConstevalExecuted = s.isNegatedConsteval() ? s.getThen() : s.getElse();
----------------
Andres-Salamanca wrote:
I added the test to a new `if-consteval.cpp`, based on [this
file](https://github.com/llvm/clangir/blob/main/clang/test/CIR/CodeGen/if-consteval.cpp).
Since we don't support `call` op yet, I tweaked the test slightly.
Also added the extra `RUN:` line.
https://github.com/llvm/llvm-project/pull/134333
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits