From ad6c89bf64cef2e616b5e73554db7f2d7e915477 Mon Sep 17 00:00:00 2001 From: "L. Pereira" Date: Fri, 7 Jun 2024 21:44:58 -0700 Subject: [PATCH] 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 --- transform/rtcalls.go | 4 ++-- 1 file 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.