[Mlir-commits] [mlir] [mlir] canonicalizer: shape_cast(poison) -> poison (PR #133988)

James Newling llvmlistbot at llvm.org
Mon Apr 7 10:16:11 PDT 2025


================
@@ -5611,28 +5612,27 @@ LogicalResult ShapeCastOp::verify() {
 }
 
 OpFoldResult ShapeCastOp::fold(FoldAdaptor adaptor) {
+
   // No-op shape cast.
-  if (getSource().getType() == getResult().getType())
+  if (getSource().getType() == getType())
     return getSource();
 
   // Canceling shape casts.
   if (auto otherOp = getSource().getDefiningOp<ShapeCastOp>()) {
-    if (getResult().getType() == otherOp.getSource().getType())
----------------
newling wrote:

Some NFC here (remove redundant casts)

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


More information about the Mlir-commits mailing list