[llvm] [Matrix] Propagate shape information through (f)abs insts (PR #141704)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 2 08:47:04 PDT 2025
================
@@ -2198,6 +2210,49 @@ class LowerMatrixIntrinsics {
return true;
}
+ /// Lower uniform shape intrinsics, if shape information is available.
+ bool VisitUniformIntrinsic(IntrinsicInst *Inst) {
+ auto I = ShapeMap.find(Inst);
+ if (I == ShapeMap.end())
+ return false;
+
+ IRBuilder<> Builder(Inst);
+ ShapeInfo &Shape = I->second;
+
+ MatrixTy Result;
+
+ switch (Inst->getIntrinsicID()) {
+ case Intrinsic::abs:
+ case Intrinsic::fabs: {
+ Value *Op = Inst->getOperand(0);
+
+ MatrixTy M = getMatrix(Op, Shape, Builder);
+
+ Builder.setFastMathFlags(getFastMathFlags(Inst));
+
+ for (unsigned I = 0; I < Shape.getNumVectors(); ++I)
----------------
fhahn wrote:
Does using `vectors()` work here?
```suggestion
for (auto &Vector : M.vectors()) {
```
https://github.com/llvm/llvm-project/pull/141704
More information about the llvm-commits
mailing list