[llvm] [Matrix] Propagate shape information through cast instructions (PR #141869)

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 17:49:41 PDT 2025


================
@@ -232,6 +234,28 @@ static bool isUniformShape(Value *V) {
   if (I->isBinaryOp())
     return true;
 
+  if (auto *Cast = dyn_cast<CastInst>(V))
+    switch (Cast->getOpcode()) {
+    case llvm::Instruction::Trunc:
+    case llvm::Instruction::ZExt:
+    case llvm::Instruction::SExt:
+    case llvm::Instruction::FPToUI:
+    case llvm::Instruction::FPToSI:
+    case llvm::Instruction::UIToFP:
+    case llvm::Instruction::SIToFP:
+    case llvm::Instruction::FPTrunc:
+    case llvm::Instruction::FPExt:
+      return true;
+    case llvm::Instruction::AddrSpaceCast:
+    case CastInst::PtrToInt:
+    case CastInst::IntToPtr:
+    case CastInst::BitCast:
----------------
jroelofs wrote:

- [ ] add tests for these

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


More information about the llvm-commits mailing list