-
Notifications
You must be signed in to change notification settings - Fork 15k
[SandboxIR] Adding isVolatile arg to existing LoadInst::create() functions #100781
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
[SandboxIR] Adding isVolatile arg to existing LoadInst::create() functions #100781
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
#100717 (comment) to follow up this comment, I'll make sure to add a body and a test for this new function. |
@@ -743,6 +743,9 @@ class LoadInst final : public Instruction { | |||
static LoadInst *create(Type *Ty, Value *Ptr, MaybeAlign Align, | |||
Instruction *InsertBefore, Context &Ctx, | |||
const Twine &Name = ""); | |||
static LoadInst *create(Type *Ty, Value *Ptr, MaybeAlign Align, | |||
Instruction *InsertBefore, Context &Ctx, | |||
const Twine &Name = "", bool isVolatile); |
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 would move the isVolatile
flag before the Ctx
argument.
Also we would need both versions of the create() function with the additional isVolatile argument + their bodies + tests :)
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 would move the isVolatile flag before the Ctx argument.
will do
Also we would need both versions of the create() function with the additional isVolatile argument + their bodies + tests :)
so for every create
function there needs to have a version where isVolatile is an argument?
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, 4 in total: 2 with isVolatile and 2 without.
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 we can save some lines of code, do you think it'd be more sensible to just have 2 functions instead of 4. Where the isVolatile arg, has default value of false
if there's no input? or should we stick to the original plan of having 4 functions?
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.
Makes sense. Something like create(Type *Ty, Value *Ptr, MaybeAlign Align, Instruction *InsertBefore, Context &Ctx, bool IsVolatile = false, const Twine &Name = "")
? I was suggesting using 4 functions because llvm::LoadInst is using separate constructors but I don't feel too strongly about it.
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.
do you approve? if so, i'll have to change the title to something more suited for our situation
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, go for it.
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.
It's a pain to deal with, I'll stick with the former suggestion. After trying to deal with it, I realized it creates ambiguity in the code
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.
Either way is fine with me.
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.
@vporpo I'll have to close this PR unfortunately and ship the code to another PR. My local branch got corrupted and will create a mess with this PR if I tried to do a commit.
wasn't too sure if i was suppose to add the body, just added the function header for now
cc: @vporpo