[clang] feat: included support for is_constant builtin (PR #166832)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 11 01:50:37 PST 2025
================
@@ -3043,6 +3043,44 @@ def CIR_ArrayDtor : CIR_ArrayInitDestroy<"array.dtor"> {
}];
}
+//===----------------------------------------------------------------------===//
+// IsConstantOp
+//===----------------------------------------------------------------------===//
+
+def CIR_IsConstantOp : CIR_Op<"is_constant", [Pure]> {
+ let summary = "Check if a value is a compile-time constant";
+ let description = [{
+ The `cir.is_constant` operation checks whether its input value is a
+ compile-time constant. This operation models the `__builtin_constant_p`
+ builtin function.
+
+ The operation takes a single operand of any CIR type and returns a signed
+ 32-bit integer. The result is 1 if the operand is a compile-time constant,
+ and 0 otherwise.
----------------
xlauko wrote:
This is not true, the expected result is bool
https://github.com/llvm/llvm-project/pull/166832
More information about the cfe-commits
mailing list