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

Julius Alexandre via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 16:38:30 PDT 2024


================
@@ -778,13 +784,23 @@ define void @foo(ptr %arg0, ptr %arg1) {
                                   /*InsertBefore=*/Ret,
                                   /*IsVolatile=*/true, Ctx, "NewVLd");
 
+  EXPECT_TRUE(NewVLd->isVolatile());
+  OrigVolatileValue = NewVLd->isVolatile();
+  NewVLd->setVolatile(false);
+  EXPECT_FALSE(NewVLd->isVolatile());
+  NewVLd->setVolatile(OrigVolatileValue);
   EXPECT_TRUE(NewVLd->isVolatile());
   EXPECT_EQ(NewVLd->getName(), "NewVLd");
   // Check create(InsertAtEnd)
   sandboxir::LoadInst *NewLdEnd =
       sandboxir::LoadInst::create(Ld->getType(), Arg1, Align(8),
                                   /*InsertAtEnd=*/BB, Ctx, "NewLdEnd");
   EXPECT_FALSE(NewLdEnd->isVolatile());
+  OrigVolatileValue = NewLdEnd->isVolatile();
----------------
medievalghoul wrote:

Good catch, i'll make sure to remove it.

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


More information about the llvm-commits mailing list