The raw OpView classes are used to bypass the constructors of OpView
subclasses, but having a separate class can create some confusing
behaviour, e.g.:
op = MyOp(...) # fails, lhs is 'MyOp', rhs is '_MyOp' assert type(op) == type(op.operation.opview)
Instead we can use __new__ to achieve the same thing without a
separate class:
my_op = MyOp.__new__(MyOp) OpView.__init__(my_op, op)
Not sure what the original concern with __new__ was, it seems valid to use as far as I can tell. I didn't see any discussion about this on the original review either: https://reviews.llvm.org/D89932