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:
L. Pereira
2024-06-07 21:44:58 -07:00
committed by Ayke
parent ae6220262a
commit ad6c89bf64
+2 -2
View File
@@ -34,7 +34,7 @@ func OptimizeStringToBytes(mod llvm.Module) {
if use.IsAExtractValueInst().IsNil() {
// Expected an extractvalue, but this is something else.
canConvertPointer = false
continue
break
}
switch use.Type().TypeKind() {
case llvm.IntegerTypeKind:
@@ -49,7 +49,7 @@ func OptimizeStringToBytes(mod llvm.Module) {
// There is a store to the byte slice. This means that none
// of the pointer uses can't be propagated.
canConvertPointer = false
continue
break
}
// It may be that the pointer value can be propagated, if all of
// the pointer uses are readonly.