As intended. We can't CSE with partial null destinations in the way, so we
shouldn't eliminate dead destinations until after CSE has run. But we should
still eliminate dead instructions to ensure CSE doesn't move things around
needlessly, hurting register pressure.
Noticed while debugging live range splitting.
No GLES3.0 shader-db changes.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21674>
agx_validate(ctx, "IR translation");
if (likely(!(agx_compiler_debug & AGX_DBG_NOOPT))) {
- /* Dead code eliminate before instruction combining so use counts are
- * right */
- agx_dce(ctx, true);
- agx_optimizer(ctx);
+ /* Eliminate dead instructions before CSE to avoid silly scheduling */
+ agx_dce(ctx, false);
+
+ /* CSE before eliminating dead destinations so that subdivision is
+ * optimized properly.
+ */
agx_opt_cse(ctx);
+ /* After DCE, use counts are right so we can run the optimizer. */
+ agx_optimizer(ctx);
+
/* For correctness, lower uniform sources after copyprop (for correctness,
* as copyprop creates uniform sources). To keep register pressure in
* check, lower after CSE, since moves are cheaper than registers.