Skip to content

rewriting: dead code removal in GreedyRewritePatternApplier#5485

Merged
superlopuh merged 40 commits intomainfrom
jumerckx/greedyrewrite_dce
Feb 5, 2026
Merged

rewriting: dead code removal in GreedyRewritePatternApplier#5485
superlopuh merged 40 commits intomainfrom
jumerckx/greedyrewrite_dce

Conversation

@jumerckx
Copy link
Copy Markdown
Collaborator

@jumerckx jumerckx commented Dec 1, 2025

No description provided.

@jumerckx jumerckx self-assigned this Dec 1, 2025
@jumerckx jumerckx added the rewriting Rewrite APIs (Rewriter, PatternRewriter, ...) label Dec 1, 2025
@jumerckx jumerckx force-pushed the jumerckx/greedyrewrite_dce branch from 4b1db7d to 3e4ac62 Compare December 1, 2025 17:20
@jumerckx
Copy link
Copy Markdown
Collaborator Author

jumerckx commented Dec 1, 2025

Many filecheck tests assume dead code is not removed.
What are thoughts on this pr?
Should all those tests be updated by adding a user of the dead results?

@superlopuh
Copy link
Copy Markdown
Member

Yeah I think so

@superlopuh
Copy link
Copy Markdown
Member

I wonder if agents these days can do this easily

@superlopuh
Copy link
Copy Markdown
Member

Ah no sorry, I think remove the use of the dead code, or add "test.op" user dependening on the test

jumerckx and others added 5 commits December 2, 2025 10:42
Co-authored-by: Mathieu Fehr <mathieu.fehr@gmail.com>
Co-authored-by: Mathieu Fehr <mathieu.fehr@gmail.com>
Now that dead code is removed, this test needs a user of the otherwise
dead value.
@jumerckx jumerckx force-pushed the jumerckx/greedyrewrite_dce branch from 3e4ac62 to d585c8c Compare December 3, 2025 02:38
@jumerckx
Copy link
Copy Markdown
Collaborator Author

jumerckx commented Dec 7, 2025

Marking this as draft until riscv fixes have been merged.

@jumerckx jumerckx marked this pull request as draft December 7, 2025 20:11
Base automatically changed from jumerckx/canonicalize_fold to main December 12, 2025 23:40
@superlopuh
Copy link
Copy Markdown
Member

One of the riscv things was much easier to fix by avoiding the use of the greedy rewriter, I'll take a look at the rest of the backend things over the next week.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.15%. Comparing base (54c86a4) to head (20a0524).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5485      +/-   ##
==========================================
- Coverage   86.16%   86.15%   -0.02%     
==========================================
  Files         395      395              
  Lines       56464    56473       +9     
  Branches     6504     6506       +2     
==========================================
+ Hits        48655    48657       +2     
- Misses       6276     6281       +5     
- Partials     1533     1535       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

// CHECK-NEXT: mv t3, a1
// CHECK-NEXT: li t1, 128
// CHECK-NEXT: li t0, 512
// CHECK-NEXT: li t4, 64
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like an actual optimisation

@superlopuh
Copy link
Copy Markdown
Member

@math-fehr, are you happy to merge this with the temporary flag to disable dce in the greedy rewriter? I think it would be good to deprecate that at some point but for now seems like a good way to move forward.

@math-fehr
Copy link
Copy Markdown
Collaborator

Sorry for missing this, this is good for me!

@superlopuh superlopuh marked this pull request as ready for review February 5, 2026 13:50
@superlopuh superlopuh merged commit 9e3121e into main Feb 5, 2026
22 checks passed
@superlopuh superlopuh deleted the jumerckx/greedyrewrite_dce branch February 5, 2026 13:56
osmanyasar05 pushed a commit to osmanyasar05/xdsl that referenced this pull request Feb 5, 2026
…ect#5485)

Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
Co-authored-by: Mathieu Fehr <mathieu.fehr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rewriting Rewrite APIs (Rewriter, PatternRewriter, ...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants