aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorL. Pereira <[email protected]>2024-06-07 21:44:58 -0700
committerAyke <[email protected]>2024-06-10 12:39:55 +0200
commitad6c89bf64cef2e616b5e73554db7f2d7e915477 (patch)
tree4bf7c36fe1f66956cbdc9b427115e2b6c9440ccd
parentae6220262acac838dc092f915fd41f3f74aa8391 (diff)
downloadtinygo-ad6c89bf64cef2e616b5e73554db7f2d7e915477.tar.gz
tinygo-ad6c89bf64cef2e616b5e73554db7f2d7e915477.zip
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]>
-rw-r--r--transform/rtcalls.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/transform/rtcalls.go b/transform/rtcalls.go
index 0b6feff21..8310fc9f1 100644
--- a/transform/rtcalls.go
+++ b/transform/rtcalls.go
@@ -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.