[Mlir-commits] [mlir] [mlir][llvm] Use zeroinitializer for TargetExtType (PR #66510)

Markus Böck llvmlistbot at llvm.org
Fri Sep 15 14:12:15 PDT 2023


================
@@ -2554,16 +2564,7 @@ LogicalResult LLVM::ConstantOp::verify() {
     return success();
   }
   if (auto targetExtType = dyn_cast<LLVMTargetExtType>(getType())) {
-    if (!targetExtType.hasProperty(LLVM::LLVMTargetExtType::HasZeroInit))
-      return emitOpError()
-             << "target extension type does not support zero-initializer";
-    // Only a single, zero integer attribute (=zeroinitializer) is allowed for a
-    // global value with TargetExtType.
-    if (!isa<IntegerAttr>(getValue()) || !isZeroAttribute(getValue()))
-      return emitOpError()
-             << "only zero-initializer allowed for target extension types";
-
-    return success();
+    return emitOpError() << "target extension type does not support constants.";
----------------
zero9178 wrote:

This reads somewhat backwards to me. I think it makes more sense to say that the constant op doesn't support target extension types right? I think it might even make more sense to remove this `if` entirely and have it fallthrough to the more general error message.
That way it is shown what the constant op does support

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


More information about the Mlir-commits mailing list