aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Transforms/Utils/CloningTest.cpp
diff options
context:
space:
mode:
authorHarald van Dijk <harald.vandijk@codeplay.com>2024-05-08 17:02:25 +0100
committerGitHub <noreply@github.com>2024-05-08 17:02:25 +0100
commita6171900a446c85c3b53a4a9deba16b746f9f77f (patch)
treea4c708cfd36f3439d840b6d23d7bb8b4a1fad7d8 /llvm/unittests/Transforms/Utils/CloningTest.cpp
parent2ceb1291ef3ddb87cb58030cd61d965f4030338f (diff)
downloadllvm-a6171900a446c85c3b53a4a9deba16b746f9f77f.zip
llvm-a6171900a446c85c3b53a4a9deba16b746f9f77f.tar.gz
llvm-a6171900a446c85c3b53a4a9deba16b746f9f77f.tar.bz2
[RemoveDIs] Change remapDbgVariableRecord to remapDbgRecord (#91456)
We need to remap any DbgRecord, not just DbgVariableRecords. This is the followup to #91447. Co-authored-by: PietroGhg <pietro.ghiglio@codeplay.com>
Diffstat (limited to 'llvm/unittests/Transforms/Utils/CloningTest.cpp')
-rw-r--r--llvm/unittests/Transforms/Utils/CloningTest.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/unittests/Transforms/Utils/CloningTest.cpp b/llvm/unittests/Transforms/Utils/CloningTest.cpp
index 6f4e860d..1d0d56a 100644
--- a/llvm/unittests/Transforms/Utils/CloningTest.cpp
+++ b/llvm/unittests/Transforms/Utils/CloningTest.cpp
@@ -1122,4 +1122,41 @@ TEST_F(CloneModule, IFunc) {
EXPECT_EQ("resolver", Resolver->getName());
EXPECT_EQ(GlobalValue::PrivateLinkage, Resolver->getLinkage());
}
+
+TEST_F(CloneModule, CloneDbgLabel) {
+ LLVMContext Context;
+
+ std::unique_ptr<Module> M = parseIR(Context,
+ R"M(
+define void @noop(ptr nocapture noundef writeonly align 4 %dst) local_unnamed_addr !dbg !3 {
+entry:
+ %call = tail call spir_func i64 @foo(i32 noundef 0)
+ #dbg_label(!11, !12)
+ store i64 %call, ptr %dst, align 4
+ ret void
+}
+
+declare i64 @foo(i32 noundef) local_unnamed_addr
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
+!1 = !DIFile(filename: "<stdin>", directory: "foo")
+!2 = !{i32 2, !"Debug Info Version", i32 3}
+!3 = distinct !DISubprogram(name: "noop", scope: !4, file: !4, line: 17, type: !5, scopeLine: 17, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+!4 = !DIFile(filename: "file", directory: "foo")
+!5 = !DISubroutineType(types: !6)
+!6 = !{null, !7}
+!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)
+!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!9 = !{}
+!11 = !DILabel(scope: !3, name: "foo", file: !4, line: 23)
+!12 = !DILocation(line: 23, scope: !3)
+)M");
+
+ ASSERT_FALSE(verifyModule(*M, &errs()));
+ auto NewM = llvm::CloneModule(*M);
+ EXPECT_FALSE(verifyModule(*NewM, &errs()));
}
+} // namespace