github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/zeromap.ll (about) 1 ; ModuleID = 'zeromap.go' 2 source_filename = "zeromap.go" 3 target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20" 4 target triple = "wasm32-unknown-wasi" 5 6 %main.hasPadding = type { i1, i32, i1 } 7 8 ; Function Attrs: allockind("alloc,zeroed") allocsize(0) 9 declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0 10 11 declare void @runtime.trackPointer(ptr nocapture readonly, ptr, ptr) #1 12 13 ; Function Attrs: nounwind 14 define hidden void @main.init(ptr %context) unnamed_addr #2 { 15 entry: 16 ret void 17 } 18 19 ; Function Attrs: noinline nounwind 20 define hidden i32 @main.testZeroGet(ptr dereferenceable_or_null(40) %m, i1 %s.b1, i32 %s.i, i1 %s.b2, ptr %context) unnamed_addr #3 { 21 entry: 22 %hashmap.key = alloca %main.hasPadding, align 8 23 %hashmap.value = alloca i32, align 4 24 %0 = insertvalue %main.hasPadding zeroinitializer, i1 %s.b1, 0 25 %1 = insertvalue %main.hasPadding %0, i32 %s.i, 1 26 %2 = insertvalue %main.hasPadding %1, i1 %s.b2, 2 27 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value) 28 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %hashmap.key) 29 store %main.hasPadding %2, ptr %hashmap.key, align 8 30 %3 = getelementptr inbounds i8, ptr %hashmap.key, i32 1 31 call void @runtime.memzero(ptr nonnull %3, i32 3, ptr undef) #5 32 %4 = getelementptr inbounds i8, ptr %hashmap.key, i32 9 33 call void @runtime.memzero(ptr nonnull %4, i32 3, ptr undef) #5 34 %5 = call i1 @runtime.hashmapBinaryGet(ptr %m, ptr nonnull %hashmap.key, ptr nonnull %hashmap.value, i32 4, ptr undef) #5 35 call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %hashmap.key) 36 %6 = load i32, ptr %hashmap.value, align 4 37 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hashmap.value) 38 ret i32 %6 39 } 40 41 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) 42 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4 43 44 declare void @runtime.memzero(ptr, i32, ptr) #1 45 46 declare i1 @runtime.hashmapBinaryGet(ptr dereferenceable_or_null(40), ptr, ptr, i32, ptr) #1 47 48 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) 49 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4 50 51 ; Function Attrs: noinline nounwind 52 define hidden void @main.testZeroSet(ptr dereferenceable_or_null(40) %m, i1 %s.b1, i32 %s.i, i1 %s.b2, ptr %context) unnamed_addr #3 { 53 entry: 54 %hashmap.key = alloca %main.hasPadding, align 8 55 %hashmap.value = alloca i32, align 4 56 %0 = insertvalue %main.hasPadding zeroinitializer, i1 %s.b1, 0 57 %1 = insertvalue %main.hasPadding %0, i32 %s.i, 1 58 %2 = insertvalue %main.hasPadding %1, i1 %s.b2, 2 59 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value) 60 store i32 5, ptr %hashmap.value, align 4 61 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %hashmap.key) 62 store %main.hasPadding %2, ptr %hashmap.key, align 8 63 %3 = getelementptr inbounds i8, ptr %hashmap.key, i32 1 64 call void @runtime.memzero(ptr nonnull %3, i32 3, ptr undef) #5 65 %4 = getelementptr inbounds i8, ptr %hashmap.key, i32 9 66 call void @runtime.memzero(ptr nonnull %4, i32 3, ptr undef) #5 67 call void @runtime.hashmapBinarySet(ptr %m, ptr nonnull %hashmap.key, ptr nonnull %hashmap.value, ptr undef) #5 68 call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %hashmap.key) 69 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hashmap.value) 70 ret void 71 } 72 73 declare void @runtime.hashmapBinarySet(ptr dereferenceable_or_null(40), ptr, ptr, ptr) #1 74 75 ; Function Attrs: noinline nounwind 76 define hidden i32 @main.testZeroArrayGet(ptr dereferenceable_or_null(40) %m, [2 x %main.hasPadding] %s, ptr %context) unnamed_addr #3 { 77 entry: 78 %hashmap.key = alloca [2 x %main.hasPadding], align 8 79 %hashmap.value = alloca i32, align 4 80 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value) 81 call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key) 82 %s.elt = extractvalue [2 x %main.hasPadding] %s, 0 83 store %main.hasPadding %s.elt, ptr %hashmap.key, align 8 84 %hashmap.key.repack1 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1 85 %s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1 86 store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4 87 %0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1 88 call void @runtime.memzero(ptr nonnull %0, i32 3, ptr undef) #5 89 %1 = getelementptr inbounds i8, ptr %hashmap.key, i32 9 90 call void @runtime.memzero(ptr nonnull %1, i32 3, ptr undef) #5 91 %2 = getelementptr inbounds i8, ptr %hashmap.key, i32 13 92 call void @runtime.memzero(ptr nonnull %2, i32 3, ptr undef) #5 93 %3 = getelementptr inbounds i8, ptr %hashmap.key, i32 21 94 call void @runtime.memzero(ptr nonnull %3, i32 3, ptr undef) #5 95 %4 = call i1 @runtime.hashmapBinaryGet(ptr %m, ptr nonnull %hashmap.key, ptr nonnull %hashmap.value, i32 4, ptr undef) #5 96 call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %hashmap.key) 97 %5 = load i32, ptr %hashmap.value, align 4 98 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hashmap.value) 99 ret i32 %5 100 } 101 102 ; Function Attrs: noinline nounwind 103 define hidden void @main.testZeroArraySet(ptr dereferenceable_or_null(40) %m, [2 x %main.hasPadding] %s, ptr %context) unnamed_addr #3 { 104 entry: 105 %hashmap.key = alloca [2 x %main.hasPadding], align 8 106 %hashmap.value = alloca i32, align 4 107 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hashmap.value) 108 store i32 5, ptr %hashmap.value, align 4 109 call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %hashmap.key) 110 %s.elt = extractvalue [2 x %main.hasPadding] %s, 0 111 store %main.hasPadding %s.elt, ptr %hashmap.key, align 8 112 %hashmap.key.repack1 = getelementptr inbounds [2 x %main.hasPadding], ptr %hashmap.key, i32 0, i32 1 113 %s.elt2 = extractvalue [2 x %main.hasPadding] %s, 1 114 store %main.hasPadding %s.elt2, ptr %hashmap.key.repack1, align 4 115 %0 = getelementptr inbounds i8, ptr %hashmap.key, i32 1 116 call void @runtime.memzero(ptr nonnull %0, i32 3, ptr undef) #5 117 %1 = getelementptr inbounds i8, ptr %hashmap.key, i32 9 118 call void @runtime.memzero(ptr nonnull %1, i32 3, ptr undef) #5 119 %2 = getelementptr inbounds i8, ptr %hashmap.key, i32 13 120 call void @runtime.memzero(ptr nonnull %2, i32 3, ptr undef) #5 121 %3 = getelementptr inbounds i8, ptr %hashmap.key, i32 21 122 call void @runtime.memzero(ptr nonnull %3, i32 3, ptr undef) #5 123 call void @runtime.hashmapBinarySet(ptr %m, ptr nonnull %hashmap.key, ptr nonnull %hashmap.value, ptr undef) #5 124 call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %hashmap.key) 125 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hashmap.value) 126 ret void 127 } 128 129 ; Function Attrs: nounwind 130 define hidden void @main.main(ptr %context) unnamed_addr #2 { 131 entry: 132 ret void 133 } 134 135 attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 136 attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 137 attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 138 attributes #3 = { noinline nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 139 attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } 140 attributes #5 = { nounwind }