mesa/src/compiler
Daniel Schürmann 28395407eb nir/opt_peephole_select: collapse nested IFs if applicable
Single-sided nested IFs can sometimes be collapsed
even if they cannot be flattened.
This optimization re-uses block_check_for_allowed_instrs()
to determine if it is beneficial to collapse the IFs.
Additionally, it is required that the phis of the outer IF
become trivial after this optimization, so that no additional
bcsel instructions are added.
This optimization turns

   if (cond1) {
      <allowed instruction>
      if (cond2) {
         <any code>
      } else {
      }
   } else {
   }

into

   <allowed instruction>
   if (cond1 && cond2) {
      <any code>
   } else {
   }

Totals from 17044 (12.35% of 138013) affected shaders (RAVEN):
SGPRs: 1246416 -> 1246256 (-0.01%); split: -0.01%, +0.00%
VGPRs: 802752 -> 802736 (-0.00%); split: -0.01%, +0.01%
SpillSGPRs: 45857 -> 45850 (-0.02%); split: -0.07%, +0.05%
CodeSize: 85318240 -> 85208592 (-0.13%); split: -0.15%, +0.02%
Instrs: 16769049 -> 16738195 (-0.18%); split: -0.20%, +0.02%
Cycles: 947328732 -> 947145796 (-0.02%); split: -0.03%, +0.01%
VMEM: 7271539 -> 7274090 (+0.04%); split: +0.05%, -0.01%
SMEM: 925983 -> 927374 (+0.15%); split: +0.19%, -0.04%
VClause: 294334 -> 294340 (+0.00%); split: -0.00%, +0.00%
SClause: 633600 -> 634048 (+0.07%); split: -0.01%, +0.08%
Copies: 1589650 -> 1580573 (-0.57%); split: -0.66%, +0.09%
Branches: 540830 -> 525767 (-2.79%); split: -2.79%, +0.00%
PreSGPRs: 902500 -> 902415 (-0.01%); split: -0.02%, +0.01%
PreVGPRs: 759992 -> 760019 (+0.00%); split: -0.00%, +0.01%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7478>
2020-11-24 08:39:35 +00:00
..
glsl glcpp: Handle bison-3.6 error message changes 2020-11-19 15:31:15 +00:00
nir nir/opt_peephole_select: collapse nested IFs if applicable 2020-11-24 08:39:35 +00:00
spirv spirv: workaround setjmp/longjmp crash on MinGW 2020-11-18 13:53:36 +00:00
Android.glsl.gen.mk android: util: Move xxd.py to util 2020-10-11 23:22:34 +02:00
Android.glsl.mk
Android.mk
Android.nir.gen.mk android: fix SPIR-V -> NIR build 2020-10-12 22:26:05 +00:00
Android.nir.mk
builtin_type_macros.h compiler/types: Add 64-bit image types 2020-11-09 17:17:39 +00:00
glsl_types.cpp compiler/types: Add 64-bit image types 2020-11-09 17:17:39 +00:00
glsl_types.h glsl: Fix -Wshadow warning 2020-11-16 08:49:18 +00:00
Makefile.sources panfrost/util: Move nir_undef_to_zero into core nir and add 'lower' 2020-11-18 04:05:37 +00:00
meson.build spirv: add some tests for volatile/available/visible 2020-09-01 17:15:22 +00:00
nir_types.cpp nir: Add a size_align helper function for aligning elements to 16 bytes. 2020-11-16 13:54:22 -08:00
nir_types.h nir: Add a size_align helper function for aligning elements to 16 bytes. 2020-11-16 13:54:22 -08:00
SConscript
SConscript.glsl util: Move xxd.py to util 2020-10-07 21:52:04 +00:00
SConscript.nir
SConscript.spirv scons: fix SPIR-V -> NIR build 2020-10-13 16:53:10 +01:00
shader_enums.c spirv,nir: Add support for ray-tracing built-ins 2020-11-05 23:36:46 +00:00
shader_enums.h compiler: add SYSTEM_BIT_FRONT_FACE 2020-11-10 15:37:07 +00:00
shader_info.h compiler/spirv: Handle the LocalSizeHint execution modes 2020-11-18 04:05:37 +00:00