llvm / llvm/llvm-project

[DFAJumpThreading] Extend to simplifying multiple switches.

Open
#165,987 0 comments 0 reactions 0 assignees View on GitHub
llvm:optimizations missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

DFAJumpThreading handles only one threadable switch at a time for now, due to some correctness problems. We could try to extend the implementation to handle multiple switches. There are two possible solutions in my mind now:

The first is:
- Skip collecting the switches that have overlapped blocks with other collected switches.
- Thread collected switches together at last. In this way, we don't need to update invalid loop info.

The second is:
- Get rid of the loop info query in this pass, and still keep compile-time good.
- Iteratively collect and thread only one switch at a time until no threadable switches exist.

Contributor guide

Open the contributing guide

Research direction

Start by locating the DFAJumpThreading implementation and its existing handling for a single threadable switch. Compare the two proposed approaches, including their effects on overlapping blocks, loop information, and compile time. Done means multiple switches can be simplified without correctness regressions, with relevant compiler tests passing.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.