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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 13:46:30 PDT 2024


================
@@ -160,26 +160,28 @@ void CallBrInstSetIndirectDest::dump() const {
 }
 #endif
 
-SetVolatile::SetVolatile(Instruction *I, bool WasBool, Tracker &Tracker)
-    : IRChangeBase(Tracker), Inst(I) {
-  if (auto *Load = cast<llvm::LoadInst>(Inst)) {
+SetVolatile::SetVolatile(Instruction *I, Tracker &Tracker)
+    : IRChangeBase(Tracker) {
+  if (auto *Load = cast<llvm::LoadInst>(I)) {
     WasVolatile = Load->isVolatile();
     InstUnion = Load;
-  }
-  if (auto *Store = cast<llvm::StoreInst>(Inst)) {
+    assert(Load && "This isn't a LoadInst");
----------------
vporpo wrote:

This assertion is not needed, as if this is not a LoadInst we won't enter the `if`.

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


More information about the llvm-commits mailing list