[Mlir-commits] [mlir] 6f5c685 - Avoid one branch in Operation::getOpOperand()/getOperand() (NFC)

Mehdi Amini llvmlistbot at llvm.org
Wed Oct 13 02:07:15 PDT 2021


Author: Mehdi Amini
Date: 2021-10-13T09:07:06Z
New Revision: 6f5c6858392415fa245f99ebdb9da0795a85c1a6

URL: https://github.com/llvm/llvm-project/commit/6f5c6858392415fa245f99ebdb9da0795a85c1a6
DIFF: https://github.com/llvm/llvm-project/commit/6f5c6858392415fa245f99ebdb9da0795a85c1a6.diff

LOG: Avoid one branch in Operation::getOpOperand()/getOperand() (NFC)

Skip the check on "hasOperandStorage" since the array will be indexed anyway.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D111696

Added: 
    

Modified: 
    mlir/include/mlir/IR/Operation.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h
index ac55edd9b003..d9ba5985aae6 100644
--- a/mlir/include/mlir/IR/Operation.h
+++ b/mlir/include/mlir/IR/Operation.h
@@ -264,7 +264,9 @@ class alignas(8) Operation final
                                           : MutableArrayRef<OpOperand>();
   }
 
-  OpOperand &getOpOperand(unsigned idx) { return getOpOperands()[idx]; }
+  OpOperand &getOpOperand(unsigned idx) {
+    return getOperandStorage().getOperands()[idx];
+  }
 
   // Support operand type iteration.
   using operand_type_iterator = operand_range::type_iterator;


        


More information about the Mlir-commits mailing list