[Mlir-commits] [mlir] [mlir][llvm] Implement ConstantLike for ZeroOp, UndefOp, PoisonOp (PR #93690)

Markus Böck llvmlistbot at llvm.org
Wed May 29 07:54:38 PDT 2024


================
@@ -2555,6 +2555,24 @@ Region *LLVMFuncOp::getCallableRegion() {
   return &getBody();
 }
 
+//===----------------------------------------------------------------------===//
+// UndefOp.
+//===----------------------------------------------------------------------===//
+
+/// Fold an undef operation to a dedicated undef attribute.
+OpFoldResult LLVM::UndefOp::fold(FoldAdaptor) {
+  return mlir::LLVM::UndefAttr::get(getContext());
----------------
zero9178 wrote:

```suggestion
  return LLVM::UndefAttr::get(getContext());
```
Nit: We usually leave out "obvious" namespaces. Same below

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


More information about the Mlir-commits mailing list