| ... | @@ -1881,17 +1881,8 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { | ... | @@ -1881,17 +1881,8 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { |
| 1881 | const parent_ptr_ty = try oac.parent.ptrType(pt); | 1881 | const parent_ptr_ty = try oac.parent.ptrType(pt); |
| 1882 | const result_ty_id = try cg.resolveType(oac.new_ptr_ty, .direct); | 1882 | const result_ty_id = try cg.resolveType(oac.new_ptr_ty, .direct); |
| 1883 | | 1883 | |
| 1884 | if (parent_ptr_ty.childType(zcu).isVector(zcu)) { | 1884 | if (oac.new_ptr_ty.ptrInfo(zcu).flags.vector_index != .none) { |
| 1885 | // Vector element ptr accesses are derived as offset_and_cast. | 1885 | return parent_ptr_id; |
| 1886 | // We can just use OpAccessChain. | | |
| 1887 | const child_size = oac.new_ptr_ty.childType(zcu).abiSize(zcu); | | |
| 1888 | if (oac.byte_offset % child_size == 0) { | | |
| 1889 | return cg.accessChain( | | |
| 1890 | result_ty_id, | | |
| 1891 | parent_ptr_id, | | |
| 1892 | &.{@intCast(@divExact(oac.byte_offset, child_size))}, | | |
| 1893 | ); | | |
| 1894 | } | | |
| 1895 | } | 1886 | } |
| 1896 | | 1887 | |
| 1897 | if (oac.byte_offset == 0) { | 1888 | if (oac.byte_offset == 0) { |