Skip to content

Commit

Permalink
Revert "[Assignment Tracking][5.1/*] Add deleteAssignmentMarkers func…
Browse files Browse the repository at this point in the history
…tion"

This reverts commit 4c44fa1.

This patch has to be reverted because I need to revert 171f702 and without reverting this patch, reverting 171f702 causes conflicts.

Patch 171f702 introduced a cyclic dependency in the module build.

https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/48197/consoleFull#-69937453049ba4694-19c4-4d7e-bec5-911270d8a58c

In file included from <module-includes>:1:
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/Argument.h:18:10: fatal error: cyclic dependency in module 'LLVM_IR': LLVM_IR -> LLVM_intrinsic_gen -> LLVM_IR
         ^
While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14:
While building module 'LLVM_IR' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57:
In file included from <module-includes>:12:
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/DebugInfo.h:24:10: fatal error: could not build module 'LLVM_intrinsic_gen'
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
While building module 'LLVM_MC' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14:
In file included from <module-includes>:15:
In file included from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCContext.h:23:
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/MC/MCPseudoProbe.h:57:10: fatal error: could not build module 'LLVM_IR'
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/MC/MCAsmInfoCOFF.cpp:14:10: fatal error: could not build module 'LLVM_MC'
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
  • Loading branch information
rastogishubham committed Nov 7, 2022
1 parent 41ce74e commit d29d5ff
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
3 changes: 0 additions & 3 deletions llvm/include/llvm/IR/DebugInfo.h
Expand Up @@ -216,9 +216,6 @@ inline AssignmentMarkerRange getAssignmentMarkers(const Instruction *Inst) {
return make_range(Value::user_iterator(), Value::user_iterator());
}

/// Delete the llvm.dbg.assign intrinsics linked to \p Inst.
void deleteAssignmentMarkers(const Instruction *Inst);

/// Replace all uses (and attachments) of \p Old with \p New.
void RAUW(DIAssignID *Old, DIAssignID *New);

Expand Down
9 changes: 0 additions & 9 deletions llvm/lib/IR/DebugInfo.cpp
Expand Up @@ -1673,15 +1673,6 @@ AssignmentMarkerRange at::getAssignmentMarkers(DIAssignID *ID) {
return make_range(IDAsValue->user_begin(), IDAsValue->user_end());
}

void at::deleteAssignmentMarkers(const Instruction *Inst) {
auto Range = getAssignmentMarkers(Inst);
if (Range.empty())
return;
SmallVector<DbgAssignIntrinsic *> ToDelete(Range.begin(), Range.end());
for (auto *DAI : ToDelete)
DAI->eraseFromParent();
}

void at::RAUW(DIAssignID *Old, DIAssignID *New) {
// Replace MetadataAsValue uses.
if (auto *OldIDAsValue =
Expand Down
22 changes: 1 addition & 21 deletions llvm/unittests/IR/DebugInfoTest.cpp
Expand Up @@ -398,13 +398,6 @@ TEST(AssignmentTrackingTest, Utils) {
ret void, !dbg !19
}
define dso_local void @fun3() !dbg !21 {
entry:
%local = alloca i32, align 4, !DIAssignID !24
call void @llvm.dbg.assign(metadata i32 undef, metadata !22, metadata !DIExpression(), metadata !24, metadata i32* undef, metadata !DIExpression()), !dbg !23
ret void
}
declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
Expand Down Expand Up @@ -432,10 +425,6 @@ TEST(AssignmentTrackingTest, Utils) {
!18 = !DILocalVariable(name: "local2", scope: !17, file: !1, line: 2, type: !11)
!19 = !DILocation(line: 4, column: 1, scope: !17)
!20 = distinct !DIAssignID()
!21 = distinct !DISubprogram(name: "fun3", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
!22 = !DILocalVariable(name: "local4", scope: !21, file: !1, line: 2, type: !11)
!23 = !DILocation(line: 4, column: 1, scope: !21)
!24 = distinct !DIAssignID()
)");

// Check the test IR isn't malformed.
Expand Down Expand Up @@ -494,16 +483,7 @@ TEST(AssignmentTrackingTest, Utils) {
ASSERT_TRUE(std::distance(Fun2Insts.begin(), Fun2Insts.end()) == 1);
EXPECT_EQ(*Fun2Insts.begin(), &Fun2Alloca);

// 3. Check that deleting dbg.assigns from a specific instruction works.
Instruction &Fun3Alloca =
*M->getFunction("fun3")->getEntryBlock().getFirstNonPHIOrDbg();
auto Fun3Markers = at::getAssignmentMarkers(&Fun3Alloca);
ASSERT_TRUE(std::distance(Fun3Markers.begin(), Fun3Markers.end()) == 1);
at::deleteAssignmentMarkers(&Fun3Alloca);
Fun3Markers = at::getAssignmentMarkers(&Fun3Alloca);
EXPECT_EQ(Fun3Markers.empty(), true);

// 4. Check that deleting works and applies only to the target function.
// 3. Check that deleting works and applies only to the target function.
at::deleteAll(&Fun1);
// There should now only be the alloca and ret in fun1.
EXPECT_EQ(Fun1.begin()->size(), 2u);
Expand Down

0 comments on commit d29d5ff

Please sign in to comment.