Skip to content

Create missing state output in MSE for allocas - #1942

Merged
haved merged 4 commits into
masterfrom
mse-undef-fix
Oct 5, 2026
Merged

haved merged 4 commits into
masterfrom
mse-undef-fix

Conversation

@haved

@haved haved commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

I first tried to disqualify dynamic allocas from being simple in the ModRefSummarizer.
At the most, a single file has 99 dynamic allocas, and 12 files have >= 10 dynamic allocas. 164 files have at least one dynamic alloca.

Not all dynamic allocas were simple to begin with, however, so the actual reduction in simple allocas was at most 15, with only the top 10 files seeing >= 4 simple allocas removed.

At the end of the sroa-raware pipeline, the change lead to 60 more loads compared to master, across 14 files (12 up, 2 down).
It also lead to 108 more stores, but I think those might actually be mostly correct, and were always supposed to be there.
Lastly it lead to 11 more allocas being kept.

Next I tried what this PR does: Creating an UndefValue for the memory state output if it does not exist yet when required by something that is not an alloca. This was a much smaller code change, and I think it makes much more sense, as it avoids adding even more special handling of the set of allocas that is or isn't included in the ModRefSummary of functions. I left a suggestion for an assert in the PR as a comment. The assert it not possible right now since the StateMap class not having access to the PointsToGraph, but the whole MSE class is being refactored, so I would rather just add it as a comment that can be fixed later.

The total effect on the sroa-raware pipeline compared to master: 4 more loads, 105 more stores. The load diffs are in 6 files: (+17, +17, +4, -1, -2, -31). The store diffs are in 8 files, which I again think are mostly supposed to be there. We keep 8 more allocas.

@haved
haved requested a review from phate October 5, 2026 13:01
phate
phate previously approved these changes Oct 5, 2026
Comment thread jlm/llvm/opt/alias-analyses/MemoryStateEncoder.cpp Outdated
Comment thread jlm/llvm/opt/alias-analyses/MemoryStateEncoder.cpp Outdated
@haved
haved enabled auto-merge (squash) October 5, 2026 13:31
@haved
haved merged commit 6102dee into master Oct 5, 2026
33 checks passed
@haved
haved deleted the mse-undef-fix branch October 5, 2026 13:54
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