message: Also consider attributes when getting context for Operation
  This CL also updates to use containing region as a fallback way to find
  context since functions will eventually become ops with regions.
diff: @@ -261,16 +261,17 @@ void Operation::destroy() {
  /// Return the context this operation is associated with.
  MLIRContext *Operation::getContext() {
  - // If we have a result or operand type, that is a constant time way to get
  - // to the context.
  + // If the op has an attribute, a result type, or an operand type, we have a
  + // constant time way to get to the context.
  + if (auto dict = attrs.getDictionary())
  + return dict.getContext();
  if (getNumResults())
  return getResult(0)->getType().getContext();
  if (getNumOperands())
  return getOperand(0)->getType().getContext();
  - // In the very odd case where we have no operands or results, fall back to
  - // doing a find.
  - return getFunction()->getContext();
  + // For the rest, fallback to find the context by the enclosing region.
  + return getContainingRegion()->getContext();
  }
  /// Return the dialact this operation is associated with, or nullptr if the
  