Avoid one branch in Operation::getOpOperand()/getOperand() (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Wed, 13 Oct 2021 09:06:59 +0000 (09:06 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Wed, 13 Oct 2021 09:07:06 +0000 (09:07 +0000)
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

index ac55edd9b00339afe200ccaa2bc09b15dce8bb51..d9ba5985aae65bb8580b5a8671ca24fd61463c8a 100644 (file)
@@ -264,7 +264,9 @@ public:
                                           : 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;