[Mlir-commits] [mlir] [mlir][loops] Add getters for multi dim loop variables in `LoopLikeOpInterface` (PR #94516)
    Ivan Butygin 
    llvmlistbot at llvm.org
       
    Wed Jun  5 11:55:09 PDT 2024
    
    
  
================
@@ -235,6 +231,35 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
   }];
 
   let extraSharedClassDeclaration = [{
+    /// If there is a single induction variable return it, otherwise return
+    /// std::nullopt.
+    ::std::optional<::mlir::Value> getSingleInductionVar() {
+      if (this->getInductionVars().size() == 1)
----------------
Hardcode84 wrote:
this code will create a temporary `SmallVector` just to get size and then another one on the next line, better to cache.
https://github.com/llvm/llvm-project/pull/94516
    
    
More information about the Mlir-commits
mailing list