Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,880
    • Issues 2,880
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 905
    • Merge requests 905
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Issues
  • #5148

Closed
Open
Created Jul 29, 2021 by Ian Romanick@idrOwner

Eliminate phis where both sources are the same calculated value

I suspect this is something that GVN would just handle, but maybe not.

The shader deus-ex-mankind-divided/3194.shader_test (and others from that app) contains some code like:

        /* succs: block_4 */
        loop {
                block block_4:
                /* preds: block_3 block_76 */
                ...
                vec1 32 ssa_378 = phi block_3: ssa_2, block_76: ssa_2025

                ...

                /* succs: block_17 block_18 */
                if ssa_598 {
                        block block_17:
                        /* preds: block_16 */
                        vec1 32 ssa_599 = iadd ssa_378, ssa_14
                        /* succs: block_76 */
                } else {
                        block block_18:
                        /* preds: block_16 */

                        ...

                        vec1 32 ssa_2021 = iadd ssa_378, ssa_14
                        /* succs: block_76 */
                }
                block block_76:
                /* preds: block_17 block_75 */
                ...
                vec1 32 ssa_2025 = phi block_17: ssa_599, block_75: ssa_2021
                /* succs: block_4 */
        }

The iadd ssa_378, ssa_14 could get moved out of both branches of the if-statement. I think this kind of very targeted code movement should always be beneficial. The important thing for register pressure would be to move the calculation to where the phi node was. That should never increase register pressure... moving it before the if-statment could be better depending on the live range of the sources.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking