| ... | ... | @@ -2365,7 +2365,7 @@ pub const DeclGen = struct { |
| 2365 | 2365 | } |
| 2366 | 2366 | dg.addFnAttr(llvm_fn, "nounwind"); |
| 2367 | 2367 | if (comp.unwind_tables) { |
| 2368 | | dg.addFnAttr(llvm_fn, "uwtable"); |
| 2368 | dg.addFnAttrString(llvm_fn, "uwtable", "sync"); |
| 2369 | 2369 | } |
| 2370 | 2370 | if (comp.bin_file.options.skip_linker_dependencies or |
| 2371 | 2371 | comp.bin_file.options.no_builtin) |
| ... | ... | @@ -4996,8 +4996,8 @@ pub const FuncGen = struct { |
| 4996 | 4996 | const indices: [2]*const llvm.Value = .{ |
| 4997 | 4997 | llvm_usize.constNull(), llvm_usize.constNull(), |
| 4998 | 4998 | }; |
| 4999 | | const elem_llvm_ty = try self.dg.lowerType(array_ty.childType()); |
| 5000 | | const ptr = self.builder.buildInBoundsGEP(elem_llvm_ty, operand, &indices, indices.len, ""); |
| 4999 | const array_llvm_ty = try self.dg.lowerType(array_ty); |
| 5000 | const ptr = self.builder.buildInBoundsGEP(array_llvm_ty, operand, &indices, indices.len, ""); |
| 5001 | 5001 | const partial = self.builder.buildInsertValue(slice_llvm_ty.getUndef(), ptr, 0, ""); |
| 5002 | 5002 | return self.builder.buildInsertValue(partial, len, 1, ""); |
| 5003 | 5003 | } |
| ... | ... | @@ -5174,13 +5174,14 @@ pub const FuncGen = struct { |
| 5174 | 5174 | const array_llvm_val = try self.resolveInst(bin_op.lhs); |
| 5175 | 5175 | const rhs = try self.resolveInst(bin_op.rhs); |
| 5176 | 5176 | if (isByRef(array_ty)) { |
| 5177 | | const elem_ty = array_ty.childType(); |
| 5178 | | const elem_llvm_ty = try self.dg.lowerType(elem_ty); |
| 5177 | const array_llvm_ty = try self.dg.lowerType(array_ty); |
| 5179 | 5178 | const indices: [2]*const llvm.Value = .{ self.context.intType(32).constNull(), rhs }; |
| 5180 | | const elem_ptr = self.builder.buildInBoundsGEP(elem_llvm_ty, array_llvm_val, &indices, indices.len, ""); |
| 5179 | const elem_ptr = self.builder.buildInBoundsGEP(array_llvm_ty, array_llvm_val, &indices, indices.len, ""); |
| 5180 | const elem_ty = array_ty.childType(); |
| 5181 | 5181 | if (isByRef(elem_ty)) { |
| 5182 | 5182 | return elem_ptr; |
| 5183 | 5183 | } else { |
| 5184 | const elem_llvm_ty = try self.dg.lowerType(elem_ty); |
| 5184 | 5185 | return self.builder.buildLoad(elem_llvm_ty, elem_ptr, ""); |
| 5185 | 5186 | } |
| 5186 | 5187 | } |
| ... | ... | @@ -7306,6 +7307,7 @@ pub const FuncGen = struct { |
| 7306 | 7307 | } else { |
| 7307 | 7308 | // If the ABI size of the element type is not evenly divisible by size in bits; |
| 7308 | 7309 | // a simple bitcast will not work, and we fall back to extractelement. |
| 7310 | const array_llvm_ty = try self.dg.lowerType(operand_ty); |
| 7309 | 7311 | const elem_llvm_ty = try self.dg.lowerType(elem_ty); |
| 7310 | 7312 | const llvm_usize = try self.dg.lowerType(Type.usize); |
| 7311 | 7313 | const llvm_u32 = self.context.intType(32); |
| ... | ... | @@ -7317,7 +7319,7 @@ pub const FuncGen = struct { |
| 7317 | 7319 | const index_usize = llvm_usize.constInt(i, .False); |
| 7318 | 7320 | const index_u32 = llvm_u32.constInt(i, .False); |
| 7319 | 7321 | const indexes: [2]*const llvm.Value = .{ zero, index_usize }; |
| 7320 | | const elem_ptr = self.builder.buildInBoundsGEP(elem_llvm_ty, operand, &indexes, indexes.len, ""); |
| 7322 | const elem_ptr = self.builder.buildInBoundsGEP(array_llvm_ty, operand, &indexes, indexes.len, ""); |
| 7321 | 7323 | const elem = self.builder.buildLoad(elem_llvm_ty, elem_ptr, ""); |
| 7322 | 7324 | vector = self.builder.buildInsertElement(vector, elem, index_u32, ""); |
| 7323 | 7325 | } |