createNegativeShiftCheck creates an assertion that panics if the given shift value is negative. This function assumes that the shift value is signed.
(shift llvm.Value)
| 205 | // createNegativeShiftCheck creates an assertion that panics if the given shift value is negative. |
| 206 | // This function assumes that the shift value is signed. |
| 207 | func (b *builder) createNegativeShiftCheck(shift llvm.Value) { |
| 208 | if b.info.nobounds { |
| 209 | // Function disabled bounds checking - skip shift check. |
| 210 | return |
| 211 | } |
| 212 | |
| 213 | // isNegative = shift < 0 |
| 214 | isNegative := b.CreateICmp(llvm.IntSLT, shift, llvm.ConstInt(shift.Type(), 0, false), "") |
| 215 | b.createRuntimeAssert(isNegative, "shift", "negativeShiftPanic") |
| 216 | } |
| 217 | |
| 218 | // createDivideByZeroCheck asserts that y is not zero. If it is, a runtime panic |
| 219 | // will be emitted. This follows the Go specification which says that a divide |
no test coverage detected