From b0a3702e08c8028ce930a5120198664327dee7be Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 30 2019 09:21:15 +0000 Subject: import llvm-7.0.1-3.module+el8.0.0+3181+ec021930 --- diff --git a/SOURCES/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch b/SOURCES/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch new file mode 100644 index 0000000..d6380eb --- /dev/null +++ b/SOURCES/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch @@ -0,0 +1,60 @@ +From 2ad5ac11b17dac347d29191872b2b3d601bbcd1f Mon Sep 17 00:00:00 2001 +From: Jonas Devlieghere +Date: Fri, 21 Sep 2018 12:03:14 +0000 +Subject: [PATCH 1/2] Ensure that variant part discriminator is read by + MetadataLoader + +https://reviews.llvm.org/D42082 introduced variant parts to debug info +in LLVM. Subsequent work on the Rust compiler has found a bug in that +patch; namely, there is a path in MetadataLoader that fails to restore +the discriminator. + +This patch fixes the bug. + +Patch by: Tom Tromey + +Differential revision: https://reviews.llvm.org/D52340 + +llvm-svn: 342725 +--- + llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 2 +- + llvm/test/Assembler/debug-variant-discriminator.ll | 14 ++++++++++++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + create mode 100644 llvm/test/Assembler/debug-variant-discriminator.ll + +diff --git a/lib/Bitcode/Reader/MetadataLoader.cpp b/lib/Bitcode/Reader/MetadataLoader.cpp +index 011c41e2cecd..a7b542efc19e 100644 +--- a/lib/Bitcode/Reader/MetadataLoader.cpp ++++ b/lib/Bitcode/Reader/MetadataLoader.cpp +@@ -1308,7 +1308,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( + (Context, Tag, Name, File, Line, Scope, BaseType, + SizeInBits, AlignInBits, OffsetInBits, Flags, + Elements, RuntimeLang, VTableHolder, TemplateParams, +- Identifier)); ++ Identifier, Discriminator)); + if (!IsNotUsedInTypeRef && Identifier) + MetadataList.addTypeRef(*Identifier, *cast(CT)); + +diff --git a/test/Assembler/debug-variant-discriminator.ll b/test/Assembler/debug-variant-discriminator.ll +new file mode 100644 +index 000000000000..5be001cad6be +--- /dev/null ++++ b/test/Assembler/debug-variant-discriminator.ll +@@ -0,0 +1,14 @@ ++; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s ++; RUN: verify-uselistorder %s ++ ++; CHECK: !named = !{!0, !1, !2} ++!named = !{!0, !1, !2} ++ ++; CHECK: !0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer") ++; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2) ++; CHECK-NEXT: !2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial) ++; CHECK-NEXT: !3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) ++!0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer") ++!1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2) ++!2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial) ++!3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) +-- +2.20.1 + diff --git a/SOURCES/0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch b/SOURCES/0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch new file mode 100644 index 0000000..b6ce1d8 --- /dev/null +++ b/SOURCES/0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch @@ -0,0 +1,154 @@ +From 9959e0572c47e3cdedb51d05bf76bb56965ede98 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Fri, 7 Sep 2018 22:19:20 -0700 +Subject: [PATCH] [GlobalISel] Lower dbg.declare into indirect DBG_VALUE + +Summary: +D31439 changed the semantics of dbg.declare to take the address of a +variable as the first argument, making it indirect. It specifically +updated FastISel for this change here: + +https://reviews.llvm.org/D31439#change-WVArzi177jPl + +GlobalISel needs to follow suit, or else it will be missing a level of +indirection in the generated debuginfo. This problem was seen in a Rust +debuginfo test on aarch64, since GlobalISel is used at -O0 for aarch64. + +https://github.com/rust-lang/rust/issues/49807 +https://bugzilla.redhat.com/show_bug.cgi?id=1611597 +https://bugzilla.redhat.com/show_bug.cgi?id=1625768 + +Reviewers: dblaikie, aprantl, t.p.northover, javed.absar, rnk + +Reviewed By: rnk + +Subscribers: #debug-info, rovka, kristof.beyls, JDevlieghere, llvm-commits, tstellar + +Differential Revision: https://reviews.llvm.org/D51749 +--- + lib/CodeGen/GlobalISel/IRTranslator.cpp | 9 ++-- + test/CodeGen/AArch64/GlobalISel/debug-cpp.ll | 67 ++++++++++++++++++++++++++ + test/CodeGen/AArch64/GlobalISel/debug-insts.ll | 4 +- + 3 files changed, 74 insertions(+), 6 deletions(-) + create mode 100644 test/CodeGen/AArch64/GlobalISel/debug-cpp.ll + +diff --git a/lib/CodeGen/GlobalISel/IRTranslator.cpp b/lib/CodeGen/GlobalISel/IRTranslator.cpp +index 75496fb..9926be3 100644 +--- a/lib/CodeGen/GlobalISel/IRTranslator.cpp ++++ b/lib/CodeGen/GlobalISel/IRTranslator.cpp +@@ -763,9 +763,12 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID, + // instructions (in fact, they get ignored if they *do* exist). + MF->setVariableDbgInfo(DI.getVariable(), DI.getExpression(), + getOrCreateFrameIndex(*AI), DI.getDebugLoc()); +- } else +- MIRBuilder.buildDirectDbgValue(getOrCreateVReg(*Address), +- DI.getVariable(), DI.getExpression()); ++ } else { ++ // A dbg.declare describes the address of a source variable, so lower it ++ // into an indirect DBG_VALUE. ++ MIRBuilder.buildIndirectDbgValue(getOrCreateVReg(*Address), ++ DI.getVariable(), DI.getExpression()); ++ } + return true; + } + case Intrinsic::vaend: +diff --git a/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll b/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll +new file mode 100644 +index 0000000..e5a4e55 +--- /dev/null ++++ b/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll +@@ -0,0 +1,67 @@ ++; RUN: llc -global-isel -mtriple=aarch64 %s -stop-after=irtranslator -o - | FileCheck %s ++; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 -o /dev/null ++ ++; struct NTCopy { ++; NTCopy(); ++; NTCopy(const NTCopy &); ++; int x; ++; }; ++; int foo(NTCopy o) { ++; return o.x; ++; } ++ ++; ModuleID = 'ntcopy.cpp' ++source_filename = "ntcopy.cpp" ++target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" ++target triple = "aarch64-unknown-linux-gnu" ++ ++%struct.NTCopy = type { i32 } ++ ++; CHECK-LABEL: name: _Z3foo6NTCopy ++; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), 0, !23, !DIExpression(), debug-location !24 ++; Function Attrs: noinline nounwind optnone ++define dso_local i32 @_Z3foo6NTCopy(%struct.NTCopy* %o) #0 !dbg !7 { ++entry: ++ call void @llvm.dbg.declare(metadata %struct.NTCopy* %o, metadata !23, metadata !DIExpression()), !dbg !24 ++ %x = getelementptr inbounds %struct.NTCopy, %struct.NTCopy* %o, i32 0, i32 0, !dbg !25 ++ %0 = load i32, i32* %x, align 4, !dbg !25 ++ ret i32 %0, !dbg !26 ++} ++ ++; Function Attrs: nounwind readnone speculatable ++declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ++ ++attributes #0 = { noinline nounwind optnone } ++attributes #1 = { nounwind readnone speculatable } ++ ++!llvm.dbg.cu = !{!0} ++!llvm.module.flags = !{!3, !4, !5} ++!llvm.ident = !{!6} ++ ++!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) ++!1 = !DIFile(filename: "ntcopy.cpp", directory: "/tmp") ++!2 = !{} ++!3 = !{i32 2, !"Dwarf Version", i32 4} ++!4 = !{i32 2, !"Debug Info Version", i32 3} ++!5 = !{i32 1, !"wchar_size", i32 4} ++!6 = !{!"clang version 8.0.0 "} ++!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foo6NTCopy", scope: !1, file: !1, line: 6, type: !8, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) ++!8 = !DISubroutineType(types: !9) ++!9 = !{!10, !11} ++!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) ++!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NTCopy", file: !1, line: 1, size: 32, elements: !12, identifier: "_ZTS6NTCopy") ++!12 = !{!13, !14, !18} ++!13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !1, line: 4, baseType: !10, size: 32) ++!14 = !DISubprogram(name: "NTCopy", scope: !11, file: !1, line: 2, type: !15, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false) ++!15 = !DISubroutineType(types: !16) ++!16 = !{null, !17} ++!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) ++!18 = !DISubprogram(name: "NTCopy", scope: !11, file: !1, line: 3, type: !19, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false) ++!19 = !DISubroutineType(types: !20) ++!20 = !{null, !17, !21} ++!21 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !22, size: 64) ++!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11) ++!23 = !DILocalVariable(name: "o", arg: 1, scope: !7, file: !1, line: 6, type: !11) ++!24 = !DILocation(line: 6, column: 16, scope: !7) ++!25 = !DILocation(line: 7, column: 12, scope: !7) ++!26 = !DILocation(line: 7, column: 3, scope: !7) +diff --git a/test/CodeGen/AArch64/GlobalISel/debug-insts.ll b/test/CodeGen/AArch64/GlobalISel/debug-insts.ll +index 8309e00..256eb37 100644 +--- a/test/CodeGen/AArch64/GlobalISel/debug-insts.ll ++++ b/test/CodeGen/AArch64/GlobalISel/debug-insts.ll +@@ -6,18 +6,16 @@ + ; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}}, + ; CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true, + ; CHECK-NEXT: debug-info-variable: '!11', debug-info-expression: '!DIExpression()', +-; CHECK: DBG_VALUE debug-use %0(s32), debug-use $noreg, !11, !DIExpression(), debug-location !12 + define void @debug_declare(i32 %in) #0 !dbg !7 { + entry: + %in.addr = alloca i32, align 4 + store i32 %in, i32* %in.addr, align 4 + call void @llvm.dbg.declare(metadata i32* %in.addr, metadata !11, metadata !DIExpression()), !dbg !12 +- call void @llvm.dbg.declare(metadata i32 %in, metadata !11, metadata !DIExpression()), !dbg !12 + ret void, !dbg !12 + } + + ; CHECK-LABEL: name: debug_declare_vla +-; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use $noreg, !14, !DIExpression(), debug-location !15 ++; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), 0, !14, !DIExpression(), debug-location !15 + define void @debug_declare_vla(i32 %in) #0 !dbg !13 { + entry: + %vla.addr = alloca i32, i32 %in +-- +1.8.3.1 + diff --git a/SOURCES/0002-test-Fix-Assembler-debug-info.ll.patch b/SOURCES/0002-test-Fix-Assembler-debug-info.ll.patch new file mode 100644 index 0000000..d022d97 --- /dev/null +++ b/SOURCES/0002-test-Fix-Assembler-debug-info.ll.patch @@ -0,0 +1,28 @@ +From 9bfebd6e47cb8513dcd7f7203f29489bdec7bfe4 Mon Sep 17 00:00:00 2001 +From: Jonas Devlieghere +Date: Fri, 21 Sep 2018 12:28:44 +0000 +Subject: [PATCH 2/2] [test] Fix Assembler/debug-info.ll + +Update Assembler/debug-info.ll to contain discriminator. + +llvm-svn: 342727 +--- + llvm/test/Assembler/debug-info.ll | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/Assembler/debug-info.ll b/test/Assembler/debug-info.ll +index 5dfb8cd93435..605afc3f1587 100644 +--- a/test/Assembler/debug-info.ll ++++ b/test/Assembler/debug-info.ll +@@ -83,7 +83,7 @@ + ; CHECK-NEXT: !32 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f") + !35 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f") + +-; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64) ++; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64, discriminator: !34) + ; CHECK-NEXT: !34 = !DIDerivedType(tag: DW_TAG_member, scope: !33, baseType: !35, size: 64, align: 64, flags: DIFlagArtificial) + ; CHECK-NEXT: !35 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) + !36 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !16, size: 64, discriminator: !37) +-- +2.20.1 + diff --git a/SPECS/llvm.spec b/SPECS/llvm.spec index f7830c3..97a2738 100644 --- a/SPECS/llvm.spec +++ b/SPECS/llvm.spec @@ -1,5 +1,5 @@ # Components enabled if supported by target architecture: -%ifarch %ix86 x86_64 %{arm} +%ifarch %ix86 x86_64 %bcond_without gold %else %bcond_with gold @@ -22,7 +22,7 @@ Name: llvm Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 1%{?dist} +Release: 3%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -45,6 +45,12 @@ Patch15: 0001-Don-t-set-rpath-when-installing.patch Patch16: 0001-Re-apply-r346985-ADT-Drop-llvm-Optional-clang-specif.patch #rhbz#1636479 Patch17: 0001-Disable-threading-in-thinLTO.patch +#rhbz#1696190 +Patch19: 0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch +#rhbz#1699374 +Patch20: 0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch +Patch21: 0002-test-Fix-Assembler-debug-info.ll.patch + %if %{defined compat_version} # Compat patches @@ -172,7 +178,7 @@ sed -i 's~@TOOLS_DIR@~%{llvm_bindir}~' %{SOURCE1} mkdir -p _build cd _build -%ifarch s390 %ix86 %{arm} +%ifarch s390 %ix86 # Decrease debuginfo verbosity to reduce memory consumption during final library linking %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %endif @@ -181,7 +187,7 @@ cd _build %cmake .. \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -%ifarch s390 %ix86 %{arm} +%ifarch s390 %ix86 -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif @@ -390,8 +396,11 @@ fi %{_libdir}/libLLVMTestingSupport.a %changelog -* Mon Jun 03 2019 Pablo Greco 7.0.1-1 -- Fix build on armhfp +* Fri Apr 19 2019 Tom Stellard - 7.0.1-3 +- Backport r342725 from trunk + +* Sat Apr 13 2019 Tom Stellard - 7.0.1-2 +- Backport r341969 from LLVM trunk * Fri Dec 14 2018 Tom Stellard - 7.0.1-1 - 7.0.1 Release