[llvm] [SandboxIR] Added isVolatile args to existing LoadInst::create function (PR #100850)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 16:53:00 PDT 2024


================
@@ -764,11 +764,21 @@ define void @foo(ptr %arg0, ptr %arg1) {
   // Check create(InsertBefore)
   sandboxir::LoadInst *NewLd =
       sandboxir::LoadInst::create(Ld->getType(), Arg1, Align(8),
-                                  /*InsertBefore=*/Ret, Ctx, "NewLd");
+                                  /*InsertBefore=*/Ret, Ctx,
+                                  /*IsVolatile=*/false, "NewLd");
   EXPECT_EQ(NewLd->getType(), Ld->getType());
   EXPECT_EQ(NewLd->getPointerOperand(), Arg1);
   EXPECT_EQ(NewLd->getAlign(), 8);
   EXPECT_EQ(NewLd->getName(), "NewLd");
+
+  sandboxir::LoadInst *NewVld =
+      sandboxir::LoadInst::create(Vld->getType(), Arg1, Align(8),
+                                  /*InsertBefore=*/Ret, Ctx,
+                                  /*IsVolatile=*/true, "NewVld");
+
+  // Checking if create() was volatile
+  EXPECT_EQ(NewVld->isVolatile(), Vld->isVolatile());
----------------
vporpo wrote:

Replace this line with `EXPECT_TRUE(NewVld->isVolatile());

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


More information about the llvm-commits mailing list