From 6f5c6858392415fa245f99ebdb9da0795a85c1a6 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 13 Oct 2021 09:06:59 +0000 Subject: [PATCH] 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 --- mlir/include/mlir/IR/Operation.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 @@ public: : MutableArrayRef(); } - 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;