[Mlir-commits] [flang] [mlir] [LLVM-Flang][OpenMP] Fix to resolve the crash with SIMD aligned clause. (PR #150612)
Kiran Chandramohan
llvmlistbot at llvm.org
Tue Jul 29 03:51:30 PDT 2025
================
@@ -2893,6 +2893,15 @@ convertOmpSimd(Operation &opInst, llvm::IRBuilderBase &builder,
alignment = builder.getInt64(intAttr.getInt());
assert(ty->isPointerTy() && "Invalid type for aligned variable");
assert(alignment && "Invalid alignment value");
+ // Check if the alignment value is not a power of 2. If so, skip emitting
+ // alignment.
+ if (!intAttr.getValue().isPowerOf2()) {
+ emitWarning(simdOp->getLoc())
+ << "The specified alignment value, " << intAttr.getInt()
+ << " is not a power of two and will be ignored";
----------------
kiranchandramohan wrote:
Could you add a test for this warning as well? There are similar tests in `mlir/test/Target/LLVMIR/openmp-todo.mlir`.
https://github.com/llvm/llvm-project/pull/150612
More information about the Mlir-commits
mailing list