@@ -16,7 +16,7 @@ import (
1616// slice. This is required by the Go language spec: an index out of bounds must
1717// cause a panic.
1818func (b * builder ) createLookupBoundsCheck (arrayLen , index llvm.Value , indexType types.Type ) {
19- if b .fn . IsNoBounds () {
19+ if b .info . nobounds {
2020 // The //go:nobounds pragma was added to the function to avoid bounds
2121 // checking.
2222 return
@@ -48,7 +48,7 @@ func (b *builder) createLookupBoundsCheck(arrayLen, index llvm.Value, indexType
4848// biggest possible slice capacity, 'low' means len and 'high' means cap. The
4949// logic is the same in both cases.
5050func (b * builder ) createSliceBoundsCheck (capacity , low , high , max llvm.Value , lowType , highType , maxType * types.Basic ) {
51- if b .fn . IsNoBounds () {
51+ if b .info . nobounds {
5252 // The //go:nobounds pragma was added to the function to avoid bounds
5353 // checking.
5454 return
@@ -104,7 +104,7 @@ func (b *builder) createSliceBoundsCheck(capacity, low, high, max llvm.Value, lo
104104// createChanBoundsCheck creates a bounds check before creating a new channel to
105105// check that the value is not too big for runtime.chanMake.
106106func (b * builder ) createChanBoundsCheck (elementSize uint64 , bufSize llvm.Value , bufSizeType * types.Basic , pos token.Pos ) {
107- if b .fn . IsNoBounds () {
107+ if b .info . nobounds {
108108 // The //go:nobounds pragma was added to the function to avoid bounds
109109 // checking.
110110 return
@@ -189,7 +189,7 @@ func (b *builder) createNilCheck(inst ssa.Value, ptr llvm.Value, blockPrefix str
189189// createNegativeShiftCheck creates an assertion that panics if the given shift value is negative.
190190// This function assumes that the shift value is signed.
191191func (b * builder ) createNegativeShiftCheck (shift llvm.Value ) {
192- if b .fn . IsNoBounds () {
192+ if b .info . nobounds {
193193 // Function disabled bounds checking - skip shift check.
194194 return
195195 }
@@ -212,8 +212,8 @@ func (b *builder) createRuntimeAssert(assert llvm.Value, blockPrefix, assertFunc
212212 }
213213 }
214214
215- faultBlock := b .ctx .AddBasicBlock (b .fn . LLVMFn , blockPrefix + ".throw" )
216- nextBlock := b .ctx .AddBasicBlock (b .fn . LLVMFn , blockPrefix + ".next" )
215+ faultBlock := b .ctx .AddBasicBlock (b .llvmFn , blockPrefix + ".throw" )
216+ nextBlock := b .ctx .AddBasicBlock (b .llvmFn , blockPrefix + ".next" )
217217 b .blockExits [b .currentBlock ] = nextBlock // adjust outgoing block for phi nodes
218218
219219 // Now branch to the out-of-bounds or the regular block.
0 commit comments