6db5ad7310
Default implementation of `IrStatement.transform` contained a cast to `IrStatement`. Since almost all IR elements inherit from IrStatement, this implementation was used in many subclasses. However, checkcast to interface is slow and this place was indeed noticeable in the profiler snapshot. Since not that many places really expected to get IrStatement out of IrStatement.transform, introduce a new method `transformStatement` that does this cast, and use it in all those places. Meanwhile, most implementations will use the IrElement's implementation of `transform` which merely invokes `accept` without casts.