Skip to content

llvm: fix loop unrolling - #1988

Merged
phate merged 2 commits into
masterfrom
LoopUnrolling-Fix
Nov 23, 2026
Merged

phate merged 2 commits into
masterfrom
LoopUnrolling-Fix

Conversation

@phate

@phate phate commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Fix loop unrolling for loops with runtime trip counts by checking each original continuation condition before executing a batch. This preserves fixed-width wraparound and operand order, and ensures the residual loop runs at least once when the first batch is skipped. Also leave loops unchanged when the computed trip count is zero, and add regression tests.

@phate
phate requested a review from haved November 22, 2026 10:44
@phate

phate commented Nov 22, 2026

Copy link
Copy Markdown
Owner Author

@haved I did not look too closely at the code. It is only the bug fixes from #1962 without the entire operation renaming. The entire pass needs a rewrite anyway, so I would not invest too much time into it as long as the tests pass.

@phate
phate enabled auto-merge (squash) November 22, 2026 10:54
Comment thread jlm/llvm/opt/UnrollTests.cpp Resolved
@haved

haved commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

My only comment is double checking that we intentionally use the old BitValueRepresentation. I can see that the code uses the representation class heavily, so I completely understand not wanting to touch it, but we recently replaced a lot of occurances of BitValueRepresentation so that might affect when the pass triggers? @phate

@phate
phate merged commit a009abe into master Nov 23, 2026
32 checks passed
@phate
phate deleted the LoopUnrolling-Fix branch November 23, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants