[Mlir-commits] [mlir] [MLIR][LLVMIR] Issue when importing LLVM modules which contain LandingPad Instructions (PR #171107)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Dec 8 03:46:49 PST 2025
================
@@ -1784,12 +1792,18 @@ FailureOr<Value> ModuleImport::convertConstant(llvm::Constant *constant) {
assert(llvm::count(elementValues, nullptr) == 0 &&
"expected all elements have been converted before");
- // Generate an UndefOp as root value and insert the aggregate elements.
+ // Generate a root value and insert the aggregate elements.
+ // For ConstantAggregateZero, use ZeroOp to preserve zero-initialization
+ // semantics. Otherwise use UndefOp as the root.Type rootType = convertType(constant->getType());
Type rootType = convertType(constant->getType());
bool isArrayOrStruct = isa<LLVMArrayType, LLVMStructType>(rootType);
assert((isArrayOrStruct || LLVM::isCompatibleVectorType(rootType)) &&
"unrecognized aggregate type");
- Value root = UndefOp::create(builder, loc, rootType);
+ Value root;
+ if (isAggregate)
+ root = builder.create<ZeroOp>(loc, rootType);
+ else
+ root = builder.create<UndefOp>(loc, rootType);
----------------
Men-cotton wrote:
Same here.
https://github.com/llvm/llvm-project/pull/171107
More information about the Mlir-commits
mailing list