[llvm] [SandboxIR] Added new StoreInst::create() functions with isVolatile arg (PR #100961)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 12:27:49 PDT 2024
================
@@ -810,10 +815,45 @@ define void @foo(i8 %val, ptr %ptr) {
sandboxir::StoreInst *NewSt =
sandboxir::StoreInst::create(Val, Ptr, Align(8),
/*InsertBefore=*/Ret, Ctx);
+ // Check if create was volatile
+ EXPECT_FALSE(NewSt->isVolatile());
EXPECT_EQ(NewSt->getType(), St->getType());
EXPECT_EQ(NewSt->getValueOperand(), Val);
EXPECT_EQ(NewSt->getPointerOperand(), Ptr);
EXPECT_EQ(NewSt->getAlign(), 8);
+ // Check create(InsertBefore, IsVolatile=true)
+ sandboxir::StoreInst *NewVSt =
+ sandboxir::StoreInst::create(Val, Ptr, Align(8),
+ /*InsertBefore=*/Ret,
+ /*IsVolatile=*/true, Ctx);
+ // Check if create was volatile
+ EXPECT_TRUE(NewVSt->isVolatile());
+
----------------
vporpo wrote:
I think we should add the same checks as above:
```
EXPECT_EQ(NewVSt->getType(), St->getType());
EXPECT_EQ(NewVSt->getValueOperand(), Val);
EXPECT_EQ(NewVSt->getPointerOperand(), Ptr);
EXPECT_EQ(NewVSt->getAlign(), 8);
```
And also let's also check the instruction position (you can also add this check above too).
```
EXPECT_EQ(NewVSt->getNextNode(), Ret);
```
https://github.com/llvm/llvm-project/pull/100961
More information about the llvm-commits
mailing list