mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 14:33:41 +00:00
fix incorrect starting value for optimized allocations in a loop
This commit is contained in:
Vendored
+14
@@ -50,6 +50,20 @@ define i32* @testEscapingReturn() {
|
||||
ret i32* %2
|
||||
}
|
||||
|
||||
define void @testNonEscapingLoop() {
|
||||
entry:
|
||||
%stackalloc.alloca = alloca [1 x i32]
|
||||
br label %loop
|
||||
loop:
|
||||
store [1 x i32] zeroinitializer, [1 x i32]* %stackalloc.alloca
|
||||
%stackalloc = bitcast [1 x i32]* %stackalloc.alloca to i32*
|
||||
%0 = call i32* @noescapeIntPtr(i32* %stackalloc)
|
||||
%1 = icmp eq i32* null, %0
|
||||
br i1 %1, label %loop, label %end
|
||||
end:
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i32* @escapeIntPtr(i32*)
|
||||
|
||||
declare i32* @noescapeIntPtr(i32* nocapture)
|
||||
|
||||
Reference in New Issue
Block a user