[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)) {
----------------
vporpo wrote:

This should be a `dyn_cast<LoadInst>(I)`. A `cast` will assert that the type is correct, so this will crash. Also `I` is a `sandboxir::LoadInst` or `sandboxir::StoreInst`, so we should cast it to `<LoadInst>` not `<llvm::LoadInst>`.

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


More information about the llvm-commits mailing list