mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 13:58:27 +00:00
spirv: make bitcasts between the same spirv type a no-op
This commit is contained in:
parent
c6c5fb40de
commit
0a3e566f57
@ -2527,7 +2527,12 @@ const DeclGen = struct {
|
||||
src_id: IdRef,
|
||||
) !IdRef {
|
||||
const mod = self.module;
|
||||
const src_ty_ref = try self.resolveType(src_ty, .direct);
|
||||
const dst_ty_ref = try self.resolveType(dst_ty, .direct);
|
||||
if (src_ty_ref == dst_ty_ref) {
|
||||
return src_id;
|
||||
}
|
||||
|
||||
const result_id = self.spv.allocId();
|
||||
|
||||
// TODO: Some more cases are missing here
|
||||
@ -2811,7 +2816,8 @@ const DeclGen = struct {
|
||||
|
||||
fn airSliceElemPtr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
|
||||
const mod = self.module;
|
||||
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
|
||||
const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
|
||||
const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;
|
||||
const slice_ty = self.typeOf(bin_op.lhs);
|
||||
if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) return null;
|
||||
|
||||
|
||||
@ -70,7 +70,6 @@ test "basic for loop" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
|
||||
const expected_result = [_]u8{ 9, 8, 7, 6, 0, 1, 2, 3 } ** 3;
|
||||
|
||||
@ -157,7 +156,6 @@ test "for loop with pointer elem var" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
|
||||
const source = "abcdefg";
|
||||
var target: [source.len]u8 = undefined;
|
||||
@ -204,7 +202,6 @@ test "for on slice with allowzero ptr" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
|
||||
const S = struct {
|
||||
fn doTheTest(slice: []const u8) !void {
|
||||
@ -344,7 +341,6 @@ test "two slices, one captured by-ref" {
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
|
||||
var buf: [10]u8 = undefined;
|
||||
const slice1: []const u8 = "blah";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user