================
@@ -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:

For example:

https://github.com/llvm/llvm-project/blob/e8eb20b0011d7c0628db587da37d1495368f0377/clang/lib/CIR/CodeGen/CIRGenExpr.cpp#L2484

Here we do provide a value for the alignment attribute, but the provided value 
is 0. A further tracing shows that this alignment of 0 is passed all the way 
down to the LLVMIR dialect:

https://github.com/llvm/llvm-project/blob/e8eb20b0011d7c0628db587da37d1495368f0377/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp#L1564-L1565

And it's caught by the builder of `llvm.alloca`:

https://github.com/llvm/llvm-project/blob/c8941df6a1e4ed5e1ba3287985a60e1d7512c250/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td#L267-L270

https://github.com/llvm/llvm-project/pull/172663
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to