[Mlir-commits] [mlir] [MLIR][LLVMIR] Issue when importing LLVM modules which contain LandingPad Instructions (PR #171107)

Tobias Gysi llvmlistbot at llvm.org
Mon Dec 8 03:54:21 PST 2025


================
@@ -1765,17 +1765,25 @@ FailureOr<Value> ModuleImport::convertConstant(llvm::Constant *constant) {
     return lookupValue(inst);
   }
 
+  // Convert zero-initialized aggregates to ZeroOp.
+  if (auto *aggregateZero = dyn_cast<llvm::ConstantAggregateZero>(constant)) {
+    Type type = convertType(aggregateZero->getType());
+    return builder.create<ZeroOp>(loc, type).getResult();
+  }
+
   // Convert aggregate constants.
   if (isa<llvm::ConstantAggregate>(constant) ||
       isa<llvm::ConstantAggregateZero>(constant)) {
     // Lookup the aggregate elements that have been converted before.
     SmallVector<Value> elementValues;
+    bool isAggregate = false;
----------------
gysit wrote:

Since we handle  `llvm::ConstantAggregateZero` above we should probably just remove if from this branch? Or in other words, we should never get here if constant is a zero aggregate constant.

https://github.com/llvm/llvm-project/pull/171107


More information about the Mlir-commits mailing list