Content-Length: 264798 | pFad | https://github.com/llvm/clangir/pull/1162

B0 [CIR][TargetLowering] Fix use iteration by smeenai · Pull Request #1162 · llvm/clangir · GitHub
Skip to content

[CIR][TargetLowering] Fix use iteration #1162

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

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

smeenai
Copy link
Collaborator

@smeenai smeenai commented Nov 25, 2024

Based on https://mlir.llvm.org/docs/Tutorials/UnderstandingTheIRStructure/#traversing-the-def-use-chains,
the users of an op are linked together in a doubly-linked list, so
replacing a user while iterating the users causes a use-after-free.
Store the users in a worklist and process them afterwards instead to
avoid this.

Based on https://mlir.llvm.org/docs/Tutorials/UnderstandingTheIRStructure/#traversing-the-def-use-chains,
the users of an op are linked together in a doubly-linked list, so
replacing a user while iterating the users causes a use-after-free.
Store the users in a worklist and process them afterwards instead to
avoid this.
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Awesome!

@bcardosolopes bcardosolopes merged commit f00568c into llvm:main Nov 25, 2024
7 checks passed
lanza pushed a commit that referenced this pull request Mar 18, 2025
Based on
https://mlir.llvm.org/docs/Tutorials/UnderstandingTheIRStructure/#traversing-the-def-use-chains,
the users of an op are linked together in a doubly-linked list, so
replacing a user while iterating the users causes a use-after-free.
Store the users in a worklist and process them afterwards instead to
avoid this.
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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/llvm/clangir/pull/1162

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy