[llvm] [Matrix] Propagate shape information through Select insts (PR #141876)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 08:39:42 PDT 2025


================
@@ -269,6 +269,15 @@ computeShapeInfoForInst(Instruction *I,
       return OpShape->second;
   }
 
+  if (isa<SelectInst>(I)) {
+    auto OpShape = ShapeMap.find(I->getOperand(1));
+    if (OpShape != ShapeMap.end())
+      return OpShape->second;
+    OpShape = ShapeMap.find(I->getOperand(2));
+    if (OpShape != ShapeMap.end())
+      return OpShape->second;
----------------
fhahn wrote:

Picking the first operand with shape info should match what we do for uniform shapes, would probably be good to add a similar comment here (or unify the code below by only iterating over op1 & op2 for selects, via something like `drop_front(I->operands())` not sure how much extra code that would be)



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


More information about the llvm-commits mailing list