[Mlir-commits] [mlir] [mlir][Vector] Fold `vector.extract` from poison vector (PR #126122)

Andrea Faulds llvmlistbot at llvm.org
Fri Feb 7 08:17:10 PST 2025


================
@@ -1991,15 +1991,23 @@ static Value foldScalarExtractFromFromElements(ExtractOp extractOp) {
 
 /// Fold an insert or extract operation into an poison value when a poison index
 /// is found at any dimension of the static position.
-static ub::PoisonAttr
-foldPoisonIndexInsertExtractOp(MLIRContext *context,
-                               ArrayRef<int64_t> staticPos, int64_t poisonVal) {
+static Attribute foldPoisonIndexInsertExtractOp(MLIRContext *context,
+                                                ArrayRef<int64_t> staticPos,
+                                                int64_t poisonVal) {
   if (!llvm::is_contained(staticPos, poisonVal))
-    return ub::PoisonAttr();
+    return {};
----------------
andfau-amd wrote:

Just wanted to say thanks for this change because the old style made this code rather confusing when I was trying to debug poison folding the other day. This new style is a lot clearer. :)

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


More information about the Mlir-commits mailing list