intel/compiler: Pass detailed dependency classes to invalidate_analysis()
authorFrancisco Jerez <currojerez@riseup.net>
Mon, 14 Mar 2016 02:26:37 +0000 (19:26 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 6 Mar 2020 18:20:39 +0000 (10:20 -0800)
Have fun reading through the whole back-end optimizer to verify
whether I've missed any dependency flags -- Or alternatively, just
trust that any mistake here will trigger an assertion failure during
analysis pass validation if it ever poses a problem for the
consistency of any of the analysis passes managed by the framework.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4012>

20 files changed:
src/intel/compiler/brw_dead_control_flow.cpp
src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_fs_cmod_propagation.cpp
src/intel/compiler/brw_fs_combine_constants.cpp
src/intel/compiler/brw_fs_copy_propagation.cpp
src/intel/compiler/brw_fs_cse.cpp
src/intel/compiler/brw_fs_dead_code_eliminate.cpp
src/intel/compiler/brw_fs_lower_pack.cpp
src/intel/compiler/brw_fs_lower_regioning.cpp
src/intel/compiler/brw_fs_reg_allocate.cpp
src/intel/compiler/brw_fs_register_coalesce.cpp
src/intel/compiler/brw_fs_sel_peephole.cpp
src/intel/compiler/brw_predicated_break.cpp
src/intel/compiler/brw_schedule_instructions.cpp
src/intel/compiler/brw_vec4.cpp
src/intel/compiler/brw_vec4_cmod_propagation.cpp
src/intel/compiler/brw_vec4_copy_propagation.cpp
src/intel/compiler/brw_vec4_cse.cpp
src/intel/compiler/brw_vec4_dead_code_eliminate.cpp
src/intel/compiler/brw_vec4_reg_allocate.cpp

index a52bb233d2647e1734b8e2e63c9b8b588d50945b..0d9253bab18d5e91bf0a39c8b795b9ccd8ea3ec5 100644 (file)
@@ -115,7 +115,7 @@ dead_control_flow_eliminate(backend_shader *s)
    }
 
    if (progress)
-      s->invalidate_analysis(DEPENDENCY_EVERYTHING);
+      s->invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
index 6e79405165ecf041a8e32ef6b94d505d77be1a08..e12650c83cc5b88e68e1e0b46f89803a743e0449 100644 (file)
@@ -2029,7 +2029,7 @@ fs_visitor::split_virtual_grfs()
          }
       }
    }
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | DEPENDENCY_VARIABLES);
 
    delete[] split_points;
    delete[] new_virtual_grf;
@@ -2074,7 +2074,7 @@ fs_visitor::compact_virtual_grfs()
       } else {
          remap_table[i] = new_index;
          alloc.sizes[new_index] = alloc.sizes[i];
-         invalidate_analysis(DEPENDENCY_EVERYTHING);
+         invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | DEPENDENCY_VARIABLES);
          ++new_index;
       }
    }
@@ -2537,7 +2537,7 @@ fs_visitor::lower_constant_loads()
          inst->remove(block);
       }
    }
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 }
 
 bool
@@ -2817,7 +2817,8 @@ fs_visitor::opt_algebraic()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW |
+                          DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
@@ -2868,7 +2869,7 @@ fs_visitor::opt_zero_samples()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
@@ -2965,7 +2966,7 @@ fs_visitor::opt_sampler_eot()
     * flag and submit a header together with the sampler message as required
     * by the hardware.
     */
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
    return true;
 }
 
