diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-24 15:37:24 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-25 06:37:22 -0700 |
commit | 9ce75826cb00a252c6012d74046fa15bf0998080 (patch) | |
tree | 05431a0615cf464413c94541c8e3650e593f4328 /src/panfrost/midgard/mir.c | |
parent | f6438d1e15c0a97aa4a834b350f9c7bb57e40665 (diff) |
pan/midgard: Optimize varying projection
We add a new opt pass fusing perspective projection with varyings. Minor
win..? We don't combine non-varying projections, since if we're too
agressive, the extra load/store traffic will hurt us so it's not really
a win in practice.
total instructions in shared programs: 3915 -> 3913 (-0.05%)
instructions in affected programs: 76 -> 74 (-2.63%)
helped: 1
HURT: 0
total bundles in shared programs: 2520 -> 2519 (-0.04%)
bundles in affected programs: 46 -> 45 (-2.17%)
helped: 1
HURT: 0
total quadwords in shared programs: 4027 -> 4025 (-0.05%)
quadwords in affected programs: 80 -> 78 (-2.50%)
helped: 1
HURT: 0
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/mir.c')
-rw-r--r-- | src/panfrost/midgard/mir.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c index 1be224b8464..2c449e0684e 100644 --- a/src/panfrost/midgard/mir.c +++ b/src/panfrost/midgard/mir.c @@ -72,25 +72,26 @@ mir_rewrite_index(compiler_context *ctx, unsigned old, unsigned new) mir_rewrite_index_dst(ctx, old, new); } -/* Checks if a value is used only once (or totally dead), which is an important - * heuristic to figure out if certain optimizations are Worth It (TM) */ - -bool -mir_single_use(compiler_context *ctx, unsigned value) +unsigned +mir_use_count(compiler_context *ctx, unsigned value) { unsigned used_count = 0; mir_foreach_instr_global(ctx, ins) { if (mir_has_arg(ins, value)) ++used_count; - - /* Short circuit for speed */ - if (used_count > 1) - return false; } - return used_count <= 1; + return used_count; +} +/* Checks if a value is used only once (or totally dead), which is an important + * heuristic to figure out if certain optimizations are Worth It (TM) */ + +bool +mir_single_use(compiler_context *ctx, unsigned value) +{ + return mir_use_count(ctx, value) <= 1; } bool |