Halide
Halide copied to clipboard
[HVX] InjectHexagonRpc breaks CSE
The InjectHexagonRpc mutator inserts Let nodes that label Load names instead of Variable names, specifically in the definition of state_var(). This breaks let substitutions (i.e. RemoveLets() in CSE.cpp), as Let is defined to only relate to Variable nodes:
https://github.com/halide/Halide/blob/b9a33561d38a4a59b9d4c08eb09253892b418a38/src/IR.h#L259-#L262
There are two solutions that I see:
- Allow
Letnodes to label any name (i.e. load names). This makes substitution messier though, because you can't substituteLetvalues intoLoads. - InjectHexagonRpc should create
state_vars in some other way - is there another way to represent pointer dereference?
This bug was discovered via #6884, which called CSE quite late in lowering.