@@ -13,7 +13,7 @@ import (
13
13
// slice. This is required by the Go language spec: an index out of bounds must
14
14
// cause a panic.
15
15
func (c * Compiler ) emitLookupBoundsCheck (frame * Frame , arrayLen , index llvm.Value , indexType types.Type ) {
16
- if frame .fn . IsNoBounds () {
16
+ if frame .info . nobounds {
17
17
// The //go:nobounds pragma was added to the function to avoid bounds
18
18
// checking.
19
19
return
@@ -32,8 +32,8 @@ func (c *Compiler) emitLookupBoundsCheck(frame *Frame, arrayLen, index llvm.Valu
32
32
arrayLen = c .builder .CreateZExt (arrayLen , index .Type (), "" )
33
33
}
34
34
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" )
37
37
frame .blockExits [frame .currentBlock ] = nextBlock // adjust outgoing block for phi nodes
38
38
39
39
// Now do the bounds check: index >= arrayLen
@@ -57,7 +57,7 @@ func (c *Compiler) emitLookupBoundsCheck(frame *Frame, arrayLen, index llvm.Valu
57
57
// biggest possible slice capacity, 'low' means len and 'high' means cap. The
58
58
// logic is the same in both cases.
59
59
func (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 {
61
61
// The //go:nobounds pragma was added to the function to avoid bounds
62
62
// checking.
63
63
return
@@ -101,8 +101,8 @@ func (c *Compiler) emitSliceBoundsCheck(frame *Frame, capacity, low, high, max l
101
101
}
102
102
}
103
103
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" )
106
106
frame .blockExits [frame .currentBlock ] = nextBlock // adjust outgoing block for phi nodes
107
107
108
108
// Now do the bounds check: low > high || high > capacity
@@ -132,8 +132,8 @@ func (c *Compiler) emitNilCheck(frame *Frame, ptr llvm.Value, blockPrefix string
132
132
}
133
133
134
134
// 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" )
137
137
frame .blockExits [frame .currentBlock ] = nextBlock // adjust outgoing block for phi nodes
138
138
139
139
// Compare against nil.
0 commit comments