================
@@ -2239,16 +2249,18 @@ static OpFoldResult
 foldUnaryBitOp(mlir::Attribute inputAttr,
                llvm::function_ref<llvm::APInt(const llvm::APInt &)> func,
                bool poisonZero = false) {
+  if (mlir::isa_and_present<PoisonAttr>(inputAttr)) {
+    // Propagate poison value
+    return inputAttr;
+  }
+
   auto input = mlir::dyn_cast_if_present<IntAttr>(inputAttr);
   if (!input)
     return nullptr;
 
   llvm::APInt inputValue = input.getValue();
-  if (poisonZero && inputValue.isZero()) {
-    // TODO(cir): maybe we should return a poison value here?
-    assert(!MissingFeatures::poisonAttr());
-    return nullptr;
-  }
+  if (poisonZero && inputValue.isZero())
+    return PoisonAttr::get(input.getType());
----------------
xlauko wrote:

```suggestion
    return cir::PoisonAttr::get(input.getType());
```

https://github.com/llvm/llvm-project/pull/150760
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to