@@ -750,37 +750,59 @@ define void @foo(ptr %arg0, ptr %arg1) {
750
750
auto *BB = &*F->begin ();
751
751
auto It = BB->begin ();
752
752
auto *Ld = cast<sandboxir::LoadInst>(&*It++);
753
- auto *Vld = cast<sandboxir::LoadInst>(&*It++);
753
+ auto *VLd = cast<sandboxir::LoadInst>(&*It++);
754
754
auto *Ret = cast<sandboxir::ReturnInst>(&*It++);
755
755
756
756
// Check isVolatile()
757
757
EXPECT_FALSE (Ld->isVolatile ());
758
758
// Check isVolatile()
759
- EXPECT_TRUE (Vld ->isVolatile ());
759
+ EXPECT_TRUE (VLd ->isVolatile ());
760
760
// Check getPointerOperand()
761
761
EXPECT_EQ (Ld->getPointerOperand (), Arg0);
762
762
// Check getAlign()
763
763
EXPECT_EQ (Ld->getAlign (), 64 );
764
764
// Check create(InsertBefore)
765
765
sandboxir::LoadInst *NewLd =
766
766
sandboxir::LoadInst::create (Ld->getType (), Arg1, Align (8 ),
767
- /* InsertBefore=*/ Ret, Ctx,
768
- /* IsVolatile=*/ false , " NewLd" );
767
+ /* InsertBefore=*/ Ret, Ctx, " NewLd" );
769
768
// Checking if create() was volatile
770
769
EXPECT_FALSE (NewLd->isVolatile ());
771
770
EXPECT_EQ (NewLd->getType (), Ld->getType ());
772
771
EXPECT_EQ (NewLd->getPointerOperand (), Arg1);
773
772
EXPECT_EQ (NewLd->getAlign (), 8 );
774
773
EXPECT_EQ (NewLd->getName (), " NewLd" );
775
-
774
+ // Check create(InsertBefore, IsVolatile=true)
776
775
sandboxir::LoadInst *NewVLd =
777
- sandboxir::LoadInst::create (Vld ->getType (), Arg1, Align (8 ),
778
- /* InsertBefore=*/ Ret, Ctx,
779
- /* IsVolatile=*/ true , " NewVLd" );
776
+ sandboxir::LoadInst::create (VLd ->getType (), Arg1, Align (8 ),
777
+ /* InsertBefore=*/ Ret,
778
+ /* IsVolatile=*/ true , Ctx, " NewVLd" );
780
779
781
780
// Checking if create() was volatile
782
781
EXPECT_TRUE (NewVLd->isVolatile ());
783
782
EXPECT_EQ (NewVLd->getName (), " NewVLd" );
783
+ // Check create(InsertAtEnd)
784
+ sandboxir::LoadInst *NewLdEnd =
785
+ sandboxir::LoadInst::create (Ld->getType (), Arg1, Align (8 ),
786
+ /* InsertAtEnd=*/ BB, Ctx, " NewLdEnd" );
787
+ EXPECT_FALSE (NewLdEnd->isVolatile ());
788
+ EXPECT_EQ (NewLdEnd->getName (), " NewLdEnd" );
789
+ EXPECT_EQ (NewLdEnd->getType (), Ld->getType ());
790
+ EXPECT_EQ (NewLdEnd->getPointerOperand (), Arg1);
791
+ EXPECT_EQ (NewLdEnd->getAlign (), 8 );
792
+ EXPECT_EQ (NewLdEnd->getParent (), BB);
793
+ EXPECT_EQ (NewLdEnd->getNextNode (), nullptr );
794
+ // Check create(InsertAtEnd, IsVolatile=true)
795
+ sandboxir::LoadInst *NewVLdEnd =
796
+ sandboxir::LoadInst::create (VLd->getType (), Arg1, Align (8 ),
797
+ /* InsertAtEnd=*/ BB,
798
+ /* IsVolatile=*/ true , Ctx, " NewVLdEnd" );
799
+ EXPECT_TRUE (NewVLdEnd->isVolatile ());
800
+ EXPECT_EQ (NewVLdEnd->getName (), " NewVLdEnd" );
801
+ EXPECT_EQ (NewVLdEnd->getType (), VLd->getType ());
802
+ EXPECT_EQ (NewVLdEnd->getPointerOperand (), Arg1);
803
+ EXPECT_EQ (NewVLdEnd->getAlign (), 8 );
804
+ EXPECT_EQ (NewVLdEnd->getParent (), BB);
805
+ EXPECT_EQ (NewVLdEnd->getNextNode (), nullptr );
784
806
}
785
807
786
808
TEST_F (SandboxIRTest, StoreInst) {
0 commit comments