@@ -13,7 +13,7 @@ import (
1313// slice. This is required by the Go language spec: an index out of bounds must
1414// cause a panic.
1515func (c * Compiler ) emitLookupBoundsCheck (frame * Frame , arrayLen , index llvm.Value , indexType types.Type ) {
16- if frame .fn . IsNoBounds () {
16+ if frame .info . nobounds {
1717 // The //go:nobounds pragma was added to the function to avoid bounds
1818 // checking.
1919 return
@@ -32,8 +32,8 @@ func (c *Compiler) emitLookupBoundsCheck(frame *Frame, arrayLen, index llvm.Valu
3232 arrayLen = c .builder .CreateZExt (arrayLen , index .Type (), "" )
3333 }
3434
35- faultBlock := c .ctx .AddBasicBlock (frame .fn . LLVMFn , "lookup.outofbounds" )
36- nextBlock := c .ctx .AddBasicBlock (frame .fn . LLVMFn , "lookup.next" )
35+ faultBlock := c .ctx .AddBasicBlock (frame .llvmFn , "lookup.outofbounds" )
36+ nextBlock := c .ctx .AddBasicBlock (frame .llvmFn , "lookup.next" )
3737 frame .blockExits [frame .currentBlock ] = nextBlock // adjust outgoing block for phi nodes
3838
3939 // Now do the bounds check: index >= arrayLen
@@ -57,7 +57,7 @@ func (c *Compiler) emitLookupBoundsCheck(frame *Frame, arrayLen, index llvm.Valu
5757// biggest possible slice capacity, 'low' means len and 'high' means cap. The
5858// logic is the same in both cases.
5959func (c * Compiler ) emitSliceBoundsCheck (frame * Frame , capacity , low , high , max llvm.Value , lowType , highType , maxType * types.Basic ) {
60- if frame .fn . IsNoBounds () {
60+ if frame .info . nobounds {
6161 // The //go:nobounds pragma was added to the function to avoid bounds
6262 // checking.
6363 return
@@ -101,8 +101,8 @@ func (c *Compiler) emitSliceBoundsCheck(frame *Frame, capacity, low, high, max l
101101 }
102102 }
103103
104- faultBlock := c .ctx .AddBasicBlock (frame .fn . LLVMFn , "slice.outofbounds" )
105- nextBlock := c .ctx .AddBasicBlock (frame .fn . LLVMFn , "slice.next" )
104+ faultBlock := c .ctx .AddBasicBlock (frame .llvmFn , "slice.outofbounds" )
105+ nextBlock := c .ctx .AddBasicBlock (frame .llvmFn , "slice.next" )
106106 frame .blockExits [frame .currentBlock ] = nextBlock // adjust outgoing block for phi nodes
107107
108108 // Now do the bounds check: low > high || high > capacity
@@ -132,8 +132,8 @@ func (c *Compiler) emitNilCheck(frame *Frame, ptr llvm.Value, blockPrefix string
132132 }
133133
134134 // Check whether this is a nil pointer.
135- faultBlock := c .ctx .AddBasicBlock (frame .fn . LLVMFn , blockPrefix + ".nil" )
136- nextBlock := c .ctx .AddBasicBlock (frame .fn . LLVMFn , blockPrefix + ".next" )
135+ faultBlock := c .ctx .AddBasicBlock (frame .llvmFn , blockPrefix + ".nil" )
136+ nextBlock := c .ctx .AddBasicBlock (frame .llvmFn , blockPrefix + ".next" )
137137 frame .blockExits [frame .currentBlock ] = nextBlock // adjust outgoing block for phi nodes
138138
139139 // Compare against nil.
0 commit comments