Skip to content

Conversation

@georgerennie
Copy link
Contributor

This occurs when a function with empty body is inlined. Previously only one call would be popped off the call stack when the instruction following an inlined call was reached, meaning further uses of the unpopped function would be detected incorrectly as recursive.

This is fixed by repeatedly popping the call stack if possible.

…he same op

- This occurs when a function with empty body is inlined. Previously
  only one call would be popped off the call stack, meaning further
  uses of the unpopped function would be detected incorrectly as
  recursive
// the inlined operations immediately after visiting the call.
for (auto &block : region) {
for (auto &op : block) {
// If this is an op after a call, pop that call off the call stack.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// If this is an op after a call, pop that call off the call stack.
// While this is an op after a call, pop that call off the call stack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've reworded this to "Pop all calls that are followed by this op off the call stack."

Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

Very nice find and elegantly lean fix. Thanks a lot!

@fabianschuiki fabianschuiki merged commit 31c51ab into llvm:main Oct 27, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants