Instruction has mayHaveSideEffects method that returns true if mayThrow return true because this is called internally in the first method
Ideally we should be using SCEV loop properties here, which are cached. Unfortunately, the SCEV notion of "side effect" differs from what is needed here (SCEV ignores simple writes).
We could at least use loopHasNoAbnormalExits() though, which uses isGuaranteedToTransfer(). And I do believe that one is needed here -- I don't think the transform is valid if the loop contains a non-willreturn readonly call. It would be good to add a test for that case.