diff options
author | Orlando Cazalet-Hyams <orlando.hyams@sony.com> | 2024-02-20 16:00:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 16:00:55 +0000 |
commit | ababa964752d5bfa6eb608c97f19d4e68df1d243 (patch) | |
tree | 26b6cb86bafab688a348e950479323949092e568 /llvm/unittests/IR/DebugInfoTest.cpp | |
parent | 8f7ae64ea108de54d9aad963c55e1aef7dc62b86 (diff) | |
download | llvm-ababa964752d5bfa6eb608c97f19d4e68df1d243.zip llvm-ababa964752d5bfa6eb608c97f19d4e68df1d243.tar.gz llvm-ababa964752d5bfa6eb608c97f19d4e68df1d243.tar.bz2 |
[RemoveDIs][NFC] Introduce DbgRecord base class [1/3] (#78252)
Patch 1 of 3 to add llvm.dbg.label support to the RemoveDIs project. The
patch stack adds a new base class
-> 1. Add DbgRecord base class for DPValue and the not-yet-added
DPLabel class.
2. Add the DPLabel class.
3. Enable dbg.label conversion and add support to passes.
Patches 1 and 2 are NFC.
In the near future we also will rename DPValue to DbgVariableRecord and
DPLabel to DbgLabelRecord, at which point we'll overhaul the function
names too. The name DPLabel keeps things consistent for now.
Diffstat (limited to 'llvm/unittests/IR/DebugInfoTest.cpp')
-rw-r--r-- | llvm/unittests/IR/DebugInfoTest.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp index be8f590..65db93e 100644 --- a/llvm/unittests/IR/DebugInfoTest.cpp +++ b/llvm/unittests/IR/DebugInfoTest.cpp @@ -955,7 +955,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) { FirstInst->DbgMarker->insertDPValue(DPV1, false); FirstInst->DbgMarker->insertDPValue(DPV2, true); unsigned int ItCount = 0; - for (DPValue &Item : FirstInst->DbgMarker->getDbgValueRange()) { + for (DbgRecord &Item : FirstInst->DbgMarker->getDbgValueRange()) { EXPECT_TRUE((&Item == DPV2 && ItCount == 0) || (&Item == DPV1 && ItCount == 1)); EXPECT_EQ(Item.getMarker(), FirstInst->DbgMarker); @@ -968,17 +968,18 @@ TEST(MetadataTest, ConvertDbgToDPValue) { ItCount = 0; // Check these things store the same information; but that they're not the same // objects. - for (DPValue &Item : RetInst->DbgMarker->getDbgValueRange()) { + for (DPValue &Item : + DPValue::filter(RetInst->DbgMarker->getDbgValueRange())) { EXPECT_TRUE((Item.getRawLocation() == DPV2->getRawLocation() && ItCount == 0) || (Item.getRawLocation() == DPV1->getRawLocation() && ItCount == 1)); - + EXPECT_EQ(Item.getMarker(), RetInst->DbgMarker); EXPECT_NE(&Item, DPV1); EXPECT_NE(&Item, DPV2); ++ItCount; } - RetInst->DbgMarker->dropDPValues(); + RetInst->DbgMarker->dropDbgValues(); EXPECT_EQ(RetInst->DbgMarker->StoredDPValues.size(), 0u); // Try cloning one single DPValue. @@ -987,10 +988,12 @@ TEST(MetadataTest, ConvertDbgToDPValue) { EXPECT_EQ(RetInst->DbgMarker->StoredDPValues.size(), 1u); // The second DPValue should have been cloned; it should have the same values // as DPV1. - EXPECT_EQ(RetInst->DbgMarker->StoredDPValues.begin()->getRawLocation(), + EXPECT_EQ(cast<DPValue>(RetInst->DbgMarker->StoredDPValues.begin()) + ->getRawLocation(), DPV1->getRawLocation()); // We should be able to drop individual DPValues. - RetInst->DbgMarker->dropOneDPValue(&*RetInst->DbgMarker->StoredDPValues.begin()); + RetInst->DbgMarker->dropOneDbgValue( + &*RetInst->DbgMarker->StoredDPValues.begin()); // "Aborb" a DPMarker: this means pretend that the instruction it's attached // to is disappearing so it needs to be transferred into "this" marker. @@ -998,7 +1001,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) { EXPECT_EQ(RetInst->DbgMarker->StoredDPValues.size(), 2u); // Should be the DPV1 and DPV2 objects. ItCount = 0; - for (DPValue &Item : RetInst->DbgMarker->getDbgValueRange()) { + for (DbgRecord &Item : RetInst->DbgMarker->getDbgValueRange()) { EXPECT_TRUE((&Item == DPV2 && ItCount == 0) || (&Item == DPV1 && ItCount == 1)); EXPECT_EQ(Item.getMarker(), RetInst->DbgMarker); @@ -1019,7 +1022,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) { EXPECT_EQ(EndMarker->StoredDPValues.size(), 2u); // Test again that it's those two DPValues, DPV1 and DPV2. ItCount = 0; - for (DPValue &Item : EndMarker->getDbgValueRange()) { + for (DbgRecord &Item : EndMarker->getDbgValueRange()) { EXPECT_TRUE((&Item == DPV2 && ItCount == 0) || (&Item == DPV1 && ItCount == 1)); EXPECT_EQ(Item.getMarker(), EndMarker); @@ -1110,13 +1113,15 @@ TEST(MetadataTest, DPValueConversionRoutines) { EXPECT_EQ(SecondInst, SecondInst->DbgMarker->MarkedInstr); EXPECT_EQ(FirstInst->DbgMarker->StoredDPValues.size(), 1u); - DPValue *DPV1 = &*FirstInst->DbgMarker->getDbgValueRange().begin(); + DPValue *DPV1 = + cast<DPValue>(&*FirstInst->DbgMarker->getDbgValueRange().begin()); EXPECT_EQ(DPV1->getMarker(), FirstInst->DbgMarker); // Should point at %a, an argument. EXPECT_TRUE(isa<Argument>(DPV1->getVariableLocationOp(0))); EXPECT_EQ(SecondInst->DbgMarker->StoredDPValues.size(), 1u); - DPValue *DPV2 = &*SecondInst->DbgMarker->getDbgValueRange().begin(); + DPValue *DPV2 = + cast<DPValue>(&*SecondInst->DbgMarker->getDbgValueRange().begin()); EXPECT_EQ(DPV2->getMarker(), SecondInst->DbgMarker); // Should point at FirstInst. EXPECT_EQ(DPV2->getVariableLocationOp(0), FirstInst); |