[llvm] [SandboxIR] Added setVolatile member function to LoadInst and StoreInst (PR #101284)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 08:50:38 PDT 2024


================
@@ -776,6 +776,8 @@ class LoadInst final : public Instruction {
 public:
   /// Return true if this is a load from a volatile memory location.
   bool isVolatile() const { return cast<llvm::LoadInst>(Val)->isVolatile(); }
+  /// Specify whether this is a volatile load or not.
+  void setVolatile(bool V) { return cast<llvm::LoadInst>(Val)->setVolatile(V); }
----------------
vporpo wrote:

This is missing the tracking code which should look like this (you may need to move the function definition to SandboxIR.cpp)
```
  auto &Tracker = getTracker();
  if (Tracker.isTracking())
    Tracker.track(Change: std::make_unique<SetVolatile>(cast<lnstruction>(this)), Tracker));
  cast<llvm::LoadInst>(Val)->setVolatile(V);
```

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


More information about the llvm-commits mailing list