@@ -3018,7 +3019,8 @@ fs_visitor::opt_register_renaming()
    }
 
    if (progress) {
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL |
+                          DEPENDENCY_VARIABLES);
 
       for (unsigned i = 0; i < ARRAY_SIZE(delta_xy); i++) {
          if (delta_xy[i].file == VGRF && remap[delta_xy[i].nr] != ~0u) {
@@ -3066,7 +3068,7 @@ fs_visitor::opt_redundant_discard_jumps()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -3260,7 +3262,7 @@ fs_visitor::compute_to_mrf()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -3318,7 +3320,7 @@ fs_visitor::eliminate_find_live_channel()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
@@ -3466,7 +3468,7 @@ fs_visitor::remove_duplicate_mrf_writes()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -3515,7 +3517,7 @@ fs_visitor::remove_extra_rounding_modes()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -3696,7 +3698,7 @@ fs_visitor::insert_gen4_send_dependency_workarounds()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 }
 
 /**
@@ -3736,7 +3738,7 @@ fs_visitor::lower_uniform_pull_constant_loads()
          inst->header_size = 1;
          inst->mlen = 1;
 
-         invalidate_analysis(DEPENDENCY_EVERYTHING);
+         invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
       } else {
          /* Before register allocation, we didn't tell the scheduler about the
           * MRF we use.  We know it's safe to use this MRF because nothing
@@ -3854,7 +3856,7 @@ fs_visitor::lower_load_payload()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -4154,7 +4156,7 @@ fs_visitor::lower_integer_multiplication()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
@@ -4184,7 +4186,7 @@ fs_visitor::lower_minmax()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -4273,7 +4275,7 @@ fs_visitor::lower_sub_sat()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
@@ -5985,7 +5987,7 @@ fs_visitor::lower_logical_sends()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
@@ -6870,7 +6872,7 @@ fs_visitor::lower_simd_width()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
@@ -6951,7 +6953,7 @@ fs_visitor::lower_barycentrics()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
@@ -7593,7 +7595,7 @@ fs_visitor::fixup_sends_duplicate_payload()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
@@ -7616,7 +7618,8 @@ fs_visitor::fixup_3src_null_dest()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL |
+                          DEPENDENCY_VARIABLES);
 }
 
 /**
@@ -7759,7 +7762,7 @@ fs_visitor::fixup_nomask_control_flow()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
index 9f35c13dd6f1de639fd66bf7ebb1f26a1ded1df4..0b02b336d693a14d077785de7580e614f5535fd3 100644 (file)
@@ -448,7 +448,7 @@ fs_visitor::opt_cmod_propagation()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
index ebedbb4cdf6eb7975f1eb21adc92213a49c4024a..ec48a74ba0b26413f75c03afbaa7940a07c88aca 100644 (file)
@@ -559,7 +559,7 @@ fs_visitor::opt_combine_constants()
    }
 
    ralloc_free(const_ctx);
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return true;
 }
index c75bdac81ee3a69c0c050d3e27a962f3ad73ecaf..262fc2c49aca2ef95c1ec1bc3382c5ec8a92dbf7 100644 (file)
@@ -1067,7 +1067,8 @@ fs_visitor::opt_copy_propagation()
    ralloc_free(copy_prop_ctx);
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW |
+                          DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
index 97a8e1460135cd2495b8c142223f763cc7e91039..ffc6f03d0feda3bcca31a64ce53737613508fc35 100644 (file)
@@ -389,7 +389,7 @@ fs_visitor::opt_cse()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
index d1b2d907bdc8dd82ce66194271ecfb2955b17602..8e30e6de6ce89636e056d8462313866ffd64dd43 100644 (file)
@@ -144,7 +144,7 @@ fs_visitor::dead_code_eliminate()
    ralloc_free(flag_live);
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
index 011a326ac1ee5b6408cc72bfc8fb28f4784aa5e2..ac7b61de6f07ff490eb767a1af61717b246f450b 100644 (file)
@@ -49,7 +49,7 @@ fs_visitor::lower_pack()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
index 24542584ce4bff7edfbf2176dea0e6bba5f62ddf..9db2c540afa975827f72ce65b3086f07369dc36c 100644 (file)
@@ -454,7 +454,7 @@ fs_visitor::lower_regioning()
       progress |= lower_instruction(this, block, inst);
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
index ffc3f21af72988fdc607c12c21aaa312f1e69458..f8ef23e15042e1acdacd0fe0311782bb98f26bd4 100644 (file)
@@ -1208,7 +1208,7 @@ fs_reg_alloc::assign_regs(bool allow_spilling, bool spill_all)
    }
 
    if (spilled)
-      fs->invalidate_analysis(DEPENDENCY_EVERYTHING);
+      fs->invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    /* Get the chosen virtual registers for each node, and map virtual
     * regs in the register classes back down to real hardware reg
index 8a87619dbe11e450ca3b502898548fd11c41feff..15699658bc7ec7aab5ab00e6b060d558bae84881 100644 (file)
@@ -290,7 +290,7 @@ fs_visitor::register_coalesce()
          }
       }
 
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
    }
 
    return progress;
index 5343d98d90ed54380a784c293772fa82878019cd..b36a048601f586708fd150045eb023a5c8d0ba32 100644 (file)
@@ -215,7 +215,7 @@ fs_visitor::opt_peephole_sel()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
index cc29b029b4567fd64997ed3839aa8f35561256b6..f5f40aaabb3b40837cdedeb20fa503aea8429dc1 100644 (file)
@@ -138,7 +138,7 @@ opt_predicated_break(backend_shader *s)
    }
 
    if (progress)
-      s->invalidate_analysis(DEPENDENCY_EVERYTHING);
+      s->invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
index 826f2e771e3e9a270bcb0277502929f357de32d3..64a43c1156bb14ad16012d75f7255bb2a6a1ea6c 100644 (file)
@@ -1839,7 +1839,7 @@ fs_visitor::schedule_instructions(instruction_scheduler_mode mode)
                                   cfg->num_blocks, mode);
    sched.run(cfg);
 
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 }
 
 void
@@ -1848,5 +1848,5 @@ vec4_visitor::opt_schedule_instructions()
    vec4_instruction_scheduler sched(this, prog_data->total_grf);
    sched.run(cfg);
 
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 }
index 18676d4c4cad98d45e7174b4ee0bb1c169f87227..de2149f416bda57c167ee8a4fe331ce350b50773 100644 (file)
@@ -496,7 +496,7 @@ vec4_visitor::opt_vector_float()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -577,7 +577,7 @@ vec4_visitor::opt_reduce_swizzle()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
@@ -904,7 +904,8 @@ vec4_visitor::opt_algebraic()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW |
+                          DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
@@ -1474,7 +1475,7 @@ vec4_visitor::opt_register_coalesce()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -1525,7 +1526,7 @@ vec4_visitor::eliminate_find_live_channel()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
@@ -1601,7 +1602,7 @@ vec4_visitor::split_virtual_grfs()
          }
       }
    }
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | DEPENDENCY_VARIABLES);
 }
 
 void
@@ -1904,7 +1905,7 @@ vec4_visitor::lower_minmax()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -2040,7 +2041,8 @@ vec4_visitor::fixup_3src_null_dest()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL |
+                          DEPENDENCY_VARIABLES);
 }
 
 void
@@ -2368,7 +2370,7 @@ vec4_visitor::lower_simd_width()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
@@ -2525,7 +2527,7 @@ vec4_visitor::scalarize_df()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
@@ -2568,7 +2570,7 @@ vec4_visitor::lower_64bit_mad_to_mul_add()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
index 5123f2cf6bd7a4b32cbef3eb3f5a4fc708cdf032..be0f957aeba620c886a33901cc91bf783e3ac85d 100644 (file)
@@ -357,7 +357,7 @@ vec4_visitor::opt_cmod_propagation()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
index 68087339c55d6b8e181fdf58495f0c27b2eac63e..597e75c8b899e51815f8965ba82b3c0bd28a7cda 100644 (file)
@@ -559,7 +559,8 @@ vec4_visitor::opt_copy_propagation(bool do_constant_prop)
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW |
+                          DEPENDENCY_INSTRUCTION_DETAIL);
 
    return progress;
 }
index d0dbd23ff07b44b9e9bd8c0e8805ec23c2115643..2a4217249e86bd527096616cb8a9d52abf00774c 100644 (file)
@@ -317,7 +317,7 @@ vec4_visitor::opt_cse()
    }
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 
    return progress;
 }
index 730d43494431cd5ee7d7d0fc7dfb07fcf5eb9c25..5975f1f64378a726f83c42961fcd3879154a91a3 100644 (file)
@@ -183,7 +183,7 @@ vec4_visitor::dead_code_eliminate()
    ralloc_free(flag_live);
 
    if (progress)
-      invalidate_analysis(DEPENDENCY_EVERYTHING);
+      invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
 
    return progress;
 }
index 34514a46db900506ca6be02548fb2d36c5915cc4..4e4f3431c6d31c9f9fae1a519b2c21ec6aa0e98b 100644 (file)
@@ -540,7 +540,7 @@ vec4_visitor::spill_reg(unsigned spill_reg_nr)
       }
    }
 
-   invalidate_analysis(DEPENDENCY_EVERYTHING);
+   invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
 }
 
 } /* namespace brw */