[clang] [CIR] Add poison attribute (PR #150760)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 26 11:21:43 PDT 2025


================
@@ -629,6 +629,11 @@ static Value tryFoldCastChain(cir::CastOp op) {
 }
 
 OpFoldResult cir::CastOp::fold(FoldAdaptor adaptor) {
+  if (mlir::isa_and_present<PoisonAttr>(adaptor.getSrc())) {
+    // Propagate poison value
+    return PoisonAttr::get(getContext(), getType());
----------------
xlauko wrote:

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

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


More information about the cfe-commits mailing list