mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 07:53:40 +00:00
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 <l.pereira@fastly.com>
This commit is contained in:
@@ -34,7 +34,7 @@ func OptimizeStringToBytes(mod llvm.Module) {
|
|||||||
if use.IsAExtractValueInst().IsNil() {
|
if use.IsAExtractValueInst().IsNil() {
|
||||||
// Expected an extractvalue, but this is something else.
|
// Expected an extractvalue, but this is something else.
|
||||||
canConvertPointer = false
|
canConvertPointer = false
|
||||||
continue
|
break
|
||||||
}
|
}
|
||||||
switch use.Type().TypeKind() {
|
switch use.Type().TypeKind() {
|
||||||
case llvm.IntegerTypeKind:
|
case llvm.IntegerTypeKind:
|
||||||
@@ -49,7 +49,7 @@ func OptimizeStringToBytes(mod llvm.Module) {
|
|||||||
// There is a store to the byte slice. This means that none
|
// There is a store to the byte slice. This means that none
|
||||||
// of the pointer uses can't be propagated.
|
// of the pointer uses can't be propagated.
|
||||||
canConvertPointer = false
|
canConvertPointer = false
|
||||||
continue
|
break
|
||||||
}
|
}
|
||||||
// It may be that the pointer value can be propagated, if all of
|
// It may be that the pointer value can be propagated, if all of
|
||||||
// the pointer uses are readonly.
|
// the pointer uses are readonly.
|
||||||
|
|||||||
Reference in New Issue
Block a user