aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/CodeGen/MachineInstrTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/CodeGen/MachineInstrTest.cpp')
-rw-r--r--llvm/unittests/CodeGen/MachineInstrTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp
index 33baaf62..71c4b8e 100644
--- a/llvm/unittests/CodeGen/MachineInstrTest.cpp
+++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp
@@ -383,6 +383,26 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) {
ASSERT_FALSE(MI->getHeapAllocMarker());
}
+TEST(MachineInstrClone, CopyCallSiteInfo) {
+ LLVMContext Ctx;
+ Module Mod("Module", Ctx);
+ auto MF = createMachineFunction(Ctx, Mod);
+ auto MBB = MF->CreateMachineBasicBlock();
+ auto MII = MBB->begin();
+
+ MCInstrDesc MCID = {0, 0, 0, 0, 0, (1ULL << MCID::Call),
+ 0, nullptr, nullptr, nullptr};
+
+ MachineFunction::CallSiteInfo CSInfo;
+ auto MI = MF->CreateMachineInstr(MCID, DebugLoc());
+ ASSERT_TRUE(MI->isCandidateForCallSiteEntry());
+ MBB->insert(MII, MI);
+ MF->addCallArgsForwardingRegs(MI, std::move(CSInfo));
+ EXPECT_EQ(MF->getCallSitesInfo().size(), 1u);
+ MF->CloneMachineInstrBundle(*MBB, MBB->end(), *MI);
+ EXPECT_EQ(MF->getCallSitesInfo().size(), 2u);
+}
+
static_assert(is_trivially_copyable<MCOperand>::value, "trivially copyable");
} // end namespace