[ssa] avoid code motion to try-blocks (#13555)
commit00d871d103fc418c358c2a3589b88dbd5b1101f2
authorBernhard Urban <bernhard.urban@xamarin.com>
Wed, 20 Mar 2019 22:45:47 +0000 (20 23:45 +0100)
committermonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 20 Mar 2019 22:45:47 +0000 (20 18:45 -0400)
tree7ec316444a45555d7b8cfdfafaf57d24a16f1bb4
parent4e13c53451b60f08562edadd0cdd049e6834d6e6
[ssa] avoid code motion to try-blocks (#13555)

[ssa] avoid code motion to try-blocks

Consider
```
BB4:  // successor BB5, BB9
[...]
br [B9]

BB5: // catch handler block for BB4
[...]
br BB9

BB9:
aotconst R90
gc_safe_point R90
[...]
```

Previously, our invariant code motion pass would move `aotconst R90` to the end of BB4. Unfortunately, BB4 contains instructions that can cause an exception and thus control flow is broken and continues to BB5. `aotconst R90` wouldn't be loaded correctly in this scenario.

When lowered to LLVM IR this is more obvious, and the verification pass of LLVM catches this.

Fixes https://github.com/mono/mono/issues/13460
mono/mini/ssa.c