Switch `getindex(::IRCode, ::Int)` to return Instruction (#43829)
This function is a helper to abstract over both the inserted and the
pending instruction streams. However, it predates the `Instruction`
abstraction and currently returns the stmt directly. The original
design was to have separate view types to access every field, but
since we have the `Instruction` abstraction now, we should just use
it, enabling things like:
```
ir[SSAValue(idx)][:flags] |= IR_FLAG_EFFECT_FREE
```
I want to do more with flags in the future, so this is a prepratory
refactor in that direction.