[llvm] [SandboxIR][NFC] Fixes for LoadInst::create functions (PR #100955)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 10:26:24 PDT 2024
================
@@ -750,37 +750,59 @@ define void @foo(ptr %arg0, ptr %arg1) {
auto *BB = &*F->begin();
auto It = BB->begin();
auto *Ld = cast<sandboxir::LoadInst>(&*It++);
- auto *Vld = cast<sandboxir::LoadInst>(&*It++);
+ auto *VLd = cast<sandboxir::LoadInst>(&*It++);
auto *Ret = cast<sandboxir::ReturnInst>(&*It++);
// Check isVolatile()
EXPECT_FALSE(Ld->isVolatile());
// Check isVolatile()
- EXPECT_TRUE(Vld->isVolatile());
+ EXPECT_TRUE(VLd->isVolatile());
// Check getPointerOperand()
EXPECT_EQ(Ld->getPointerOperand(), Arg0);
// Check getAlign()
EXPECT_EQ(Ld->getAlign(), 64);
- // Check create(InsertBefore)
+ // Check create(InsertBefore, IsVolatile=false)
sandboxir::LoadInst *NewLd =
sandboxir::LoadInst::create(Ld->getType(), Arg1, Align(8),
- /*InsertBefore=*/Ret, Ctx,
- /*IsVolatile=*/false, "NewLd");
+ /*InsertBefore=*/Ret, Ctx, "NewLd");
// Checking if create() was volatile
EXPECT_FALSE(NewLd->isVolatile());
EXPECT_EQ(NewLd->getType(), Ld->getType());
EXPECT_EQ(NewLd->getPointerOperand(), Arg1);
EXPECT_EQ(NewLd->getAlign(), 8);
EXPECT_EQ(NewLd->getName(), "NewLd");
-
+ // Check create(InsertBefore, IsVolatile=true)
sandboxir::LoadInst *NewVLd =
- sandboxir::LoadInst::create(Vld->getType(), Arg1, Align(8),
- /*InsertBefore=*/Ret, Ctx,
- /*IsVolatile=*/true, "NewVLd");
+ sandboxir::LoadInst::create(VLd->getType(), Arg1, Align(8),
+ /*InsertBefore=*/Ret,
+ /*IsVolatile=*/true, Ctx, "NewVLd");
// Checking if create() was volatile
EXPECT_TRUE(NewVLd->isVolatile());
EXPECT_EQ(NewVLd->getName(), "NewVLd");
+ // Check create(InsertAtEnd, IsVolatile=false)
----------------
vporpo wrote:
nit: Same here`// Check create(InsertAtEnd)`
https://github.com/llvm/llvm-project/pull/100955
More information about the llvm-commits
mailing list