-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SandboxIR] Added isVolatile args to existing LoadInst::create function #100850
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] Added isVolatile args to existing LoadInst::create function #100850
Conversation
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Try using clang-format to fix the formatting issues. |
@vporpo Is there anything else I need to change? If not, is it okay for you to merge this? |
@@ -764,11 +764,21 @@ define void @foo(ptr %arg0, ptr %arg1) { | |||
// Check create(InsertBefore) | |||
sandboxir::LoadInst *NewLd = | |||
sandboxir::LoadInst::create(Ld->getType(), Arg1, Align(8), | |||
/*InsertBefore=*/Ret, Ctx, "NewLd"); | |||
/*InsertBefore=*/Ret, Ctx, | |||
/*IsVolatile=*/false, "NewLd"); |
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.
This is OK for this PR, but having to specify the IsVolatile
argument whenever you create non-volatile LoadInsts looks a bit too verbose. The problem is that most of the times you will be creating an instruction with a name, so you can't take advantage of the default value f the IsVolatile=false
argument. And swapping IsVolatile
with Name
isn't what most users will expect.
If you have time, try creating a follow-up PR with two additional create() functions that don't have the IsVolatile
argument and remove the default =false
value for these ones. So the functions would be:
1. create(Type *Ty, Value *Ptr, MaybeAlign Align, Instruction *InsertBefore, Context &Ctx, bool IsVolatile, const Twine &Name = "")
2. create(Type *Ty, Value *Ptr, MaybeAlign Align, Instruction *InsertBefore, Context &Ctx, const Twine &Name = "")
3. create(Type *Ty, Value *Ptr, MaybeAlign Align, BasicBlock *InsertAtEnd, Context &Ctx, bool IsVolatile, const Twine &Name = "")
4. create(Type *Ty, Value *Ptr, MaybeAlign Align, BasicBlock *InsertAtEnd, Context &Ctx, const Twine &Name = "")
Then in the body of 2 you would just call 1 with /*IsVolatile=*/false
, and similarly in the body of 4 you would call 3.
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.
Completely understandable in terms of LoadInst looking verbose. Btw, do you still want the bool IsVolatile
to be before the Context &Ctx
in the follow-up PR?
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 would be even better.
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.
Thank you for the suggestion, I'll start on the follow-up PR.
This is OK for this PR
I was a bit confuse on this. Were you suggesting that this PR will get merge first before creating the follow-up NFC PR? If not, then I'll start on the follow-up.
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, let's merge this first and then you can work on top of 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.
LG
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/2780 Here is the relevant piece of the build log for the reference:
|
I looked into this bug, it doesn't seem to be related to this PR. I'm not sure why there's a Buildbot failure? |
Don't worry about it, it looks unrelated. |
Added isVolatile args along with the tests
Previous PR: #100781