-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SandboxIR][Utils] Implement getMemoryLocation() #109724
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
Conversation
ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with one small comment about naming.
if (BB.getName() == Name) | ||
return &BB; | ||
llvm_unreachable("Expected to find basic block!"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably refactor the parseIR/getBasicBlockByName boilerplate into something common for the entire SandboxVectorizer. Every test file duplicates it. But that is a problem for the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that needs to be refactored at some point.
llvm/include/llvm/SandboxIR/Utils.h
Outdated
|
||
/// Equivalent to MemoryLocation::getOrNone(I). | ||
static std::optional<llvm::MemoryLocation> | ||
getMemoryLocation(const Instruction *I) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not match the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like memoryLocationGetOrNone()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that makes it clearer. In my opinion, the closer we match the LLVM IR name, the easier it is to reason about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This patch implements sandboxir::Utils::getMemoryLocation() that calls MemoryLocation::getOrNone() internally. Ideally this would require a sandboxir::MemoryLocation, but this should be good enough for now.
This patch implements sandboxir::Utils::getMemoryLocation() that calls MemoryLocation::getOrNone() internally.
Ideally this would require a sandboxir::MemoryLocation, but this should be good enough for now.