[llvm] [SandboxIR] Added a new LoadInst::create() with a isVolatile arg (PR #100781)

Julius Alexandre via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 11:55:29 PDT 2024


================
@@ -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);
----------------
medievalghoul wrote:

> Makes sense. Something like create(Type *Ty, Value *Ptr, MaybeAlign Align, Instruction *InsertBefore, Context &Ctx, bool IsVolatile = false, const Twine &Name = "") ?

exactly, so then we can just replace the `false` input with `IsVolatile` in the following code below
https://github.com/llvm/llvm-project/blob/173514ff129620364ac0ed61027e81194d997d76/llvm/lib/SandboxIR/SandboxIR.cpp#L464-L466

> I was suggesting using 4 functions because llvm::LoadInst is using separate constructors but I don't feel too strongly about it.

Yeah I figured, the only reason that'd consider adding 4 functions is to follow the same convention as what we're replicating. But I think we should be fine and it seems like it saves us some code too.

https://github.com/llvm/llvm-project/pull/100781


More information about the llvm-commits mailing list