compiler: fix odd bounds check failure with impossible typeassert
Этот коммит содержится в:
родитель
77d6d6c417
коммит
3f05490846
1 изменённых файлов: 2 добавлений и 2 удалений
|
@ -2049,8 +2049,8 @@ func (c *Compiler) emitBoundsCheck(frame *Frame, arrayLen, index llvm.Value) {
|
|||
}
|
||||
// Optimize away trivial cases.
|
||||
// LLVM would do this anyway with interprocedural optimizations, but it
|
||||
// helps to see cases where bounds checking would really help.
|
||||
if index.IsConstant() && arrayLen.IsConstant() {
|
||||
// helps to see cases where bounds check elimination would really help.
|
||||
if index.IsConstant() && arrayLen.IsConstant() && !arrayLen.IsUndef() {
|
||||
index := index.SExtValue()
|
||||
arrayLen := arrayLen.SExtValue()
|
||||
if index >= 0 && index < arrayLen {
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче