Skip to content

[SandboxIR] Implement StoreInst #99707

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
Jul 20, 2024
Merged

[SandboxIR] Implement StoreInst #99707

merged 1 commit into from
Jul 20, 2024

Conversation

vporpo
Copy link
Contributor

@vporpo vporpo commented Jul 19, 2024

This patch adds the SandboxIR StoreInst instruction which mirrors llvm::StoreInst.

This patch adds the SandboxIR StoreInst instruction
which mirrors llvm::StoreInst.
@vporpo
Copy link
Contributor Author

vporpo commented Jul 19, 2024

This is basically the same patch as the previous one, but for StoreInst instead of LoadInst.

@tschuett
Copy link

I have two jokes:
A MemoryAccessBase for LoadInst and StoreInst with:

 Value *getPointerOperand() const;
  Align getAlign() const { return cast<llvm::StoreInst>(Val)->getAlign(); }
  bool isSimple() const { return cast<llvm::StoreInst>(Val)->isSimple(); }
  bool isUnordered() const { return cast<llvm::StoreInst>(Val)->isUnordered(); }

Second joke: Instructions.h to split them out of SandboxIR.h

@vporpo
Copy link
Contributor Author

vporpo commented Jul 20, 2024

A MemoryAccessBase for LoadInst and StoreInst with:

This is very reasonable, and it would be very useful in in code that works with either Loads or Stores. The only downside that I can think of is that it deviates from the LLVM class hierarchy, which we try to avoid as we want to make this API feel like LLVM as much as possible.

Instructions.h to split them out of SandboxIR.h

This is also very reasonable, and I think we should do this at some point in a followup NFC patch.

Copy link
Contributor

@alinas alinas left a comment

Choose a reason for hiding this comment

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

LGTM.

On the first suggestion comment: deviating from the class hierarchy should be transparent to the user of the APIs. It would reduce some of the duplication, so it is worth considering to do in a follow-up NFC (i.e. both are).

@vporpo
Copy link
Contributor Author

vporpo commented Jul 20, 2024

so it is worth considering to do in a follow-up NFC (i.e. both are).
Agreed

@vporpo vporpo merged commit 52a46bc into llvm:main Jul 20, 2024
8 checks passed
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
This patch adds the SandboxIR StoreInst instruction which mirrors
llvm::StoreInst.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251584
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.

3 participants