[clang] [CIR] Make cir.alloca alignment mandatory with default 0 (PR #172663)
Sirui Mu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 6 06:22:03 PST 2026
================
@@ -530,7 +530,7 @@ def CIR_AllocaOp : CIR_Op<"alloca", [
StrAttr:$name,
UnitAttr:$init,
UnitAttr:$constant,
- ConfinedAttr<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$alignment,
+ ConfinedAttr<DefaultValuedAttr<I64Attr, "0">, [IntMinValue<0>]>:$alignment,
----------------
Lancern wrote:
We agreed that the attribute should be required. The question here is should we have an alloca _builder_ that does not take the alignment as a parameter and instead infer the alignment from the alloca-ed type. We do have code in CIRGen that creates alloca operations without offering an alignment. It's fine to not have this kind of overload, in which case this patch needs to update those CIRGen code, too.
https://github.com/llvm/llvm-project/pull/172663
More information about the cfe-commits
mailing list