Skip to content

Commit ad6c89b

Browse files
lpereiraaykevl
authored andcommitted
transform/rtcalls: Bail fast if can't convert pointer
There's no need to keep looping if one of the uses makes it impossible to convert a call to `runtime.stringToBytes()` with a raw pointer. Signed-off-by: L. Pereira <[email protected]>
1 parent ae62202 commit ad6c89b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

transform/rtcalls.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func OptimizeStringToBytes(mod llvm.Module) {
3434
if use.IsAExtractValueInst().IsNil() {
3535
// Expected an extractvalue, but this is something else.
3636
canConvertPointer = false
37-
continue
37+
break
3838
}
3939
switch use.Type().TypeKind() {
4040
case llvm.IntegerTypeKind:
@@ -49,7 +49,7 @@ func OptimizeStringToBytes(mod llvm.Module) {
4949
// There is a store to the byte slice. This means that none
5050
// of the pointer uses can't be propagated.
5151
canConvertPointer = false
52-
continue
52+
break
5353
}
5454
// It may be that the pointer value can be propagated, if all of
5555
// the pointer uses are readonly.

0 commit comments

Comments
 (0)