google / graphicsfuzz

A testing framework for automatically finding and simplifying bugs in graphics shader compilers.
Apache License 2.0
569 stars 117 forks source link

Add identity transformation to rewrite struct variables #511

Open afd opened 5 years ago

afd commented 5 years ago

Related to #510, it would be good to have a similar transformation that re-writes structs, applying an identity recursively to some field of a struct.

For example, if we have:

struct S { int a; float b; vec3 c; }

S p;

then we could transform p into e.g. S(p.a, IDENTITY(p.b), p.c)

abelbriggs1 commented 5 years ago

To document for later: this issue will require #540 to be fixed first, as OpaqueExpressionGenerator doesn't have any way of knowing the components of a struct just from its type name, since structs are declared in global scope and Typer is the only tree builder capable of storing struct declarations.