[mlir][sparse] LICM for SparseTensorReader::readCOO
This commit performs two related changes. First we adjust `readCOOValue` to take the `IsPattern` bool as a template parameter rather than a function argument. Second we factor `readCOOLoop` out from `readCOO`, and template it on `IsPattern` and `IsSymmetric`. Together this moves all the assertions and header-dependent conditionals out of the main for-loop of `readCOO`. The only remaining conditional is in the `IsSymmetric=true` variant: checking whether the element is on the diagonal or not (which cannot be lifted out of the loop). Depends On D138363 Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D138365
Loading
Please sign in to comment