[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:37 PDT 2024


================
@@ -160,6 +160,34 @@ void CallBrInstSetIndirectDest::dump() const {
 }
 #endif
 
+SetVolatile::SetVolatile(Instruction *I, bool WasBool, Tracker &Tracker)
+    : IRChangeBase(Tracker), Inst(I) {
+  if (auto *Load = cast<llvm::LoadInst>(Inst)) {
+    WasVolatile = Load->isVolatile();
+    InstUnion = Load;
+  }
----------------
vporpo wrote:

We need to have some kind of assertion that this is either a LoadInst or a StoreInst. One way is to early return after `InstUnion = ...` in both this and the following `if` and add an `llvm_unreachable("Expected LoadInst or StoreInst");` at the end of the function.

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


More information about the llvm-commits mailing list