Skip to content

call.without.effects is always possible for CSE #7568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

paul-hoang
Copy link

@paul-hoang paul-hoang commented May 3, 2025

LocalCSE has a isPossible check to see if an expression can be eliminated. Currently it treats all function calls as not possible. This PR proposes that it should consider "call.without.effects" function calls as always possible.

This will allow reusing result of a previously called without-effect function with the same arguments.

// call.without.effects is always possible for CSE.
if (Intrinsics(*getModule()).isCallWithoutEffects(curr)) {
return true;
}
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, isn't the isGenerative check at the end of the function still important? For example, a call.without.effects might return a random number on each call - that has no effects, but we can't CSE it.

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