[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79547 (PR #79548)
https://github.com/github-actions[bot] created https://github.com/llvm/llvm-project/pull/79548 resolves llvm/llvm-project#79547 >From 37ff0726bfbadd62ff5097ac37266288a4c46616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Fri, 26 Jan 2024 05:09:28 +0100 Subject: [PATCH] [llvm] [cmake] Include httplib in LLVMConfig.cmake (#79305) Include LLVM_ENABLE_HTTPLIB along with httplib package finding in LLVMConfig.cmake, as this dependency is needed by LLVMDebuginfod that is now used by LLDB. Without it, building LLDB standalone fails with: ``` CMake Error at /usr/lib/llvm/19/lib64/cmake/llvm/LLVMExports.cmake:90 (set_target_properties): The link interface of target "LLVMDebuginfod" contains: httplib::httplib but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. Call Stack (most recent call first): /usr/lib/llvm/19/lib64/cmake/llvm/LLVMConfig.cmake:357 (include) cmake/modules/LLDBStandalone.cmake:9 (find_package) CMakeLists.txt:34 (include) ``` (cherry picked from commit 3c9f34c12450345c6eb524e47cf79664271e4260) --- llvm/cmake/modules/LLVMConfig.cmake.in | 5 + 1 file changed, 5 insertions(+) diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in index 74e1c6bf52e2305..770a9caea322e6a 100644 --- a/llvm/cmake/modules/LLVMConfig.cmake.in +++ b/llvm/cmake/modules/LLVMConfig.cmake.in @@ -90,6 +90,11 @@ if(LLVM_ENABLE_CURL) find_package(CURL) endif() +set(LLVM_ENABLE_HTTPLIB @LLVM_ENABLE_HTTPLIB@) +if(LLVM_ENABLE_HTTPLIB) + find_package(httplib) +endif() + set(LLVM_WITH_Z3 @LLVM_WITH_Z3@) set(LLVM_ENABLE_DIA_SDK @LLVM_ENABLE_DIA_SDK@) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79547 (PR #79548)
https://github.com/github-actions[bot] milestoned https://github.com/llvm/llvm-project/pull/79548 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79451 (PR #79457)
tstellar wrote: @arsenm What do you think about this? https://github.com/llvm/llvm-project/pull/79457 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79339 (PR #79357)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/79357 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79339 (PR #79357)
tstellar wrote: Merged: 0991d3c7b53dd11981bd4f7d512b7f044c74e8f8 https://github.com/llvm/llvm-project/pull/79357 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] 0991d3c - [ELF] Don't resolve relocations referencing SHN_ABS to tombstone in non-SHF_ALLOC sections (#79238)
Author: Fangrui Song Date: 2024-01-25T17:27:37-08:00 New Revision: 0991d3c7b53dd11981bd4f7d512b7f044c74e8f8 URL: https://github.com/llvm/llvm-project/commit/0991d3c7b53dd11981bd4f7d512b7f044c74e8f8 DIFF: https://github.com/llvm/llvm-project/commit/0991d3c7b53dd11981bd4f7d512b7f044c74e8f8.diff LOG: [ELF] Don't resolve relocations referencing SHN_ABS to tombstone in non-SHF_ALLOC sections (#79238) A SHN_ABS symbol has never been considered for InputSection::relocateNonAlloc. Before #74686, the code did made it work in the absence of `-z dead-reloc-in-nonalloc=`. There is now a report about such SHN_ABS uses (https://github.com/llvm/llvm-project/pull/74686#issuecomment-1904101711) and I think it makes sense for non-SHF_ALLOC to support SHN_ABS, like SHF_ALLOC sections do. ``` // clang -g __attribute__((weak)) int symbol; int *foo() { return &symbol; } 0x0023: DW_TAG_variable [2] (0x000c) ... DW_AT_location [DW_FORM_exprloc](DW_OP_addrx 0x0) ``` .debug_addr references `symbol`, which can be redefined by a symbol assignment or --defsym to become a SHN_ABS symbol. The problem is that `!sym.getOutputSection()` cannot discern SHN_ABS from a symbol whose section has been discarded. Since commit 1981b1b6b92f7579a30c9ed32dbdf3bc749c1b40, a symbol relative to a discarded section is changed to `Undefined`, so the `SHN_ABS` check become trivial. We currently apply tombstone for a relocation referencing `SharedSymbol`. This patch does not change the behavior. (cherry picked from commit 8abf8d124ae346016c56209de7f57b85671d4367) Added: Modified: lld/ELF/InputSection.cpp lld/test/ELF/dead-reloc-in-nonalloc.s Removed: diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index c728dd6c6306aa0..0e0b9783bd88a0f 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -961,12 +961,11 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef rels) { // vector. The computed value is st_value plus a non-negative offset. // Negative values are invalid, so -1 can be used as the tombstone value. // - // If the referenced symbol is discarded (made Undefined), or the - // section defining the referenced symbol is garbage collected, - // sym.getOutputSection() is nullptr. `ds->folded` catches the ICF folded - // case. However, resolving a relocation in .debug_line to -1 would stop - // debugger users from setting breakpoints on the folded-in function, so - // exclude .debug_line. + // If the referenced symbol is relative to a discarded section (due to + // --gc-sections, COMDAT, etc), it has been converted to a Undefined. + // `ds->folded` catches the ICF folded case. However, resolving a + // relocation in .debug_line to -1 would stop debugger users from setting + // breakpoints on the folded-in function, so exclude .debug_line. // // For pre-DWARF-v5 .debug_loc and .debug_ranges, -1 is a reserved value // (base address selection entry), use 1 (which is used by GNU ld for @@ -974,7 +973,7 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef rels) { // // TODO To reduce disruption, we use 0 instead of -1 as the tombstone // value. Enable -1 in a future release. - if (!sym.getOutputSection() || (ds && ds->folded && !isDebugLine)) { + if (!ds || (ds->folded && !isDebugLine)) { // If -z dead-reloc-in-nonalloc= is specified, respect it. uint64_t value = SignExtend64(*tombstone); // For a 32-bit local TU reference in .debug_names, X86_64::relocate diff --git a/lld/test/ELF/dead-reloc-in-nonalloc.s b/lld/test/ELF/dead-reloc-in-nonalloc.s index 145604eb883a9af..b675fc50fc2ea2f 100644 --- a/lld/test/ELF/dead-reloc-in-nonalloc.s +++ b/lld/test/ELF/dead-reloc-in-nonalloc.s @@ -17,7 +17,7 @@ # AA: Contents of section .debug_info: # AA-NEXT: [[ADDR]] # AA: Contents of section .not_debug: -# AA-NEXT: . +# AA-NEXT: 2a00 . ## Specifying zero can get a behavior similar to GNU ld. # RUN: ld.lld --icf=all -z dead-reloc-in-nonalloc=.debug_info=0 %t.o %tabs.o -o %tzero ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79279 (PR #79341)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/79341 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79279 (PR #79341)
tstellar wrote: Merged: 453ff4b7333d4cfef8593fdf54de831d32321e44 https://github.com/llvm/llvm-project/pull/79341 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 453ff4b - [X86][CodeGen] Fix crash when commute operands of Instruction for code size (#79245)
Author: Shengchen Kan Date: 2024-01-25T17:24:02-08:00 New Revision: 453ff4b7333d4cfef8593fdf54de831d32321e44 URL: https://github.com/llvm/llvm-project/commit/453ff4b7333d4cfef8593fdf54de831d32321e44 DIFF: https://github.com/llvm/llvm-project/commit/453ff4b7333d4cfef8593fdf54de831d32321e44.diff LOG: [X86][CodeGen] Fix crash when commute operands of Instruction for code size (#79245) Reported in 134fcc62786d31ab73439201dce2d73808d1785a Incorrect opcode is used b/c there is a `[[fallthrough]]` at line 2386. (cherry picked from commit 33ecef9812e2c9bfadef035b8e34a949acae2abc) Added: Modified: llvm/lib/Target/X86/X86InstrInfo.cpp llvm/test/CodeGen/X86/commute-blend-avx2.ll Removed: diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index d6f9aa6d6acec09..9ac1f783b7f0a19 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -2354,33 +2354,26 @@ MachineInstr *X86InstrInfo::commuteInstructionImpl(MachineInstr &MI, bool NewMI, case X86::VBLENDPSrri: // If we're optimizing for size, try to use MOVSD/MOVSS. if (MI.getParent()->getParent()->getFunction().hasOptSize()) { - unsigned Mask; - switch (Opc) { - default: -llvm_unreachable("Unreachable!"); - case X86::BLENDPDrri: -Opc = X86::MOVSDrr; -Mask = 0x03; -break; - case X86::BLENDPSrri: -Opc = X86::MOVSSrr; -Mask = 0x0F; -break; - case X86::VBLENDPDrri: -Opc = X86::VMOVSDrr; -Mask = 0x03; -break; - case X86::VBLENDPSrri: -Opc = X86::VMOVSSrr; -Mask = 0x0F; -break; - } + unsigned Mask = (Opc == X86::BLENDPDrri || Opc == X86::VBLENDPDrri) ? 0x03: 0x0F; if ((MI.getOperand(3).getImm() ^ Mask) == 1) { +#define FROM_TO(FROM, TO) \ + case X86::FROM: \ +Opc = X86::TO; \ +break; +switch (Opc) { +default: + llvm_unreachable("Unreachable!"); +FROM_TO(BLENDPDrri, MOVSDrr) +FROM_TO(BLENDPSrri, MOVSSrr) +FROM_TO(VBLENDPDrri, VMOVSDrr) +FROM_TO(VBLENDPSrri, VMOVSSrr) +} WorkingMI = CloneIfNew(MI); WorkingMI->setDesc(get(Opc)); WorkingMI->removeOperand(3); break; } +#undef FROM_TO } [[fallthrough]]; case X86::PBLENDWrri: diff --git a/llvm/test/CodeGen/X86/commute-blend-avx2.ll b/llvm/test/CodeGen/X86/commute-blend-avx2.ll index b5ffe78d29a610d..75511104580e903 100644 --- a/llvm/test/CodeGen/X86/commute-blend-avx2.ll +++ b/llvm/test/CodeGen/X86/commute-blend-avx2.ll @@ -88,3 +88,12 @@ define <4 x double> @commute_fold_vblendpd_256(<4 x double> %a, ptr %b) #0 { ret <4 x double> %2 } declare <4 x double> @llvm.x86.avx.blend.pd.256(<4 x double>, <4 x double>, i8) nounwind readnone + +define <4 x float> @commute_vblendpd_128_for_code_size(<4 x float> %a, <4 x float> %b) optsize { +; CHECK-LABEL: commute_vblendpd_128_for_code_size: +; CHECK: # %bb.0: +; CHECK-NEXT:vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2,3] +; CHECK-NEXT:retq + %r = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> + ret <4 x float> %r +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [clang] PR for llvm/llvm-project#79277 (PR #79340)
tstellar wrote: @arsenm Is this OK to backport? https://github.com/llvm/llvm-project/pull/79340 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79253 (PR #79323)
tstellar wrote: Merged: c9e73cdd9a17f15ede120ea57657553f9e105eab https://github.com/llvm/llvm-project/pull/79323 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79253 (PR #79323)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/79323 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] c9e73cd - [test] Update dwarf-loongarch-relocs.ll
Author: Weining Lu Date: 2024-01-25T17:14:34-08:00 New Revision: c9e73cdd9a17f15ede120ea57657553f9e105eab URL: https://github.com/llvm/llvm-project/commit/c9e73cdd9a17f15ede120ea57657553f9e105eab DIFF: https://github.com/llvm/llvm-project/commit/c9e73cdd9a17f15ede120ea57657553f9e105eab.diff LOG: [test] Update dwarf-loongarch-relocs.ll Address buildbot faiures: http://45.33.8.238/macm1/77360/step_11.txt http://45.33.8.238/linux/128902/step_12.txt (cherry picked from commit baba7e4175b6ca21e83b1cf8229f29dbba02e979) Added: Modified: llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll Removed: diff --git a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll index e03b4c1d34de157..07443a62b93391b 100644 --- a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll +++ b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll @@ -1,19 +1,22 @@ ; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=-relax %s -o %t.o ; RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-NORL %s -; RUN: llvm-objdump --source %t.o | FileCheck --check-prefix=SOURCE %s -; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefix=DWARF %s +; RUN: llvm-objdump --source %t.o | FileCheck --check-prefixes=SOURCE,SOURCE-NORL %s +; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefixes=DWARF,DWARF-NORL %s ; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=+relax %s -o %t.r.o ; RUN: llvm-readobj -r %t.r.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-ENRL %s -; RUN: llvm-objdump --source %t.r.o | FileCheck --check-prefix=SOURCE %s -; RUN: llvm-dwarfdump --debug-info --debug-line %t.r.o | FileCheck --check-prefix=DWARF %s +; RUN: llvm-objdump --source %t.r.o | FileCheck --check-prefixes=SOURCE,SOURCE-ENRL %s +; RUN: llvm-dwarfdump --debug-info --debug-line %t.r.o | FileCheck --check-prefixes=DWARF,DWARF-ENRL %s ; RELOCS-BOTH: Relocations [ ; RELOCS-BOTH-NEXT:Section ({{.*}}) .rela.text { -; RELOCS-BOTH-NEXT: 0x14 R_LARCH_PCALA_HI20 sym 0x0 -; RELOCS-ENRL-NEXT: 0x14 R_LARCH_RELAX - 0x0 -; RELOCS-BOTH-NEXT: 0x18 R_LARCH_PCALA_LO12 sym 0x0 -; RELOCS-ENRL-NEXT: 0x18 R_LARCH_RELAX - 0x0 +; RELOCS-NORL-NEXT: 0x14 R_LARCH_PCALA_HI20 sym 0x0 +; RELOCS-NORL-NEXT: 0x18 R_LARCH_PCALA_LO12 sym 0x0 +; RELOCS-ENRL-NEXT: 0x0 R_LARCH_ALIGN .Lla-relax-align0 0x5 +; RELOCS-ENRL-NEXT: 0x30 R_LARCH_PCALA_HI20 sym 0x0 +; RELOCS-ENRL-NEXT: 0x30 R_LARCH_RELAX - 0x0 +; RELOCS-ENRL-NEXT: 0x34 R_LARCH_PCALA_LO12 sym 0x0 +; RELOCS-ENRL-NEXT: 0x34 R_LARCH_RELAX - 0x0 ; RELOCS-BOTH-NEXT:} ; RELOCS-BOTH: Section ({{.*}}) .rela.debug_frame { ; RELOCS-NORL-NEXT: 0x1C R_LARCH_32 .debug_frame 0x0 @@ -36,7 +39,8 @@ ; RELOCS-BOTH-NEXT:} ; RELOCS-BOTH-NEXT: ] -; SOURCE: : +; SOURCE-NORL: : +; SOURCE-ENRL: 001c : ; SOURCE: ; { ; SOURCE: ; asm volatile( ; SOURCE: ; return 0; @@ -87,11 +91,16 @@ ; DWARF-EMPTY: ; DWARF-NEXT: AddressLine Column File ISA Discriminator OpIndex Flags ; DWARF-NEXT: -- -- -- -- --- - --- - -; DWARF-NEXT: 0x 2 0 0 0 0 0 is_stmt -; DWARF-NEXT: 0x0010 3 3 0 0 0 0 is_stmt prologue_end -; DWARF-NEXT: 0x0020 10 3 0 0 0 0 is_stmt -; DWARF-NEXT: 0x002c 10 3 0 0 0 0 epilogue_begin -; DWARF-NEXT: 0x0034 10 3 0 0 0 0 end_sequence +; DWARF-NORL-NEXT: 0x 2 0 0 0 0 0 is_stmt +; DWARF-NORL-NEXT: 0x0010 3 3 0 0 0 0 is_stmt prologue_end +; DWARF-NORL-NEXT: 0x0020 10 3 0 0 0 0 is_stmt +; DWARF-NORL-NEXT: 0x002c 10 3 0 0 0 0 epilogue_begin +; DWARF-NORL-NEXT: 0x0034 10 3 0 0 0 0 end_sequence +; DWARF-ENRL-NEXT: 0x001c 2 0 0 0 0 0 is_stmt +; DWARF-ENRL-NEXT: 0x002c 3 3 0 0 0 0 is_stmt prologue_end +; DWARF-ENRL-NEXT: 0x003c 10 3 0 0 0 0 is_stmt +; DWARF-ENRL-NEXT: 0x0048 10 3 0 0 0 0 epilogue_begin +; DWARF-ENRL-NEXT: 0x0050 10 3 0 0 0 0 end_sequence ; ModuleID = 'dwarf-loongarch-relocs.c' source_filename = "dwarf-loongarch-relocs.c"
[llvm-branch-commits] [libc] 01f28ad - Revert "[libc] add epoll_wait functions"
Author: michaelrj-google Date: 2024-01-25T17:05:25-08:00 New Revision: 01f28ada42e8e4b9e66d4f195c7574a5fee2b305 URL: https://github.com/llvm/llvm-project/commit/01f28ada42e8e4b9e66d4f195c7574a5fee2b305 DIFF: https://github.com/llvm/llvm-project/commit/01f28ada42e8e4b9e66d4f195c7574a5fee2b305.diff LOG: Revert "[libc] add epoll_wait functions" Added: Modified: libc/config/linux/aarch64/entrypoints.txt libc/config/linux/aarch64/headers.txt libc/config/linux/api.td libc/config/linux/arm/entrypoints.txt libc/config/linux/arm/headers.txt libc/config/linux/riscv/entrypoints.txt libc/config/linux/riscv/headers.txt libc/config/linux/syscall_numbers.h.inc libc/config/linux/x86_64/entrypoints.txt libc/config/linux/x86_64/headers.txt libc/include/CMakeLists.txt libc/include/llvm-libc-types/CMakeLists.txt libc/spec/gnu_ext.td libc/spec/linux.td libc/src/sys/CMakeLists.txt libc/test/src/sys/CMakeLists.txt utils/bazel/llvm-project-overlay/libc/BUILD.bazel Removed: libc/include/llvm-libc-types/struct_epoll_data.h libc/include/llvm-libc-types/struct_epoll_event.h libc/include/sys/epoll.h.def libc/src/sys/epoll/CMakeLists.txt libc/src/sys/epoll/epoll_pwait.h libc/src/sys/epoll/epoll_pwait2.h libc/src/sys/epoll/epoll_wait.h libc/src/sys/epoll/linux/CMakeLists.txt libc/src/sys/epoll/linux/epoll_pwait.cpp libc/src/sys/epoll/linux/epoll_pwait2.cpp libc/src/sys/epoll/linux/epoll_wait.cpp libc/test/src/sys/epoll/CMakeLists.txt libc/test/src/sys/epoll/linux/CMakeLists.txt libc/test/src/sys/epoll/linux/epoll_pwait2_test.cpp libc/test/src/sys/epoll/linux/epoll_pwait_test.cpp libc/test/src/sys/epoll/linux/epoll_wait_test.cpp utils/bazel/llvm-project-overlay/libc/test/src/sys/epoll/BUILD.bazel diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt index beec23570ebfc71..52f1d2bce34f4c4 100644 --- a/libc/config/linux/aarch64/entrypoints.txt +++ b/libc/config/linux/aarch64/entrypoints.txt @@ -172,11 +172,6 @@ set(TARGET_LIBC_ENTRYPOINTS # sys/auxv.h entrypoints libc.src.sys.auxv.getauxval -# sys/epoll.h entrypoints -libc.src.sys.epoll.epoll_wait -libc.src.sys.epoll.epoll_pwait -libc.src.sys.epoll.epoll_pwait2 - # termios.h entrypoints libc.src.termios.cfgetispeed libc.src.termios.cfgetospeed diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt index 4c8620951ccfe39..60d978bcaa76e44 100644 --- a/libc/config/linux/aarch64/headers.txt +++ b/libc/config/linux/aarch64/headers.txt @@ -24,5 +24,4 @@ set(TARGET_PUBLIC_HEADERS libc.include.unistd libc.include.sys_ioctl -libc.include.sys_epoll ) diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td index b8fe16cc0c79ea3..85f6b59264eb06d 100644 --- a/libc/config/linux/api.td +++ b/libc/config/linux/api.td @@ -1,11 +1,11 @@ include "config/public_api.td" -include "spec/stdc.td" -include "spec/posix.td" -include "spec/linux.td" -include "spec/gnu_ext.td" include "spec/bsd_ext.td" +include "spec/gnu_ext.td" +include "spec/linux.td" include "spec/llvm_libc_ext.td" +include "spec/posix.td" +include "spec/stdc.td" def AssertMacro : MacroDef<"assert"> { let Defn = [{ @@ -242,10 +242,6 @@ def SysUtsNameAPI : PublicAPI<"sys/utsname.h"> { let Types = ["struct utsname"]; } -def SysEpollAPI : PublicAPI<"sys/epoll.h"> { - let Types = ["struct epoll_event", "struct epoll_data", "sigset_t", "struct timespec"]; -} - def SpawnAPI : PublicAPI<"spawn.h"> { let Types = ["mode_t", "pid_t", "posix_spawnattr_t", "posix_spawn_file_actions_t"]; } diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt index f3f42a4cbc1e1a8..c75ac2302d4ac45 100644 --- a/libc/config/linux/arm/entrypoints.txt +++ b/libc/config/linux/arm/entrypoints.txt @@ -95,12 +95,6 @@ set(TARGET_LIBC_ENTRYPOINTS # sys/prctl.h entrypoints libc.src.sys.prctl.prctl - -# sys/epoll.h entrypoints -libc.src.sys.epoll.epoll_wait -libc.src.sys.epoll.epoll_pwait -libc.src.sys.epoll.epoll_pwait2 - ) set(TARGET_LIBM_ENTRYPOINTS diff --git a/libc/config/linux/arm/headers.txt b/libc/config/linux/arm/headers.txt index e9ded77f19566fa..9e6ee51675916e3 100644 --- a/libc/config/linux/arm/headers.txt +++ b/libc/config/linux/arm/headers.txt @@ -9,6 +9,4 @@ set(TARGET_PUBLIC_HEADERS libc.include.string libc.include.strings libc.include.search - -libc.include.sys_epoll ) diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt index a33fd1b0993f0de..a257f3f8d64ab98 100644 --- a/libc/config/linux/riscv/entrypoints.txt +++ b/libc/config/linux/riscv/entrypoints.txt @@ -178,11 +178,6 @@ set(TARGET_LIBC_ENTRYPOINTS # sys/auxv.h entry
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/modiking approved this pull request. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -1285,46 +1285,44 @@ void annotateValueSite(Module &M, Instruction &Inst, Inst.setMetadata(LLVMContext::MD_prof, MDNode::get(Ctx, Vals)); } -bool getValueProfDataFromInst(const Instruction &Inst, - InstrProfValueKind ValueKind, - uint32_t MaxNumValueData, - InstrProfValueData ValueData[], - uint32_t &ActualNumValueData, uint64_t &TotalC, - bool GetNoICPValue) { +MDNode *mayHaveValueProfileOfKind(const Instruction &Inst, + InstrProfValueKind ValueKind) { MDNode *MD = Inst.getMetadata(LLVMContext::MD_prof); if (!MD) -return false; +return nullptr; - unsigned NOps = MD->getNumOperands(); + if (MD->getNumOperands() < 5) +return nullptr; - if (NOps < 5) -return false; - - // Operand 0 is a string tag "VP": MDString *Tag = cast(MD->getOperand(0)); - if (!Tag) -return false; - - if (!Tag->getString().equals("VP")) -return false; + if (!Tag || !Tag->getString().equals("VP")) +return nullptr; // Now check kind: ConstantInt *KindInt = mdconst::dyn_extract(MD->getOperand(1)); if (!KindInt) -return false; +return nullptr; if (KindInt->getZExtValue() != ValueKind) -return false; +return nullptr; + + return MD; +} +static bool getValueProfDataFromInst(const MDNode *const MD, modiking wrote: >I could do the refactoring this before major implementation changes are in, so >this pr picks up unique_ptr interface soon. Will leave this PR as it is >for now, and update it after refactoring one is in the main branch. Definitely don't need to change this PR, just making sure it's something that's on your radar so we can keep the code clean. >There are two bool version in this pr, one is this static function and the >other one is non-static function (called by existing callers of bool version). >The non-static bool version gets the checking from mayHaveValueProfileOfKind. I see, or rather I see now that you told me π. Given that consider renaming the static function (`getValueProfDataFromInstImpl`?) to make it easier to distinguish. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -129,15 +131,11 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, if (I) { uint32_t ActualNumValueData = 0; uint64_t TotalCount = 0; -// 24 is the maximum number of values preserved for one instrumented site, -// defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in -// compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as -// `MaxNumValueData` controls the max number of elements in the returned -// array. The actual number of values is gated by the number of ops in !prof -// metadata. +// MaxNumVTableAnnotations is the maximum number of vtables annotated on +// the instruction. auto ValueDataArray = getValueProfDataFromInst( -*I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData, -TotalCount); +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, minglotus-6 wrote: done. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -124,6 +126,24 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, Worklist.push_back(Operand); } } + + const Instruction *I = dyn_cast(CurUser); + if (I) { +uint32_t ActualNumValueData = 0; +uint64_t TotalCount = 0; +// MaxNumVTableAnnotations is the maximum number of vtables annotated on +// the instruction. +auto ValueDataArray = getValueProfDataFromInst( +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, +ActualNumValueData, TotalCount); + +if (ValueDataArray.get()) { + for (uint32_t j = 0; j < ActualNumValueData; j++) { +RefEdges.insert(Index.getOrInsertValueInfo( +ValueDataArray[j].Value /* VTableGUID */)); minglotus-6 wrote: done. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -1285,46 +1285,44 @@ void annotateValueSite(Module &M, Instruction &Inst, Inst.setMetadata(LLVMContext::MD_prof, MDNode::get(Ctx, Vals)); } -bool getValueProfDataFromInst(const Instruction &Inst, - InstrProfValueKind ValueKind, - uint32_t MaxNumValueData, - InstrProfValueData ValueData[], - uint32_t &ActualNumValueData, uint64_t &TotalC, - bool GetNoICPValue) { +MDNode *mayHaveValueProfileOfKind(const Instruction &Inst, + InstrProfValueKind ValueKind) { MDNode *MD = Inst.getMetadata(LLVMContext::MD_prof); if (!MD) -return false; +return nullptr; - unsigned NOps = MD->getNumOperands(); + if (MD->getNumOperands() < 5) +return nullptr; - if (NOps < 5) -return false; - - // Operand 0 is a string tag "VP": MDString *Tag = cast(MD->getOperand(0)); - if (!Tag) -return false; - - if (!Tag->getString().equals("VP")) -return false; + if (!Tag || !Tag->getString().equals("VP")) +return nullptr; // Now check kind: ConstantInt *KindInt = mdconst::dyn_extract(MD->getOperand(1)); if (!KindInt) -return false; +return nullptr; if (KindInt->getZExtValue() != ValueKind) -return false; +return nullptr; + + return MD; +} +static bool getValueProfDataFromInst(const MDNode *const MD, minglotus-6 wrote: > Is there a plan to consolidate this function so that it's no longer a stub > for existing callsites? I could do the refactoring this before major implementation changes are in, so this pr picks up `unique_ptr` interface soon. Will leave this PR as it is for now, and update it after refactoring one is in the main branch. > Also, existing callers of the bool version no longer get the checking from > mayHaveValueProfileOfKind which seems to be an unintended change of > functionality There are two `bool` version in this pr, one is this static function and the other one is non-static function (called by existing callers of `bool` version). The non-static `bool` version gets the checking from `mayHaveValueProfileOfKind`. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] [llvm] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -199,14 +199,23 @@ class ModuleBitcodeWriterBase : public BitcodeWriterBase { for (const auto &GUIDSummaryLists : *Index) // Examine all summaries for this GUID. for (auto &Summary : GUIDSummaryLists.second.SummaryList) -if (auto FS = dyn_cast(Summary.get())) +if (auto FS = dyn_cast(Summary.get())) { // For each call in the function summary, see if the call // is to a GUID (which means it is for an indirect call, // otherwise we would have a Value for it). If so, synthesize // a value id. for (auto &CallEdge : FS->calls()) if (!CallEdge.first.haveGVs() || !CallEdge.first.getValue()) assignValueId(CallEdge.first.getGUID()); + + // For each referenced variables in the function summary, see if the + // variable is represented by a GUID (as opposed to a symbol to + // declarations or definitions in the module). If so, sythesize a minglotus-6 wrote: done. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/minglotus-6 updated https://github.com/llvm/llvm-project/pull/79381 >From d4caa0997799b712edb11d90c5be79d0aab3c312 Mon Sep 17 00:00:00 2001 From: mingmingl Date: Thu, 25 Jan 2024 13:59:03 -0800 Subject: [PATCH 1/3] Introduce an opton to control the number of vtables to annotate and use it when generating function summaries. Created using spr 1.3.4 --- .../IndirectCallPromotionAnalysis.cpp | 3 +++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 12 - .../thinlto-func-summary-vtableref-pgo.ll | 25 --- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp index ebfa1c8fc08e1c6..18cb6a220e3bd00 100644 --- a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp +++ b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp @@ -45,6 +45,9 @@ static cl::opt cl::desc("Max number of promotions for a single indirect " "call callsite")); +cl::opt MaxNumVTableAnnotations("icp-max-num-vtables", cl::init(6), cl::Hidden, + cl::desc("Max number of vtables annotated for a vtable load instruction.")); + ICallPromotionAnalysis::ICallPromotionAnalysis() { ValueDataArray = std::make_unique(MaxNumPromotions); } diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index fc8c31de0f4501f..0f0085025cc56b1 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -82,6 +82,8 @@ static cl::opt ModuleSummaryDotFile( extern cl::opt ScalePartialSampleProfileWorkingSetSize; +extern cl::opt MaxNumVTableAnnotations; + // Walk through the operands of a given User via worklist iteration and populate // the set of GlobalValue references encountered. Invoked either on an // Instruction or a GlobalVariable (which walks its initializer). @@ -129,14 +131,10 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, if (I) { uint32_t ActualNumValueData = 0; uint64_t TotalCount = 0; -// 24 is the maximum number of values preserved for one instrumented site, -// defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in -// compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as -// `MaxNumValueData` controls the max number of elements in the returned -// array. The actual number of values is gated by the number of ops in !prof -// metadata. +// MaxNumVTableAnnotations is the maximum number of vtables annotated on +// the instruction. auto ValueDataArray = getValueProfDataFromInst( -*I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData, +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, ActualNumValueData, TotalCount); if (ValueDataArray.get()) { diff --git a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll index 28e4b1d19aef72c..ba3ce9a75ee8321 100644 --- a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll +++ b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll @@ -1,4 +1,8 @@ -; RUN: opt -module-summary %s -o %t.o +; Promote at most one function and annotate at most one vtable. +; As a result, only one value (of each relevant kind) shows up in the function +; summary. + +; RUN: opt -module-summary -icp-max-num-vtables=1 -icp-max-prom=1 %s -o %t.o ; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s @@ -11,15 +15,17 @@ ; CHECK-NEXT: ; The `VALUE_GUID` below represents the "_ZTV4Base" referenced by the instruction ; that loads vtable pointers. -; CHECK-NEXT: +; CHECK-NEXT: ; The `VALUE_GUID` below represents the "_ZN4Base4funcEv" referenced by the ; indirect call instruction. -; CHECK-NEXT: +; CHECK-NEXT: +; NOTE vtables and functions from Derived class is dropped because +; `-icp-max-num-vtables` and `-icp-max-prom` are both set to one. ; has the format [valueid, flags, instcount, funcflags, ; numrefs, rorefcnt, worefcnt, ; m x valueid, ; n x (valueid, hotness+tailcall)] -; CHECK-NEXT: +; CHECK-NEXT: ; CHECK-NEXT: target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -36,7 +42,6 @@ define i32 @_Z4testP4Base(ptr %0) !prof !15 { !llvm.module.flags = !{!1} - !1 = !{i32 1, !"ProfileSummary", !2} !2 = !{!3, !4, !5, !6, !7, !8, !9, !10} !3 = !{!"ProfileFormat", !"InstrProf"} @@ -53,10 +58,12 @@ define i32 @_Z4testP4Base(ptr %0) !prof !15 { !14 = !{i32 99, i64 1, i32 2} !15 = !{!"function_entry_count", i32 150} -; 1960855528937986108 is the MD5 hash of _ZTV4Base -!16 = !{!"VP", i32 2, i64 1600, i64 1960855528937986108, i64 1600} -; 5459407273543877811 is the MD5 hash of _ZN4Base4funcEv -!17 = !{!"VP", i32 0, i64 1600, i64 5459407273543
[llvm-branch-commits] [llvm] Update compiler version expected that seems to be embedded in CHECK line of test at llvm/test/CodeGen/SystemZ/zos-ppa2.ll. (PR #79523)
https://github.com/tstellar edited https://github.com/llvm/llvm-project/pull/79523 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] Update compiler version expected that seems to be embedded in CHECK l⦠(PR #79523)
https://github.com/tstellar edited https://github.com/llvm/llvm-project/pull/79523 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] Update compiler version expected that seems to be embedded in CHECK l⦠(PR #79523)
https://github.com/tstellar created https://github.com/llvm/llvm-project/pull/79523 β¦ine of test at llvm/test/CodeGen/SystemZ/zos-ppa2.ll. The test contains a CHECK line which verifies an .ascii line which originally checks for 180019700101. After the bump of the compiler version to 19, the test started to fail with the string now being 190019700101. This should fix this failing test on bots. (cherry picked from commit a01195ff5cc3d7fd084743b1f47007645bb385f4) >From 4236d56141be3a421d9e7fe8bb7f1ba1663ec97a Mon Sep 17 00:00:00 2001 From: Douglas Yung Date: Tue, 23 Jan 2024 22:02:27 -0800 Subject: [PATCH] Update compiler version expected that seems to be embedded in CHECK line of test at llvm/test/CodeGen/SystemZ/zos-ppa2.ll. The test contains a CHECK line which verifies an .ascii line which originally checks for 180019700101. After the bump of the compiler version to 19, the test started to fail with the string now being 190019700101. This should fix this failing test on bots. (cherry picked from commit a01195ff5cc3d7fd084743b1f47007645bb385f4) --- llvm/test/CodeGen/SystemZ/zos-ppa2.ll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/test/CodeGen/SystemZ/zos-ppa2.ll b/llvm/test/CodeGen/SystemZ/zos-ppa2.ll index f54f654b804a23..2a686563388a47 100644 --- a/llvm/test/CodeGen/SystemZ/zos-ppa2.ll +++ b/llvm/test/CodeGen/SystemZ/zos-ppa2.ll @@ -24,7 +24,7 @@ ; CHECK:.byte 0 ; CHECK:.byte 3 ; CHECK:.short 30 -; CHECK:.ascii "\323\323\345\324@@\361\370\360\360\361\371\367\360\360\361\360\361\360\360\360\360\360\360\360\360" +; CHECK:.ascii "\323\323\345\324@@\361\371\360\360\361\371\367\360\360\361\360\361\360\360\360\360\360\360\360\360" define void @void_test() { entry: ret void ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] [llvm] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -1285,46 +1285,44 @@ void annotateValueSite(Module &M, Instruction &Inst, Inst.setMetadata(LLVMContext::MD_prof, MDNode::get(Ctx, Vals)); } -bool getValueProfDataFromInst(const Instruction &Inst, - InstrProfValueKind ValueKind, - uint32_t MaxNumValueData, - InstrProfValueData ValueData[], - uint32_t &ActualNumValueData, uint64_t &TotalC, - bool GetNoICPValue) { +MDNode *mayHaveValueProfileOfKind(const Instruction &Inst, + InstrProfValueKind ValueKind) { MDNode *MD = Inst.getMetadata(LLVMContext::MD_prof); if (!MD) -return false; +return nullptr; - unsigned NOps = MD->getNumOperands(); + if (MD->getNumOperands() < 5) +return nullptr; - if (NOps < 5) -return false; - - // Operand 0 is a string tag "VP": MDString *Tag = cast(MD->getOperand(0)); - if (!Tag) -return false; - - if (!Tag->getString().equals("VP")) -return false; + if (!Tag || !Tag->getString().equals("VP")) +return nullptr; // Now check kind: ConstantInt *KindInt = mdconst::dyn_extract(MD->getOperand(1)); if (!KindInt) -return false; +return nullptr; if (KindInt->getZExtValue() != ValueKind) -return false; +return nullptr; + + return MD; +} +static bool getValueProfDataFromInst(const MDNode *const MD, modiking wrote: Also, existing callers of the `bool` version no longer get the checking from `mayHaveValueProfileOfKind` which seems to be an unintended change of functionality https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] [llvm] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -1285,46 +1285,44 @@ void annotateValueSite(Module &M, Instruction &Inst, Inst.setMetadata(LLVMContext::MD_prof, MDNode::get(Ctx, Vals)); } -bool getValueProfDataFromInst(const Instruction &Inst, - InstrProfValueKind ValueKind, - uint32_t MaxNumValueData, - InstrProfValueData ValueData[], - uint32_t &ActualNumValueData, uint64_t &TotalC, - bool GetNoICPValue) { +MDNode *mayHaveValueProfileOfKind(const Instruction &Inst, + InstrProfValueKind ValueKind) { MDNode *MD = Inst.getMetadata(LLVMContext::MD_prof); if (!MD) -return false; +return nullptr; - unsigned NOps = MD->getNumOperands(); + if (MD->getNumOperands() < 5) +return nullptr; - if (NOps < 5) -return false; - - // Operand 0 is a string tag "VP": MDString *Tag = cast(MD->getOperand(0)); - if (!Tag) -return false; - - if (!Tag->getString().equals("VP")) -return false; + if (!Tag || !Tag->getString().equals("VP")) +return nullptr; // Now check kind: ConstantInt *KindInt = mdconst::dyn_extract(MD->getOperand(1)); if (!KindInt) -return false; +return nullptr; if (KindInt->getZExtValue() != ValueKind) -return false; +return nullptr; + + return MD; +} +static bool getValueProfDataFromInst(const MDNode *const MD, modiking wrote: Is there a plan to consolidate this function so that it's no longer a stub for existing callsites? AFAICT the `std::unique_ptr` version is functionally identical https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/modiking deleted https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -1285,46 +1285,44 @@ void annotateValueSite(Module &M, Instruction &Inst, Inst.setMetadata(LLVMContext::MD_prof, MDNode::get(Ctx, Vals)); } -bool getValueProfDataFromInst(const Instruction &Inst, - InstrProfValueKind ValueKind, - uint32_t MaxNumValueData, - InstrProfValueData ValueData[], - uint32_t &ActualNumValueData, uint64_t &TotalC, - bool GetNoICPValue) { +MDNode *mayHaveValueProfileOfKind(const Instruction &Inst, + InstrProfValueKind ValueKind) { MDNode *MD = Inst.getMetadata(LLVMContext::MD_prof); if (!MD) -return false; +return nullptr; - unsigned NOps = MD->getNumOperands(); + if (MD->getNumOperands() < 5) +return nullptr; - if (NOps < 5) -return false; - - // Operand 0 is a string tag "VP": MDString *Tag = cast(MD->getOperand(0)); - if (!Tag) -return false; - - if (!Tag->getString().equals("VP")) -return false; + if (!Tag || !Tag->getString().equals("VP")) +return nullptr; // Now check kind: ConstantInt *KindInt = mdconst::dyn_extract(MD->getOperand(1)); if (!KindInt) -return false; +return nullptr; if (KindInt->getZExtValue() != ValueKind) -return false; +return nullptr; + + return MD; +} +static bool getValueProfDataFromInst(const MDNode *const MD, + const uint32_t MaxNumDataWant, + InstrProfValueData ValueData[], + uint32_t &ActualNumValueData, + uint64_t &TotalC, bool GetNoICPValue) { + const unsigned NOps = MD->getNumOperands(); modiking wrote: This function should call `mayHaveValueProfileOfKind` so that it remains functionally identical from before this change right? https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] [llvm] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -199,14 +199,23 @@ class ModuleBitcodeWriterBase : public BitcodeWriterBase { for (const auto &GUIDSummaryLists : *Index) // Examine all summaries for this GUID. for (auto &Summary : GUIDSummaryLists.second.SummaryList) -if (auto FS = dyn_cast(Summary.get())) +if (auto FS = dyn_cast(Summary.get())) { // For each call in the function summary, see if the call // is to a GUID (which means it is for an indirect call, // otherwise we would have a Value for it). If so, synthesize // a value id. for (auto &CallEdge : FS->calls()) if (!CallEdge.first.haveGVs() || !CallEdge.first.getValue()) assignValueId(CallEdge.first.getGUID()); + + // For each referenced variables in the function summary, see if the + // variable is represented by a GUID (as opposed to a symbol to + // declarations or definitions in the module). If so, sythesize a modiking wrote: ```suggestion // declarations or definitions in the module). If so, synthesize a ``` https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] PR for llvm/llvm-project#79511 (PR #79513)
https://github.com/teresajohnson approved this pull request. sure seems fine https://github.com/llvm/llvm-project/pull/79513 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [openmp] [libc] [lldb] [clang-tools-extra] [flang] [mlir] [libcxx] [llvm] [BOLT] Write and parse BF/BB hashes in BAT (PR #76907)
@@ -36,9 +37,12 @@ void BoltAddressTranslation::writeEntriesForBB(MapTy &Map, if (BBInputOffset == BinaryBasicBlock::INVALID_OFFSET) return; - LLVM_DEBUG(dbgs() << "BB " << BB.getName() << "\n"); - LLVM_DEBUG(dbgs() << " Key: " << Twine::utohexstr(BBOutputOffset) -<< " Val: " << Twine::utohexstr(BBInputOffset) << "\n"); + LLVM_DEBUG(dbgs() << "BB " << BB.getName() << "\n" rafaelauler wrote: So you're not using the basic block hash anywhere, other than printing it to debug output? https://github.com/llvm/llvm-project/pull/76907 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [openmp] [flang] [clang] [mlir] [lldb] [libcxx] [clang-tools-extra] [libc] [BOLT][NFC] Pass BF/BB hashes to BAT (PR #76906)
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76906 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79507 (PR #79509)
llvmbot wrote: @llvm/pr-subscribers-lld-elf Author: None (github-actions[bot]) Changes resolves llvm/llvm-project#79507 --- Patch is 32.20 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/79509.diff 5 Files Affected: - (modified) lld/ELF/Arch/RISCV.cpp (+164-35) - (modified) lld/ELF/Relocations.cpp (+30-20) - (added) lld/test/ELF/riscv-tlsdesc-gd-mixed.s (+26) - (added) lld/test/ELF/riscv-tlsdesc-relax.s (+189) - (added) lld/test/ELF/riscv-tlsdesc.s (+194) ``diff diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index d7d3d3e47814971..8ce92b4badfbd7e 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -61,6 +61,7 @@ enum Op { AUIPC = 0x17, JALR = 0x67, LD = 0x3003, + LUI = 0x37, LW = 0x2003, SRLI = 0x5013, SUB = 0x4033, @@ -73,6 +74,7 @@ enum Reg { X_T0 = 5, X_T1 = 6, X_T2 = 7, + X_A0 = 10, X_T3 = 28, }; @@ -102,6 +104,26 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) { (extractBits(imm, 4, 0) << 7); } +namespace { +struct SymbolAnchor { + uint64_t offset; + Defined *d; + bool end; // true for the anchor of st_value+st_size +}; +} // namespace + +struct elf::RISCVRelaxAux { + // This records symbol start and end offsets which will be adjusted according + // to the nearest relocDeltas element. + SmallVector anchors; + // For relocations[i], the actual offset is + // r_offset - (i ? relocDeltas[i-1] : 0). + std::unique_ptr relocDeltas; + // For relocations[i], the actual type is relocTypes[i]. + std::unique_ptr relocTypes; + SmallVector writes; +}; + RISCV::RISCV() { copyRel = R_RISCV_COPY; pltRel = R_RISCV_JUMP_SLOT; @@ -119,6 +141,7 @@ RISCV::RISCV() { tlsGotRel = R_RISCV_TLS_TPREL32; } gotRel = symbolicRel; + tlsDescRel = R_RISCV_TLSDESC; // .got[0] = _DYNAMIC gotHeaderEntriesNum = 1; @@ -187,6 +210,8 @@ int64_t RISCV::getImplicitAddend(const uint8_t *buf, RelType type) const { case R_RISCV_JUMP_SLOT: // These relocations are defined as not having an implicit addend. return 0; + case R_RISCV_TLSDESC: +return config->is64 ? read64le(buf + 8) : read32le(buf + 4); } } @@ -295,6 +320,12 @@ RelExpr RISCV::getRelExpr(const RelType type, const Symbol &s, case R_RISCV_PCREL_LO12_I: case R_RISCV_PCREL_LO12_S: return R_RISCV_PC_INDIRECT; + case R_RISCV_TLSDESC_HI20: + case R_RISCV_TLSDESC_LOAD_LO12: + case R_RISCV_TLSDESC_ADD_LO12: +return R_TLSDESC_PC; + case R_RISCV_TLSDESC_CALL: +return R_TLSDESC_CALL; case R_RISCV_TLS_GD_HI20: return R_TLSGD_PC; case R_RISCV_TLS_GOT_HI20: @@ -419,6 +450,7 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { case R_RISCV_GOT_HI20: case R_RISCV_PCREL_HI20: + case R_RISCV_TLSDESC_HI20: case R_RISCV_TLS_GD_HI20: case R_RISCV_TLS_GOT_HI20: case R_RISCV_TPREL_HI20: @@ -430,6 +462,8 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { } case R_RISCV_PCREL_LO12_I: + case R_RISCV_TLSDESC_LOAD_LO12: + case R_RISCV_TLSDESC_ADD_LO12: case R_RISCV_TPREL_LO12_I: case R_RISCV_LO12_I: { uint64_t hi = (val + 0x800) >> 12; @@ -513,32 +547,133 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { break; case R_RISCV_RELAX: -return; // Ignored (for now) - +return; + case R_RISCV_TLSDESC: +// The addend is stored in the second word. +if (config->is64) + write64le(loc + 8, val); +else + write32le(loc + 4, val); +break; default: llvm_unreachable("unknown relocation"); } } +static bool relaxable(ArrayRef relocs, size_t i) { + return i + 1 != relocs.size() && relocs[i + 1].type == R_RISCV_RELAX; +} + +static void tlsdescToIe(uint8_t *loc, const Relocation &rel, uint64_t val) { + switch (rel.type) { + case R_RISCV_TLSDESC_HI20: + case R_RISCV_TLSDESC_LOAD_LO12: +write32le(loc, 0x0013); // nop +break; + case R_RISCV_TLSDESC_ADD_LO12: +write32le(loc, utype(AUIPC, X_A0, hi20(val))); // auipc a0, +break; + case R_RISCV_TLSDESC_CALL: +if (config->is64) + write32le(loc, itype(LD, X_A0, X_A0, lo12(val))); // ld a0,(a0) +else + write32le(loc, itype(LW, X_A0, X_A0, lo12(val))); // lw a0,(a0) +break; + default: +llvm_unreachable("unsupported relocation for TLSDESC to IE"); + } +} + +static void tlsdescToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { + switch (rel.type) { + case R_RISCV_TLSDESC_HI20: + case R_RISCV_TLSDESC_LOAD_LO12: +write32le(loc, 0x0013); // nop +return; + case R_RISCV_TLSDESC_ADD_LO12: +if (isInt<12>(val)) + write32le(loc, 0x0013); // nop +else + write32le(loc, utype(LUI, X_A0, hi20(val))); // lui a0, +return; + case R_RISCV_TLSDESC_CALL: +if (isInt<12>(val)) + write32le(loc, itype(ADDI, X_A0, 0, val)); // addi a0,zero, +else +
[llvm-branch-commits] [clang] [libc] [llvm] [libcxx] [openmp] [lldb] [flang] [mlir] [clang-tools-extra] [BOLT] Deduplicate equal offsets in BAT (PR #76905)
https://github.com/rafaelauler approved this pull request. https://github.com/llvm/llvm-project/pull/76905 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79507 (PR #79509)
https://github.com/llvmbot updated https://github.com/llvm/llvm-project/pull/79509 >From d3af9ea65300ba99b8477163ded5a89046b7cdcb Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 25 Jan 2024 10:09:43 -0800 Subject: [PATCH 1/3] [ELF] Clean up R_RISCV_RELAX code. NFC (cherry picked from commit ccb99f221422b8de5e1ae04d3427f15878f7cd93) --- lld/ELF/Arch/RISCV.cpp | 65 ++ 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index d7d3d3e47814971..a92f7bf590c4b40 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -102,6 +102,26 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) { (extractBits(imm, 4, 0) << 7); } +namespace { +struct SymbolAnchor { + uint64_t offset; + Defined *d; + bool end; // true for the anchor of st_value+st_size +}; +} // namespace + +struct elf::RISCVRelaxAux { + // This records symbol start and end offsets which will be adjusted according + // to the nearest relocDeltas element. + SmallVector anchors; + // For relocations[i], the actual offset is + // r_offset - (i ? relocDeltas[i-1] : 0). + std::unique_ptr relocDeltas; + // For relocations[i], the actual type is relocTypes[i]. + std::unique_ptr relocTypes; + SmallVector writes; +}; + RISCV::RISCV() { copyRel = R_RISCV_COPY; pltRel = R_RISCV_JUMP_SLOT; @@ -520,14 +540,19 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { } } +static bool relaxable(ArrayRef relocs, size_t i) { + return i + 1 != relocs.size() && relocs[i + 1].type == R_RISCV_RELAX; +} + void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { uint64_t secAddr = sec.getOutputSection()->addr; if (auto *s = dyn_cast(&sec)) secAddr += s->outSecOff; else if (auto *ehIn = dyn_cast(&sec)) secAddr += ehIn->getParent()->outSecOff; - for (size_t i = 0, size = sec.relocs().size(); i != size; ++i) { -const Relocation &rel = sec.relocs()[i]; + const ArrayRef relocs = sec.relocs(); + for (size_t i = 0, size = relocs.size(); i != size; ++i) { +const Relocation &rel = relocs[i]; uint8_t *loc = buf + rel.offset; const uint64_t val = sec.getRelocTargetVA(sec.file, rel.type, rel.addend, @@ -538,7 +563,7 @@ void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { break; case R_RISCV_LEB128: if (i + 1 < size) { -const Relocation &rel1 = sec.relocs()[i + 1]; +const Relocation &rel1 = relocs[i + 1]; if (rel.type == R_RISCV_SET_ULEB128 && rel1.type == R_RISCV_SUB_ULEB128 && rel.offset == rel1.offset) { auto val = rel.sym->getVA(rel.addend) - rel1.sym->getVA(rel1.addend); @@ -560,26 +585,6 @@ void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { } } -namespace { -struct SymbolAnchor { - uint64_t offset; - Defined *d; - bool end; // true for the anchor of st_value+st_size -}; -} // namespace - -struct elf::RISCVRelaxAux { - // This records symbol start and end offsets which will be adjusted according - // to the nearest relocDeltas element. - SmallVector anchors; - // For relocations[i], the actual offset is r_offset - (i ? relocDeltas[i-1] : - // 0). - std::unique_ptr relocDeltas; - // For relocations[i], the actual type is relocTypes[i]. - std::unique_ptr relocTypes; - SmallVector writes; -}; - static void initSymbolAnchors() { SmallVector storage; for (OutputSection *osec : outputSections) { @@ -715,14 +720,15 @@ static void relaxHi20Lo12(const InputSection &sec, size_t i, uint64_t loc, static bool relax(InputSection &sec) { const uint64_t secAddr = sec.getVA(); + const MutableArrayRef relocs = sec.relocs(); auto &aux = *sec.relaxAux; bool changed = false; ArrayRef sa = ArrayRef(aux.anchors); uint64_t delta = 0; - std::fill_n(aux.relocTypes.get(), sec.relocs().size(), R_RISCV_NONE); + std::fill_n(aux.relocTypes.get(), relocs.size(), R_RISCV_NONE); aux.writes.clear(); - for (auto [i, r] : llvm::enumerate(sec.relocs())) { + for (auto [i, r] : llvm::enumerate(relocs)) { const uint64_t loc = secAddr + r.offset - delta; uint32_t &cur = aux.relocDeltas[i], remove = 0; switch (r.type) { @@ -743,23 +749,20 @@ static bool relax(InputSection &sec) { } case R_RISCV_CALL: case R_RISCV_CALL_PLT: - if (i + 1 != sec.relocs().size() && - sec.relocs()[i + 1].type == R_RISCV_RELAX) + if (relaxable(relocs, i)) relaxCall(sec, i, loc, r, remove); break; case R_RISCV_TPREL_HI20: case R_RISCV_TPREL_ADD: case R_RISCV_TPREL_LO12_I: case R_RISCV_TPREL_LO12_S: - if (i + 1 != sec.relocs().size() && - sec.relocs()[i + 1].type == R_RISCV_RELAX) + if (relaxable(relocs, i)) relaxTlsLe(sec, i, loc, r, remove); break; case R_RISCV_HI20: case R_RISCV_LO12_I: case R_RISCV_LO12_
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/teresajohnson approved this pull request. lgtm with 2 minor comment nits https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/teresajohnson edited https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -129,15 +131,11 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, if (I) { uint32_t ActualNumValueData = 0; uint64_t TotalCount = 0; -// 24 is the maximum number of values preserved for one instrumented site, -// defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in -// compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as -// `MaxNumValueData` controls the max number of elements in the returned -// array. The actual number of values is gated by the number of ops in !prof -// metadata. +// MaxNumVTableAnnotations is the maximum number of vtables annotated on +// the instruction. auto ValueDataArray = getValueProfDataFromInst( -*I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData, -TotalCount); +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, teresajohnson wrote: I think you can remove the "/* MaxNumValueData */" now that this is not a constant. Or if you want to keep it use the format shown in my other comment. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -124,6 +126,24 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, Worklist.push_back(Operand); } } + + const Instruction *I = dyn_cast(CurUser); + if (I) { +uint32_t ActualNumValueData = 0; +uint64_t TotalCount = 0; +// MaxNumVTableAnnotations is the maximum number of vtables annotated on +// the instruction. +auto ValueDataArray = getValueProfDataFromInst( +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, +ActualNumValueData, TotalCount); + +if (ValueDataArray.get()) { + for (uint32_t j = 0; j < ActualNumValueData; j++) { +RefEdges.insert(Index.getOrInsertValueInfo( +ValueDataArray[j].Value /* VTableGUID */)); teresajohnson wrote: Use format "/* VTableGUID = */ ValueDataArray[j].Value" for consistency with other code. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] PR for llvm/llvm-project#79511 (PR #79513)
github-actions[bot] wrote: @teresajohnson What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/79513 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] PR for llvm/llvm-project#79511 (PR #79513)
https://github.com/github-actions[bot] milestoned https://github.com/llvm/llvm-project/pull/79513 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] PR for llvm/llvm-project#79511 (PR #79513)
https://github.com/github-actions[bot] created https://github.com/llvm/llvm-project/pull/79513 resolves llvm/llvm-project#79511 >From 0659957392a3d98b973c9e8b59af350f9bafb5ff Mon Sep 17 00:00:00 2001 From: Sean Fertile <35576261+mandle...@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:50:59 -0500 Subject: [PATCH] [LTO] Fix fat-lto output for -c -emit-llvm. (#79404) Fix and add a test case for combining '-ffat-lto-objects -c -emit-llvm' options and fix a spelling mistake in same test. (cherry picked from commit f1b1611148fa533fe198fec3fa4ef8139224dc80) --- clang/lib/Driver/Driver.cpp | 6 +++--- clang/test/Driver/fat-lto-objects.c | 12 +--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 7109faa1072de5..93cddf742d521d 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -4764,9 +4764,9 @@ Action *Driver::ConstructPhaseAction( case phases::Backend: { if (isUsingLTO() && TargetDeviceOffloadKind == Action::OFK_None) { types::ID Output; - if (Args.hasArg(options::OPT_ffat_lto_objects)) -Output = Args.hasArg(options::OPT_emit_llvm) ? types::TY_LTO_IR - : types::TY_PP_Asm; + if (Args.hasArg(options::OPT_ffat_lto_objects) && + !Args.hasArg(options::OPT_emit_llvm)) +Output = types::TY_PP_Asm; else if (Args.hasArg(options::OPT_S)) Output = types::TY_LTO_IR; else diff --git a/clang/test/Driver/fat-lto-objects.c b/clang/test/Driver/fat-lto-objects.c index 97002db6edc51e..d9a5ba88ea6d6f 100644 --- a/clang/test/Driver/fat-lto-objects.c +++ b/clang/test/Driver/fat-lto-objects.c @@ -23,11 +23,17 @@ // CHECK-CC-S-EL-LTO-SAME: -emit-llvm // CHECK-CC-S-EL-LTO-SAME: -ffat-lto-objects -/// When fat LTO is enabled wihtout -S we expect native object output and -ffat-lto-object to be passed to cc1. +/// When fat LTO is enabled without -S we expect native object output and -ffat-lto-object to be passed to cc1. // RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-C-LTO // CHECK-CC-C-LTO: -cc1 -// CHECK-CC-C-LTO: -emit-obj -// CHECK-CC-C-LTO: -ffat-lto-objects +// CHECK-CC-C-LTO-SAME: -emit-obj +// CHECK-CC-C-LTO-SAME: -ffat-lto-objects + +/// When fat LTO is enabled with -c and -emit-llvm we expect bitcode output and -ffat-lto-object to be passed to cc1. +// RUN: %clang --target=x86_64-unknown-linux-gnu -flto -ffat-lto-objects -### %s -c -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-CC-C-EL-LTO +// CHECK-CC-C-EL-LTO: -cc1 +// CHECK-CC-C-EL-LTO-SAME: -emit-llvm-bc +// CHECK-CC-C-EL-LTO-SAME: -ffat-lto-objects /// Make sure we don't have a warning for -ffat-lto-objects being unused // RUN: %clang --target=x86_64-unknown-linux-gnu -ffat-lto-objects -fdriver-only -Werror -v %s -c 2>&1 | FileCheck %s -check-prefix=CHECK-CC-NOLTO ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/minglotus-6 edited https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/minglotus-6 updated https://github.com/llvm/llvm-project/pull/79381 >From d4caa0997799b712edb11d90c5be79d0aab3c312 Mon Sep 17 00:00:00 2001 From: mingmingl Date: Thu, 25 Jan 2024 13:59:03 -0800 Subject: [PATCH 1/2] Introduce an opton to control the number of vtables to annotate and use it when generating function summaries. Created using spr 1.3.4 --- .../IndirectCallPromotionAnalysis.cpp | 3 +++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 12 - .../thinlto-func-summary-vtableref-pgo.ll | 25 --- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp index ebfa1c8fc08e1c6..18cb6a220e3bd00 100644 --- a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp +++ b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp @@ -45,6 +45,9 @@ static cl::opt cl::desc("Max number of promotions for a single indirect " "call callsite")); +cl::opt MaxNumVTableAnnotations("icp-max-num-vtables", cl::init(6), cl::Hidden, + cl::desc("Max number of vtables annotated for a vtable load instruction.")); + ICallPromotionAnalysis::ICallPromotionAnalysis() { ValueDataArray = std::make_unique(MaxNumPromotions); } diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index fc8c31de0f4501f..0f0085025cc56b1 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -82,6 +82,8 @@ static cl::opt ModuleSummaryDotFile( extern cl::opt ScalePartialSampleProfileWorkingSetSize; +extern cl::opt MaxNumVTableAnnotations; + // Walk through the operands of a given User via worklist iteration and populate // the set of GlobalValue references encountered. Invoked either on an // Instruction or a GlobalVariable (which walks its initializer). @@ -129,14 +131,10 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, if (I) { uint32_t ActualNumValueData = 0; uint64_t TotalCount = 0; -// 24 is the maximum number of values preserved for one instrumented site, -// defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in -// compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as -// `MaxNumValueData` controls the max number of elements in the returned -// array. The actual number of values is gated by the number of ops in !prof -// metadata. +// MaxNumVTableAnnotations is the maximum number of vtables annotated on +// the instruction. auto ValueDataArray = getValueProfDataFromInst( -*I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData, +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, ActualNumValueData, TotalCount); if (ValueDataArray.get()) { diff --git a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll index 28e4b1d19aef72c..ba3ce9a75ee8321 100644 --- a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll +++ b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll @@ -1,4 +1,8 @@ -; RUN: opt -module-summary %s -o %t.o +; Promote at most one function and annotate at most one vtable. +; As a result, only one value (of each relevant kind) shows up in the function +; summary. + +; RUN: opt -module-summary -icp-max-num-vtables=1 -icp-max-prom=1 %s -o %t.o ; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s @@ -11,15 +15,17 @@ ; CHECK-NEXT: ; The `VALUE_GUID` below represents the "_ZTV4Base" referenced by the instruction ; that loads vtable pointers. -; CHECK-NEXT: +; CHECK-NEXT: ; The `VALUE_GUID` below represents the "_ZN4Base4funcEv" referenced by the ; indirect call instruction. -; CHECK-NEXT: +; CHECK-NEXT: +; NOTE vtables and functions from Derived class is dropped because +; `-icp-max-num-vtables` and `-icp-max-prom` are both set to one. ; has the format [valueid, flags, instcount, funcflags, ; numrefs, rorefcnt, worefcnt, ; m x valueid, ; n x (valueid, hotness+tailcall)] -; CHECK-NEXT: +; CHECK-NEXT: ; CHECK-NEXT: target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -36,7 +42,6 @@ define i32 @_Z4testP4Base(ptr %0) !prof !15 { !llvm.module.flags = !{!1} - !1 = !{i32 1, !"ProfileSummary", !2} !2 = !{!3, !4, !5, !6, !7, !8, !9, !10} !3 = !{!"ProfileFormat", !"InstrProf"} @@ -53,10 +58,12 @@ define i32 @_Z4testP4Base(ptr %0) !prof !15 { !14 = !{i32 99, i64 1, i32 2} !15 = !{!"function_entry_count", i32 150} -; 1960855528937986108 is the MD5 hash of _ZTV4Base -!16 = !{!"VP", i32 2, i64 1600, i64 1960855528937986108, i64 1600} -; 5459407273543877811 is the MD5 hash of _ZN4Base4funcEv -!17 = !{!"VP", i32 0, i64 1600, i64 5459407273543
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff eebf439d98faf7aa31738ad01468fd91b79bc8c0 d4caa0997799b712edb11d90c5be79d0aab3c312 -- llvm/include/llvm/ProfileData/InstrProf.h llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp llvm/lib/Analysis/ModuleSummaryAnalysis.cpp llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/ProfileData/InstrProf.cpp `` View the diff from clang-format here. ``diff diff --git a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp index 18cb6a220e..ab53717eb8 100644 --- a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp +++ b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp @@ -45,8 +45,9 @@ static cl::opt cl::desc("Max number of promotions for a single indirect " "call callsite")); -cl::opt MaxNumVTableAnnotations("icp-max-num-vtables", cl::init(6), cl::Hidden, - cl::desc("Max number of vtables annotated for a vtable load instruction.")); +cl::opt MaxNumVTableAnnotations( +"icp-max-num-vtables", cl::init(6), cl::Hidden, +cl::desc("Max number of vtables annotated for a vtable load instruction.")); ICallPromotionAnalysis::ICallPromotionAnalysis() { ValueDataArray = std::make_unique(MaxNumPromotions); diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 0f0085025c..24f0569db9 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -134,8 +134,8 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, // MaxNumVTableAnnotations is the maximum number of vtables annotated on // the instruction. auto ValueDataArray = getValueProfDataFromInst( -*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, ActualNumValueData, -TotalCount); +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, +ActualNumValueData, TotalCount); if (ValueDataArray.get()) { for (uint32_t j = 0; j < ActualNumValueData; j++) { `` https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/minglotus-6 edited https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/minglotus-6 edited https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO] (PR #79381)
https://github.com/minglotus-6 updated https://github.com/llvm/llvm-project/pull/79381 >From d4caa0997799b712edb11d90c5be79d0aab3c312 Mon Sep 17 00:00:00 2001 From: mingmingl Date: Thu, 25 Jan 2024 13:59:03 -0800 Subject: [PATCH] Introduce an opton to control the number of vtables to annotate and use it when generating function summaries. Created using spr 1.3.4 --- .../IndirectCallPromotionAnalysis.cpp | 3 +++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 12 - .../thinlto-func-summary-vtableref-pgo.ll | 25 --- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp index ebfa1c8fc08e1c6..18cb6a220e3bd00 100644 --- a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp +++ b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp @@ -45,6 +45,9 @@ static cl::opt cl::desc("Max number of promotions for a single indirect " "call callsite")); +cl::opt MaxNumVTableAnnotations("icp-max-num-vtables", cl::init(6), cl::Hidden, + cl::desc("Max number of vtables annotated for a vtable load instruction.")); + ICallPromotionAnalysis::ICallPromotionAnalysis() { ValueDataArray = std::make_unique(MaxNumPromotions); } diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index fc8c31de0f4501f..0f0085025cc56b1 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -82,6 +82,8 @@ static cl::opt ModuleSummaryDotFile( extern cl::opt ScalePartialSampleProfileWorkingSetSize; +extern cl::opt MaxNumVTableAnnotations; + // Walk through the operands of a given User via worklist iteration and populate // the set of GlobalValue references encountered. Invoked either on an // Instruction or a GlobalVariable (which walks its initializer). @@ -129,14 +131,10 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, if (I) { uint32_t ActualNumValueData = 0; uint64_t TotalCount = 0; -// 24 is the maximum number of values preserved for one instrumented site, -// defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in -// compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as -// `MaxNumValueData` controls the max number of elements in the returned -// array. The actual number of values is gated by the number of ops in !prof -// metadata. +// MaxNumVTableAnnotations is the maximum number of vtables annotated on +// the instruction. auto ValueDataArray = getValueProfDataFromInst( -*I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData, +*I, IPVK_VTableTarget, MaxNumVTableAnnotations /* MaxNumValueData */, ActualNumValueData, TotalCount); if (ValueDataArray.get()) { diff --git a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll index 28e4b1d19aef72c..ba3ce9a75ee8321 100644 --- a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll +++ b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll @@ -1,4 +1,8 @@ -; RUN: opt -module-summary %s -o %t.o +; Promote at most one function and annotate at most one vtable. +; As a result, only one value (of each relevant kind) shows up in the function +; summary. + +; RUN: opt -module-summary -icp-max-num-vtables=1 -icp-max-prom=1 %s -o %t.o ; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s @@ -11,15 +15,17 @@ ; CHECK-NEXT: ; The `VALUE_GUID` below represents the "_ZTV4Base" referenced by the instruction ; that loads vtable pointers. -; CHECK-NEXT: +; CHECK-NEXT: ; The `VALUE_GUID` below represents the "_ZN4Base4funcEv" referenced by the ; indirect call instruction. -; CHECK-NEXT: +; CHECK-NEXT: +; NOTE vtables and functions from Derived class is dropped because +; `-icp-max-num-vtables` and `-icp-max-prom` are both set to one. ; has the format [valueid, flags, instcount, funcflags, ; numrefs, rorefcnt, worefcnt, ; m x valueid, ; n x (valueid, hotness+tailcall)] -; CHECK-NEXT: +; CHECK-NEXT: ; CHECK-NEXT: target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -36,7 +42,6 @@ define i32 @_Z4testP4Base(ptr %0) !prof !15 { !llvm.module.flags = !{!1} - !1 = !{i32 1, !"ProfileSummary", !2} !2 = !{!3, !4, !5, !6, !7, !8, !9, !10} !3 = !{!"ProfileFormat", !"InstrProf"} @@ -53,10 +58,12 @@ define i32 @_Z4testP4Base(ptr %0) !prof !15 { !14 = !{i32 99, i64 1, i32 2} !15 = !{!"function_entry_count", i32 150} -; 1960855528937986108 is the MD5 hash of _ZTV4Base -!16 = !{!"VP", i32 2, i64 1600, i64 1960855528937986108, i64 1600} -; 5459407273543877811 is the MD5 hash of _ZN4Base4funcEv -!17 = !{!"VP", i32 0, i64 1600, i64 54594072735438778
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO] (PR #79381)
https://github.com/minglotus-6 edited https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO] (PR #79381)
https://github.com/minglotus-6 edited https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [π][ci] Fix the base branch we use to determine changes (#79503) (PR #79506)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/79506 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79507 (PR #79509)
https://github.com/github-actions[bot] milestoned https://github.com/llvm/llvm-project/pull/79509 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79507 (PR #79509)
https://github.com/github-actions[bot] created https://github.com/llvm/llvm-project/pull/79509 resolves llvm/llvm-project#79507 >From a1c2f9c65b7c532859054a84f7e29288a5eea4fa Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 25 Jan 2024 10:09:43 -0800 Subject: [PATCH 1/3] [ELF] Clean up R_RISCV_RELAX code. NFC (cherry picked from commit ccb99f221422b8de5e1ae04d3427f15878f7cd93) --- lld/ELF/Arch/RISCV.cpp | 65 ++ 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp index d7d3d3e4781497..a92f7bf590c4b4 100644 --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -102,6 +102,26 @@ static uint32_t setLO12_S(uint32_t insn, uint32_t imm) { (extractBits(imm, 4, 0) << 7); } +namespace { +struct SymbolAnchor { + uint64_t offset; + Defined *d; + bool end; // true for the anchor of st_value+st_size +}; +} // namespace + +struct elf::RISCVRelaxAux { + // This records symbol start and end offsets which will be adjusted according + // to the nearest relocDeltas element. + SmallVector anchors; + // For relocations[i], the actual offset is + // r_offset - (i ? relocDeltas[i-1] : 0). + std::unique_ptr relocDeltas; + // For relocations[i], the actual type is relocTypes[i]. + std::unique_ptr relocTypes; + SmallVector writes; +}; + RISCV::RISCV() { copyRel = R_RISCV_COPY; pltRel = R_RISCV_JUMP_SLOT; @@ -520,14 +540,19 @@ void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { } } +static bool relaxable(ArrayRef relocs, size_t i) { + return i + 1 != relocs.size() && relocs[i + 1].type == R_RISCV_RELAX; +} + void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { uint64_t secAddr = sec.getOutputSection()->addr; if (auto *s = dyn_cast(&sec)) secAddr += s->outSecOff; else if (auto *ehIn = dyn_cast(&sec)) secAddr += ehIn->getParent()->outSecOff; - for (size_t i = 0, size = sec.relocs().size(); i != size; ++i) { -const Relocation &rel = sec.relocs()[i]; + const ArrayRef relocs = sec.relocs(); + for (size_t i = 0, size = relocs.size(); i != size; ++i) { +const Relocation &rel = relocs[i]; uint8_t *loc = buf + rel.offset; const uint64_t val = sec.getRelocTargetVA(sec.file, rel.type, rel.addend, @@ -538,7 +563,7 @@ void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { break; case R_RISCV_LEB128: if (i + 1 < size) { -const Relocation &rel1 = sec.relocs()[i + 1]; +const Relocation &rel1 = relocs[i + 1]; if (rel.type == R_RISCV_SET_ULEB128 && rel1.type == R_RISCV_SUB_ULEB128 && rel.offset == rel1.offset) { auto val = rel.sym->getVA(rel.addend) - rel1.sym->getVA(rel1.addend); @@ -560,26 +585,6 @@ void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { } } -namespace { -struct SymbolAnchor { - uint64_t offset; - Defined *d; - bool end; // true for the anchor of st_value+st_size -}; -} // namespace - -struct elf::RISCVRelaxAux { - // This records symbol start and end offsets which will be adjusted according - // to the nearest relocDeltas element. - SmallVector anchors; - // For relocations[i], the actual offset is r_offset - (i ? relocDeltas[i-1] : - // 0). - std::unique_ptr relocDeltas; - // For relocations[i], the actual type is relocTypes[i]. - std::unique_ptr relocTypes; - SmallVector writes; -}; - static void initSymbolAnchors() { SmallVector storage; for (OutputSection *osec : outputSections) { @@ -715,14 +720,15 @@ static void relaxHi20Lo12(const InputSection &sec, size_t i, uint64_t loc, static bool relax(InputSection &sec) { const uint64_t secAddr = sec.getVA(); + const MutableArrayRef relocs = sec.relocs(); auto &aux = *sec.relaxAux; bool changed = false; ArrayRef sa = ArrayRef(aux.anchors); uint64_t delta = 0; - std::fill_n(aux.relocTypes.get(), sec.relocs().size(), R_RISCV_NONE); + std::fill_n(aux.relocTypes.get(), relocs.size(), R_RISCV_NONE); aux.writes.clear(); - for (auto [i, r] : llvm::enumerate(sec.relocs())) { + for (auto [i, r] : llvm::enumerate(relocs)) { const uint64_t loc = secAddr + r.offset - delta; uint32_t &cur = aux.relocDeltas[i], remove = 0; switch (r.type) { @@ -743,23 +749,20 @@ static bool relax(InputSection &sec) { } case R_RISCV_CALL: case R_RISCV_CALL_PLT: - if (i + 1 != sec.relocs().size() && - sec.relocs()[i + 1].type == R_RISCV_RELAX) + if (relaxable(relocs, i)) relaxCall(sec, i, loc, r, remove); break; case R_RISCV_TPREL_HI20: case R_RISCV_TPREL_ADD: case R_RISCV_TPREL_LO12_I: case R_RISCV_TPREL_LO12_S: - if (i + 1 != sec.relocs().size() && - sec.relocs()[i + 1].type == R_RISCV_RELAX) + if (relaxable(relocs, i)) relaxTlsLe(sec, i, loc, r, remove); break; case R_RISCV_HI20:
[llvm-branch-commits] [llvm] [π][ci] Fix the base branch we use to determine changes (#79503) (PR #79506)
https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/79506 >From fce5c171b463d766cb25208634553a39b94498a6 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 25 Jan 2024 16:38:53 -0500 Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9F=8D=92][ci]=20Fix=20the=20base=20bra?= =?UTF-8?q?nch=20we=20use=20to=20determine=20changes=20(#79503)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should diff against the base branch, not always against `main`. This allows the BuildKite pre-commit CI to work properly when we target other branches, such as `release/18.x`. (cherry picked from commit 3b762891826192ded07286852d326f9c9060f52e) --- .ci/generate-buildkite-pipeline-premerge | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index f32eb7213b94027..009cb6933e8fa9d 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -22,19 +22,20 @@ set -o pipefail # Environment variables script works with: -# Fetch origin/main to have an up to date merge base for main...HEAD diff. -git fetch origin main:main +# Set by buildkite +: ${BUILDKITE_PULL_REQUEST_BASE_BRANCH:=} +: ${BUILDKITE_COMMIT:=} +: ${BUILDKITE_BRANCH:=} +# Fetch origin to have an up to date merge base for the diff. +git fetch origin # List of files affected by this commit -: ${MODIFIED_FILES:=$(git diff --name-only main...HEAD)} +: ${MODIFIED_FILES:=$(git diff --name-only ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)} # Filter rules for generic windows tests : ${WINDOWS_AGENTS:='{"queue": "windows"}'} # Filter rules for generic linux tests : ${LINUX_AGENTS:='{"queue": "linux"}'} # Service agents, for interacting with Phabricator. : ${SERVICE_AGENTS:='{"queue": "service"}'} -# Set by buildkite -: ${BUILDKITE_COMMIT:=} -: ${BUILDKITE_BRANCH:=} reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')" if [[ "${reviewID}" != "" ]]; then >From 02074f95e0aa098668071cd696f9e41d8f118550 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 25 Jan 2024 16:48:07 -0500 Subject: [PATCH 2/2] =?UTF-8?q?[=F0=9F=8D=92][ci]=20Diff=20against=20origi?= =?UTF-8?q?n/BASE-BRANCH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, when the base branch is not something that the CI runner has checked out, that reference to e.g. release/18.x is ambiguous. (cherry picked from commit 5aad7894812a53b69e989a61a567f5617df4a057) --- .ci/generate-buildkite-pipeline-premerge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 009cb6933e8fa9d..7b1b4b8dac8a209 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -29,7 +29,7 @@ set -o pipefail # Fetch origin to have an up to date merge base for the diff. git fetch origin # List of files affected by this commit -: ${MODIFIED_FILES:=$(git diff --name-only ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)} +: ${MODIFIED_FILES:=$(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)} # Filter rules for generic windows tests : ${WINDOWS_AGENTS:='{"queue": "windows"}'} # Filter rules for generic linux tests ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [π][ci] Fix the base branch we use to determine changes (#79503) (PR #79506)
https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/79506 >From fce5c171b463d766cb25208634553a39b94498a6 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 25 Jan 2024 16:38:53 -0500 Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9F=8D=92][ci]=20Fix=20the=20base=20bra?= =?UTF-8?q?nch=20we=20use=20to=20determine=20changes=20(#79503)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should diff against the base branch, not always against `main`. This allows the BuildKite pre-commit CI to work properly when we target other branches, such as `release/18.x`. (cherry picked from commit 3b762891826192ded07286852d326f9c9060f52e) --- .ci/generate-buildkite-pipeline-premerge | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index f32eb7213b9402..009cb6933e8fa9 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -22,19 +22,20 @@ set -o pipefail # Environment variables script works with: -# Fetch origin/main to have an up to date merge base for main...HEAD diff. -git fetch origin main:main +# Set by buildkite +: ${BUILDKITE_PULL_REQUEST_BASE_BRANCH:=} +: ${BUILDKITE_COMMIT:=} +: ${BUILDKITE_BRANCH:=} +# Fetch origin to have an up to date merge base for the diff. +git fetch origin # List of files affected by this commit -: ${MODIFIED_FILES:=$(git diff --name-only main...HEAD)} +: ${MODIFIED_FILES:=$(git diff --name-only ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)} # Filter rules for generic windows tests : ${WINDOWS_AGENTS:='{"queue": "windows"}'} # Filter rules for generic linux tests : ${LINUX_AGENTS:='{"queue": "linux"}'} # Service agents, for interacting with Phabricator. : ${SERVICE_AGENTS:='{"queue": "service"}'} -# Set by buildkite -: ${BUILDKITE_COMMIT:=} -: ${BUILDKITE_BRANCH:=} reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')" if [[ "${reviewID}" != "" ]]; then >From 90b0b59ba4aaca1e6e51f5a519075194935c6b61 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 25 Jan 2024 16:46:34 -0500 Subject: [PATCH 2/2] Try mentioning origin/ directly --- .ci/generate-buildkite-pipeline-premerge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index 009cb6933e8fa9..7b1b4b8dac8a20 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -29,7 +29,7 @@ set -o pipefail # Fetch origin to have an up to date merge base for the diff. git fetch origin # List of files affected by this commit -: ${MODIFIED_FILES:=$(git diff --name-only ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)} +: ${MODIFIED_FILES:=$(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)} # Filter rules for generic windows tests : ${WINDOWS_AGENTS:='{"queue": "windows"}'} # Filter rules for generic linux tests ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [π][ci] Fix the base branch we use to determine changes (#79503) (PR #79506)
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/79506 We should diff against the base branch, not always against `main`. This allows the BuildKite pre-commit CI to work properly when we target other branches, such as `release/18.x`. (cherry picked from commit 3b762891826192ded07286852d326f9c9060f52e) >From fce5c171b463d766cb25208634553a39b94498a6 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 25 Jan 2024 16:38:53 -0500 Subject: [PATCH] =?UTF-8?q?[=F0=9F=8D=92][ci]=20Fix=20the=20base=20branch?= =?UTF-8?q?=20we=20use=20to=20determine=20changes=20(#79503)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should diff against the base branch, not always against `main`. This allows the BuildKite pre-commit CI to work properly when we target other branches, such as `release/18.x`. (cherry picked from commit 3b762891826192ded07286852d326f9c9060f52e) --- .ci/generate-buildkite-pipeline-premerge | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index f32eb7213b9402..009cb6933e8fa9 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -22,19 +22,20 @@ set -o pipefail # Environment variables script works with: -# Fetch origin/main to have an up to date merge base for main...HEAD diff. -git fetch origin main:main +# Set by buildkite +: ${BUILDKITE_PULL_REQUEST_BASE_BRANCH:=} +: ${BUILDKITE_COMMIT:=} +: ${BUILDKITE_BRANCH:=} +# Fetch origin to have an up to date merge base for the diff. +git fetch origin # List of files affected by this commit -: ${MODIFIED_FILES:=$(git diff --name-only main...HEAD)} +: ${MODIFIED_FILES:=$(git diff --name-only ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD)} # Filter rules for generic windows tests : ${WINDOWS_AGENTS:='{"queue": "windows"}'} # Filter rules for generic linux tests : ${LINUX_AGENTS:='{"queue": "linux"}'} # Service agents, for interacting with Phabricator. : ${SERVICE_AGENTS:='{"queue": "service"}'} -# Set by buildkite -: ${BUILDKITE_COMMIT:=} -: ${BUILDKITE_BRANCH:=} reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')" if [[ "${reviewID}" != "" ]]; then ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79253 (PR #79323)
llvmbot wrote: @llvm/pr-subscribers-debuginfo Author: None (github-actions[bot]) Changes resolves llvm/llvm-project#79253 --- Full diff: https://github.com/llvm/llvm-project/pull/79323.diff 1 Files Affected: - (modified) llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll (+23-14) ``diff diff --git a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll index e03b4c1d34de157..07443a62b93391b 100644 --- a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll +++ b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll @@ -1,19 +1,22 @@ ; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=-relax %s -o %t.o ; RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-NORL %s -; RUN: llvm-objdump --source %t.o | FileCheck --check-prefix=SOURCE %s -; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefix=DWARF %s +; RUN: llvm-objdump --source %t.o | FileCheck --check-prefixes=SOURCE,SOURCE-NORL %s +; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefixes=DWARF,DWARF-NORL %s ; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=+relax %s -o %t.r.o ; RUN: llvm-readobj -r %t.r.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-ENRL %s -; RUN: llvm-objdump --source %t.r.o | FileCheck --check-prefix=SOURCE %s -; RUN: llvm-dwarfdump --debug-info --debug-line %t.r.o | FileCheck --check-prefix=DWARF %s +; RUN: llvm-objdump --source %t.r.o | FileCheck --check-prefixes=SOURCE,SOURCE-ENRL %s +; RUN: llvm-dwarfdump --debug-info --debug-line %t.r.o | FileCheck --check-prefixes=DWARF,DWARF-ENRL %s ; RELOCS-BOTH: Relocations [ ; RELOCS-BOTH-NEXT:Section ({{.*}}) .rela.text { -; RELOCS-BOTH-NEXT: 0x14 R_LARCH_PCALA_HI20 sym 0x0 -; RELOCS-ENRL-NEXT: 0x14 R_LARCH_RELAX - 0x0 -; RELOCS-BOTH-NEXT: 0x18 R_LARCH_PCALA_LO12 sym 0x0 -; RELOCS-ENRL-NEXT: 0x18 R_LARCH_RELAX - 0x0 +; RELOCS-NORL-NEXT: 0x14 R_LARCH_PCALA_HI20 sym 0x0 +; RELOCS-NORL-NEXT: 0x18 R_LARCH_PCALA_LO12 sym 0x0 +; RELOCS-ENRL-NEXT: 0x0 R_LARCH_ALIGN .Lla-relax-align0 0x5 +; RELOCS-ENRL-NEXT: 0x30 R_LARCH_PCALA_HI20 sym 0x0 +; RELOCS-ENRL-NEXT: 0x30 R_LARCH_RELAX - 0x0 +; RELOCS-ENRL-NEXT: 0x34 R_LARCH_PCALA_LO12 sym 0x0 +; RELOCS-ENRL-NEXT: 0x34 R_LARCH_RELAX - 0x0 ; RELOCS-BOTH-NEXT:} ; RELOCS-BOTH: Section ({{.*}}) .rela.debug_frame { ; RELOCS-NORL-NEXT: 0x1C R_LARCH_32 .debug_frame 0x0 @@ -36,7 +39,8 @@ ; RELOCS-BOTH-NEXT:} ; RELOCS-BOTH-NEXT: ] -; SOURCE: : +; SOURCE-NORL: : +; SOURCE-ENRL: 001c : ; SOURCE: ; { ; SOURCE: ; asm volatile( ; SOURCE: ; return 0; @@ -87,11 +91,16 @@ ; DWARF-EMPTY: ; DWARF-NEXT: AddressLine Column File ISA Discriminator OpIndex Flags ; DWARF-NEXT: -- -- -- -- --- - --- - -; DWARF-NEXT: 0x 2 0 0 0 0 0 is_stmt -; DWARF-NEXT: 0x0010 3 3 0 0 0 0 is_stmt prologue_end -; DWARF-NEXT: 0x0020 10 3 0 0 0 0 is_stmt -; DWARF-NEXT: 0x002c 10 3 0 0 0 0 epilogue_begin -; DWARF-NEXT: 0x0034 10 3 0 0 0 0 end_sequence +; DWARF-NORL-NEXT: 0x 2 0 0 0 0 0 is_stmt +; DWARF-NORL-NEXT: 0x0010 3 3 0 0 0 0 is_stmt prologue_end +; DWARF-NORL-NEXT: 0x0020 10 3 0 0 0 0 is_stmt +; DWARF-NORL-NEXT: 0x002c 10 3 0 0 0 0 epilogue_begin +; DWARF-NORL-NEXT: 0x0034 10 3 0 0 0 0 end_sequence +; DWARF-ENRL-NEXT: 0x001c 2 0 0 0 0 0 is_stmt +; DWARF-ENRL-NEXT: 0x002c 3 3 0 0 0 0 is_stmt prologue_end +; DWARF-ENRL-NEXT: 0x003c 10 3 0 0 0 0 is_stmt +; DWARF-ENRL-NEXT: 0x0048 10 3 0 0 0 0 epilogue_begin +; DWARF-ENRL-NEXT: 0x0050 10 3 0 0 0 0 end_sequence ; ModuleID = 'dwarf-loongarch-relocs.c' source_filename = "dwarf-loongarch-relocs.c" `` https://github.com/llvm/llvm-project/pull/79323 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79253 (PR #79323)
https://github.com/llvmbot updated https://github.com/llvm/llvm-project/pull/79323 >From 71d847cca80e9fce0ef1b1fead78b48c7b49085d Mon Sep 17 00:00:00 2001 From: Weining Lu Date: Wed, 24 Jan 2024 11:03:14 +0800 Subject: [PATCH] [test] Update dwarf-loongarch-relocs.ll Address buildbot faiures: http://45.33.8.238/macm1/77360/step_11.txt http://45.33.8.238/linux/128902/step_12.txt (cherry picked from commit baba7e4175b6ca21e83b1cf8229f29dbba02e979) --- .../LoongArch/dwarf-loongarch-relocs.ll | 37 --- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll index e03b4c1d34de157..07443a62b93391b 100644 --- a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll +++ b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll @@ -1,19 +1,22 @@ ; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=-relax %s -o %t.o ; RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-NORL %s -; RUN: llvm-objdump --source %t.o | FileCheck --check-prefix=SOURCE %s -; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefix=DWARF %s +; RUN: llvm-objdump --source %t.o | FileCheck --check-prefixes=SOURCE,SOURCE-NORL %s +; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefixes=DWARF,DWARF-NORL %s ; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=+relax %s -o %t.r.o ; RUN: llvm-readobj -r %t.r.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-ENRL %s -; RUN: llvm-objdump --source %t.r.o | FileCheck --check-prefix=SOURCE %s -; RUN: llvm-dwarfdump --debug-info --debug-line %t.r.o | FileCheck --check-prefix=DWARF %s +; RUN: llvm-objdump --source %t.r.o | FileCheck --check-prefixes=SOURCE,SOURCE-ENRL %s +; RUN: llvm-dwarfdump --debug-info --debug-line %t.r.o | FileCheck --check-prefixes=DWARF,DWARF-ENRL %s ; RELOCS-BOTH: Relocations [ ; RELOCS-BOTH-NEXT:Section ({{.*}}) .rela.text { -; RELOCS-BOTH-NEXT: 0x14 R_LARCH_PCALA_HI20 sym 0x0 -; RELOCS-ENRL-NEXT: 0x14 R_LARCH_RELAX - 0x0 -; RELOCS-BOTH-NEXT: 0x18 R_LARCH_PCALA_LO12 sym 0x0 -; RELOCS-ENRL-NEXT: 0x18 R_LARCH_RELAX - 0x0 +; RELOCS-NORL-NEXT: 0x14 R_LARCH_PCALA_HI20 sym 0x0 +; RELOCS-NORL-NEXT: 0x18 R_LARCH_PCALA_LO12 sym 0x0 +; RELOCS-ENRL-NEXT: 0x0 R_LARCH_ALIGN .Lla-relax-align0 0x5 +; RELOCS-ENRL-NEXT: 0x30 R_LARCH_PCALA_HI20 sym 0x0 +; RELOCS-ENRL-NEXT: 0x30 R_LARCH_RELAX - 0x0 +; RELOCS-ENRL-NEXT: 0x34 R_LARCH_PCALA_LO12 sym 0x0 +; RELOCS-ENRL-NEXT: 0x34 R_LARCH_RELAX - 0x0 ; RELOCS-BOTH-NEXT:} ; RELOCS-BOTH: Section ({{.*}}) .rela.debug_frame { ; RELOCS-NORL-NEXT: 0x1C R_LARCH_32 .debug_frame 0x0 @@ -36,7 +39,8 @@ ; RELOCS-BOTH-NEXT:} ; RELOCS-BOTH-NEXT: ] -; SOURCE: : +; SOURCE-NORL: : +; SOURCE-ENRL: 001c : ; SOURCE: ; { ; SOURCE: ; asm volatile( ; SOURCE: ; return 0; @@ -87,11 +91,16 @@ ; DWARF-EMPTY: ; DWARF-NEXT: AddressLine Column File ISA Discriminator OpIndex Flags ; DWARF-NEXT: -- -- -- -- --- - --- - -; DWARF-NEXT: 0x 2 0 0 0 0 0 is_stmt -; DWARF-NEXT: 0x0010 3 3 0 0 0 0 is_stmt prologue_end -; DWARF-NEXT: 0x0020 10 3 0 0 0 0 is_stmt -; DWARF-NEXT: 0x002c 10 3 0 0 0 0 epilogue_begin -; DWARF-NEXT: 0x0034 10 3 0 0 0 0 end_sequence +; DWARF-NORL-NEXT: 0x 2 0 0 0 0 0 is_stmt +; DWARF-NORL-NEXT: 0x0010 3 3 0 0 0 0 is_stmt prologue_end +; DWARF-NORL-NEXT: 0x0020 10 3 0 0 0 0 is_stmt +; DWARF-NORL-NEXT: 0x002c 10 3 0 0 0 0 epilogue_begin +; DWARF-NORL-NEXT: 0x0034 10 3 0 0 0 0 end_sequence +; DWARF-ENRL-NEXT: 0x001c 2 0 0 0 0 0 is_stmt +; DWARF-ENRL-NEXT: 0x002c 3 3 0 0 0 0 is_stmt prologue_end +; DWARF-ENRL-NEXT: 0x003c 10 3 0 0 0 0 is_stmt +; DWARF-ENRL-NEXT: 0x0048 10 3 0 0 0 0 epilogue_begin +; DWARF-ENRL-NEXT: 0x0050 10 3 0 0 0 0 end_sequence ; ModuleID = 'dwarf-loongarch-relocs.c' source_filename = "dwarf-loongarch-relocs.c" ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
https://github.com/minglotus-6 edited https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -124,6 +124,28 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, Worklist.push_back(Operand); } } + + const Instruction *I = dyn_cast(CurUser); + if (I) { +uint32_t ActualNumValueData = 0; +uint64_t TotalCount = 0; +// 24 is the maximum number of values preserved for one instrumented site, +// defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in +// compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as +// `MaxNumValueData` controls the max number of elements in the returned +// array. The actual number of values is gated by the number of ops in !prof +// metadata. +auto ValueDataArray = getValueProfDataFromInst( +*I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData, minglotus-6 wrote: If the number of vtables is too many compared with the number of functions (i.e., 3 indirect call candidates from 10 vtables), ICP transformation heuristic should choose function comparison based on my experiment). I'll introduce a `cl::opt` option and limits the default value as 6 (2x of [function's default](https://github.com/llvm/llvm-project/blob/e99edf6bcb20169e153110426f840a2dfeeec66d/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp#L180)) https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [workflows] Fix version-check.yml to work with the new minor release bump (PR #79495)
https://github.com/tru approved this pull request. https://github.com/llvm/llvm-project/pull/79495 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [π][libc++] Fix missing and incorrect push/pop macros (#79204) (PR #79497)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r 22683463740e55e7e0d7e664395c30899b229205...ff0ffdf8a2ef16b30dc1f4c372de2f0aac000c16 libcxx/test/libcxx/system_reserved_names.gen.py `` View the diff from darker here. ``diff --- system_reserved_names.gen.py2024-01-25 20:50:38.00 + +++ system_reserved_names.gen.py2024-01-25 20:54:23.791230 + @@ -15,11 +15,12 @@ import sys sys.path.append(sys.argv[1]) from libcxx.header_information import lit_header_restrictions, public_headers for header in public_headers: - print(f"""\ +print( +f"""\ //--- {header}.compile.pass.cpp {lit_header_restrictions.get(header, '')} #define SYSTEM_RESERVED_NAME This name should not be used in libc++ @@ -170,6 +171,7 @@ static_assert(__builtin_strcmp(STRINGIFY(min), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); static_assert(__builtin_strcmp(STRINGIFY(max), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); static_assert(__builtin_strcmp(STRINGIFY(move), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); static_assert(__builtin_strcmp(STRINGIFY(erase), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); static_assert(__builtin_strcmp(STRINGIFY(refresh), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, ""); -""") +""" +) `` https://github.com/llvm/llvm-project/pull/79497 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [π][libc++] Fix missing and incorrect push/pop macros (#79204) (PR #79497)
llvmbot wrote: @llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) Changes We recently noticed that the unwrap_iter.h file was pushing macros, but it was pushing them again instead of popping them at the end of the file. This led to libc++ basically swallowing any custom definition of these macros in user code: #define min HELLO #include// min is not HELLO anymore, it's not defined While investigating this issue, I noticed that our push/pop pragmas were actually entirely wrong too. Indeed, instead of pushing macros like `move`, we'd push `move(int, int)` in the pragma, which is not a valid macro name. As a result, we would not actually push macros like `move` -- instead we'd simply undefine them. This led to the following code not working: #define move HELLO #include // move is not HELLO anymore Fixing the pragma push/pop incantations led to a cascade of issues because we use identifiers like `move` in a large number of places, and all of these headers would now need to do the push/pop dance. This patch fixes all these issues. First, it adds a check that we don't swallow important names like min, max, move or refresh as explained above. This is done by augmenting the existing system_reserved_names.gen.py test to also check that the macros are what we expect after including each header. Second, it fixes the push/pop pragmas to work properly and adds missing pragmas to all the files I could detect a failure in via the newly added test. rdar://121365472 (cherry picked from commit 7b4622514d232ce5f7110dd8b20d90e81127c467) --- Patch is 110.48 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/79497.diff 185 Files Affected: - (modified) libcxx/include/__algorithm/copy_move_common.h (+5) - (modified) libcxx/include/__algorithm/equal.h (+5) - (modified) libcxx/include/__algorithm/equal_range.h (+5) - (modified) libcxx/include/__algorithm/fold.h (+5) - (modified) libcxx/include/__algorithm/in_found_result.h (+5) - (modified) libcxx/include/__algorithm/in_fun_result.h (+5) - (modified) libcxx/include/__algorithm/in_in_out_result.h (+5) - (modified) libcxx/include/__algorithm/in_in_result.h (+5) - (modified) libcxx/include/__algorithm/in_out_out_result.h (+5) - (modified) libcxx/include/__algorithm/includes.h (+5) - (modified) libcxx/include/__algorithm/next_permutation.h (+5) - (modified) libcxx/include/__algorithm/nth_element.h (+5) - (modified) libcxx/include/__algorithm/partial_sort.h (+5) - (modified) libcxx/include/__algorithm/partial_sort_copy.h (+5) - (modified) libcxx/include/__algorithm/partition.h (+5) - (modified) libcxx/include/__algorithm/prev_permutation.h (+5) - (modified) libcxx/include/__algorithm/pstl_any_all_none_of.h (+5) - (modified) libcxx/include/__algorithm/pstl_backends/cpu_backends/transform_reduce.h (+5) - (modified) libcxx/include/__algorithm/pstl_copy.h (+5) - (modified) libcxx/include/__algorithm/pstl_count.h (+5) - (modified) libcxx/include/__algorithm/pstl_equal.h (+5) - (modified) libcxx/include/__algorithm/pstl_fill.h (+5) - (modified) libcxx/include/__algorithm/pstl_find.h (+5) - (modified) libcxx/include/__algorithm/pstl_for_each.h (+5) - (modified) libcxx/include/__algorithm/pstl_generate.h (+5) - (modified) libcxx/include/__algorithm/pstl_is_partitioned.h (+5) - (modified) libcxx/include/__algorithm/pstl_merge.h (+5) - (modified) libcxx/include/__algorithm/pstl_move.h (+5) - (modified) libcxx/include/__algorithm/pstl_replace.h (+5) - (modified) libcxx/include/__algorithm/pstl_rotate_copy.h (+5) - (modified) libcxx/include/__algorithm/pstl_sort.h (+5) - (modified) libcxx/include/__algorithm/pstl_stable_sort.h (+5) - (modified) libcxx/include/__algorithm/pstl_transform.h (+5) - (modified) libcxx/include/__algorithm/ranges_all_of.h (+5) - (modified) libcxx/include/__algorithm/ranges_any_of.h (+5) - (modified) libcxx/include/__algorithm/ranges_binary_search.h (+5) - (modified) libcxx/include/__algorithm/ranges_clamp.h (+5) - (modified) libcxx/include/__algorithm/ranges_contains.h (+5) - (modified) libcxx/include/__algorithm/ranges_copy.h (+5) - (modified) libcxx/include/__algorithm/ranges_copy_backward.h (+5) - (modified) libcxx/include/__algorithm/ranges_copy_if.h (+5) - (modified) libcxx/include/__algorithm/ranges_copy_n.h (+5) - (modified) libcxx/include/__algorithm/ranges_count.h (+5) - (modified) libcxx/include/__algorithm/ranges_count_if.h (+5) - (modified) libcxx/include/__algorithm/ranges_ends_with.h (+5) - (modified) libcxx/include/__algorithm/ranges_equal.h (+5) - (modified) libcxx/include/__algorithm/ranges_equal_range.h (+5) - (modified) libcxx/include/__algorithm/ranges_fill.h (+5) - (modified) libcxx/include/__algorithm/ranges_fill_n.h (+5) - (modified) libcxx/include/__algorithm/ranges_find.h (+5) - (modified) libcxx/include/__algorithm/ranges_find_end.h (+5) - (modified) libcxx/include/__
[llvm-branch-commits] [libcxx] [π][libc++] Fix missing and incorrect push/pop macros (#79204) (PR #79497)
https://github.com/ldionne edited https://github.com/llvm/llvm-project/pull/79497 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [π][libc++] Fix missing and incorrect push/pop macros (#79204) (PR #79497)
https://github.com/ldionne milestoned https://github.com/llvm/llvm-project/pull/79497 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] [π] Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (PR #79480)
https://github.com/ldionne edited https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (PR #79480)
https://github.com/ldionne approved this pull request. https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (PR #79480)
ldionne wrote: Oh, that's great! Then it looks like this PR is fine as-is. https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [workflows] Fix version-check.yml to work with the new minor release bump (PR #79495)
llvmbot wrote: @llvm/pr-subscribers-github-workflow Author: Tom Stellard (tstellar) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/79495.diff 1 Files Affected: - (modified) .github/workflows/version-check.py (+1-1) ``diff diff --git a/.github/workflows/version-check.py b/.github/workflows/version-check.py index 7f805f304e3d76f..f75fd50300881b9 100755 --- a/.github/workflows/version-check.py +++ b/.github/workflows/version-check.py @@ -16,7 +16,7 @@ def get_version_from_tag(tag): m = re.match("llvmorg-([0-9]+)-init", tag) if m: -return (m.group(1), "0", "0") +return (m.group(1), "1", "0") raise Exception(f"error: Tag is not valid: {tag}") `` https://github.com/llvm/llvm-project/pull/79495 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [workflows] Fix version-check.yml to work with the new minor release bump (PR #79495)
https://github.com/tstellar created https://github.com/llvm/llvm-project/pull/79495 None >From 9f8b83a13c91401d4c67e84a682d2cd5ef1e85fb Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 25 Jan 2024 12:24:50 -0800 Subject: [PATCH] [workflows] Fix version-check.yml to with the new minor release bump --- .github/workflows/version-check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version-check.py b/.github/workflows/version-check.py index 7f805f304e3d76f..f75fd50300881b9 100755 --- a/.github/workflows/version-check.py +++ b/.github/workflows/version-check.py @@ -16,7 +16,7 @@ def get_version_from_tag(tag): m = re.match("llvmorg-([0-9]+)-init", tag) if m: -return (m.group(1), "0", "0") +return (m.group(1), "1", "0") raise Exception(f"error: Tag is not valid: {tag}") ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (PR #79480)
tstellar wrote: > This is the official way to do it: > https://llvm.org/docs/GitHub.html#backporting-fixes-to-the-release-branches > > @tstellar I do wonder if it wouldn't be simpler to allow people to open PRs > against the release branch instead? This is the plan. See #79481. https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [compiler-rt] [ThinLTO][TypeProf] Implement vtable def import (PR #79381)
@@ -124,6 +124,28 @@ static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, Worklist.push_back(Operand); } } + + const Instruction *I = dyn_cast(CurUser); + if (I) { +uint32_t ActualNumValueData = 0; +uint64_t TotalCount = 0; +// 24 is the maximum number of values preserved for one instrumented site, +// defined by INSTR_PROF_DEFAULT_NUM_VAL_PER_SITE in +// compiler-rt/lib/profile/InstrProfilingValue.c; passing 24 as +// `MaxNumValueData` controls the max number of elements in the returned +// array. The actual number of values is gated by the number of ops in !prof +// metadata. +auto ValueDataArray = getValueProfDataFromInst( +*I, IPVK_VTableTarget, 24 /* MaxNumValueData */, ActualNumValueData, teresajohnson wrote: Do we really want 24? Or should we limit to something smaller (and tunable), like we do for virtual function pointer profiles in ICP. https://github.com/llvm/llvm-project/pull/79381 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (PR #79480)
ldionne wrote: This is the official way to do it: https://llvm.org/docs/GitHub.html#backporting-fixes-to-the-release-branches @tstellar I do wonder if it wouldn't be simpler to allow people to open PRs against the release branch instead? https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (PR #79480)
https://github.com/ldionne edited https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (PR #79480)
https://github.com/ldionne edited https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to β¦ (PR #79480)
EricWF wrote: @tstellar Please let me know if this isn't the correct way to use PR's for release cherry-picks. https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to β¦ (PR #79480)
llvmbot wrote: @llvm/pr-subscribers-libcxx Author: Eric (EricWF) Changes β¦8. (#68925) Unconditionally change std::string's alignment to 8. This change saves memory by providing the allocator more freedom to allocate the most efficient size class by dropping the alignment requirements for std::string's pointer from 16 to 8. This changes the output of std::string::max_size, which makes it ABI breaking. That said, the discussion concluded that we don't care about this ABI break. and would like this change enabled universally. The ABI break isn't one of layout or "class size", but rather the value of "max_size()" changes, which in turn changes whether `std::bad_alloc` or `std::length_error` is thrown for large allocations. This change is the child of PR #68807, which enabled the change behind an ABI flag. --- Full diff: https://github.com/llvm/llvm-project/pull/79480.diff 6 Files Affected: - (modified) libcxx/docs/ReleaseNotes/18.rst (+4-5) - (modified) libcxx/include/__config (-5) - (modified) libcxx/include/string (+1-6) - (modified) libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp (+4-8) - (modified) libcxx/test/libcxx/strings/basic.string/string.capacity/max_size.pass.cpp (+2-8) - (modified) libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp (+6) ``diff diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst index fb3d2af544c287e..80b42ad7f653aa2 100644 --- a/libcxx/docs/ReleaseNotes/18.rst +++ b/libcxx/docs/ReleaseNotes/18.rst @@ -275,11 +275,10 @@ ABI Affecting Changes results in an ABI break, however in practice we expect uses of ``std::projected`` in ABI-sensitive places to be extremely rare. Any error resulting from this change should result in a link-time error. -- Under the unstable ABI, the internal alignment requirements for heap allocations - inside ``std::string`` has decreased from 16 to 8. This saves memory since string requests fewer additional - bytes than it did previously. However, this also changes the return value of ``std::string::max_size`` - and can cause code compiled against older libc++ versions but linked at runtime to a new version - to throw a different exception when attempting allocations that are too large +- The internal alignment requirements for heap allocations inside ``std::string`` has decreased from 16 to 8. This + saves memory since string requests fewer additional bytes than it did previously. However, this also changes the + return value of ``std::string::max_size`` and can cause code compiled against older libc++ versions but linked at + runtime to a new version to throw a different exception when attempting allocations that are too large (``std::bad_alloc`` vs ``std::length_error``). - The layout of some range adaptors that use the ``movable-box`` exposition-only type as an implementation diff --git a/libcxx/include/__config b/libcxx/include/__config index 18875e1b61e6fbd..ad9a15f780703e7 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -174,11 +174,6 @@ // The implementation moved to the header, but we still export the symbols from // the dylib for backwards compatibility. #define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 -// Save memory by providing the allocator more freedom to allocate the most -// efficient size class by dropping the alignment requirements for std::string's -// pointer from 16 to 8. This changes the output of std::string::max_size, -// which makes it ABI breaking -#define _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT # elif _LIBCPP_ABI_VERSION == 1 #if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support diff --git a/libcxx/include/string b/libcxx/include/string index e97139206d4fa7c..ba169c3dbfc9e6c 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -1937,12 +1937,7 @@ private: return (__s + (__a - 1)) & ~(__a - 1); } enum { -__alignment = -#ifdef _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT -8 -#else -16 -#endif +__alignment = 8 }; static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __recommend(size_type __s) _NOEXCEPT { if (__s < __min_cap) { diff --git a/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp index c7df56c815a8054..1110e3d3ec568a2 100644 --- a/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp +++ b/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp @@ -6,6 +6,8 @@ // //===--===// +// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.13|10.15|11.0}} + // // This test demonstrates the smaller allocation sizes when th
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to β¦ (PR #79480)
https://github.com/EricWF edited https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to β¦ (PR #79480)
https://github.com/EricWF created https://github.com/llvm/llvm-project/pull/79480 β¦8. (#68925) Unconditionally change std::string's alignment to 8. This change saves memory by providing the allocator more freedom to allocate the most efficient size class by dropping the alignment requirements for std::string's pointer from 16 to 8. This changes the output of std::string::max_size, which makes it ABI breaking. That said, the discussion concluded that we don't care about this ABI break. and would like this change enabled universally. The ABI break isn't one of layout or "class size", but rather the value of "max_size()" changes, which in turn changes whether `std::bad_alloc` or `std::length_error` is thrown for large allocations. This change is the child of PR #68807, which enabled the change behind an ABI flag. >From 81e24242071ca2ef3cf9695dc448b92926078feb Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 24 Jan 2024 13:52:46 -0600 Subject: [PATCH] Unconditionally lower std::string's alignment requirement from 16 to 8. (#68925) Unconditionally change std::string's alignment to 8. This change saves memory by providing the allocator more freedom to allocate the most efficient size class by dropping the alignment requirements for std::string's pointer from 16 to 8. This changes the output of std::string::max_size, which makes it ABI breaking. That said, the discussion concluded that we don't care about this ABI break. and would like this change enabled universally. The ABI break isn't one of layout or "class size", but rather the value of "max_size()" changes, which in turn changes whether `std::bad_alloc` or `std::length_error` is thrown for large allocations. This change is the child of PR #68807, which enabled the change behind an ABI flag. --- libcxx/docs/ReleaseNotes/18.rst | 9 - libcxx/include/__config | 5 - libcxx/include/string| 7 +-- .../string.capacity/allocation_size.pass.cpp | 12 .../basic.string/string.capacity/max_size.pass.cpp | 10 ++ .../basic.string/string.capacity/max_size.pass.cpp | 6 ++ 6 files changed, 17 insertions(+), 32 deletions(-) diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst index fb3d2af544c287e..80b42ad7f653aa2 100644 --- a/libcxx/docs/ReleaseNotes/18.rst +++ b/libcxx/docs/ReleaseNotes/18.rst @@ -275,11 +275,10 @@ ABI Affecting Changes results in an ABI break, however in practice we expect uses of ``std::projected`` in ABI-sensitive places to be extremely rare. Any error resulting from this change should result in a link-time error. -- Under the unstable ABI, the internal alignment requirements for heap allocations - inside ``std::string`` has decreased from 16 to 8. This saves memory since string requests fewer additional - bytes than it did previously. However, this also changes the return value of ``std::string::max_size`` - and can cause code compiled against older libc++ versions but linked at runtime to a new version - to throw a different exception when attempting allocations that are too large +- The internal alignment requirements for heap allocations inside ``std::string`` has decreased from 16 to 8. This + saves memory since string requests fewer additional bytes than it did previously. However, this also changes the + return value of ``std::string::max_size`` and can cause code compiled against older libc++ versions but linked at + runtime to a new version to throw a different exception when attempting allocations that are too large (``std::bad_alloc`` vs ``std::length_error``). - The layout of some range adaptors that use the ``movable-box`` exposition-only type as an implementation diff --git a/libcxx/include/__config b/libcxx/include/__config index 18875e1b61e6fbd..ad9a15f780703e7 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -174,11 +174,6 @@ // The implementation moved to the header, but we still export the symbols from // the dylib for backwards compatibility. #define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 -// Save memory by providing the allocator more freedom to allocate the most -// efficient size class by dropping the alignment requirements for std::string's -// pointer from 16 to 8. This changes the output of std::string::max_size, -// which makes it ABI breaking -#define _LIBCPP_ABI_STRING_8_BYTE_ALIGNMENT # elif _LIBCPP_ABI_VERSION == 1 #if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support diff --git a/libcxx/include/string b/libcxx/include/string index e97139206d4fa7c..ba169c3dbfc9e6c 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -1937,12 +1937,7 @@ private: return (__s + (__a - 1)) & ~(__a - 1); } enum { -__alignment = -#ifdef _LIBCPP_ABI_STRI
[llvm-branch-commits] [libcxx] Cherry-pick Unconditionally lower std::string's alignment requirement from 16 to β¦ (PR #79480)
https://github.com/EricWF milestoned https://github.com/llvm/llvm-project/pull/79480 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [mlir] [llvm] PR for llvm/llvm-project#79293 (PR #79461)
https://github.com/github-actions[bot] milestoned https://github.com/llvm/llvm-project/pull/79461 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79451 (PR #79457)
jayfoad wrote: > @jayfoad What do you think about merging this PR to the release branch? LGTM, but it was me that requested it. https://github.com/llvm/llvm-project/pull/79457 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79451 (PR #79457)
github-actions[bot] wrote: @jayfoad What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/79457 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79451 (PR #79457)
https://github.com/github-actions[bot] milestoned https://github.com/llvm/llvm-project/pull/79457 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] PR for llvm/llvm-project#79451 (PR #79457)
https://github.com/github-actions[bot] created https://github.com/llvm/llvm-project/pull/79457 resolves llvm/llvm-project#79451 >From 2aa05f9f41c073ef1a98832176df98103686847b Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Wed, 24 Jan 2024 15:06:20 + Subject: [PATCH] [AMDGPU] Move architected SGPR implementation into isel (#79120) (cherry picked from commit 70fc9703788e8965813c5b677a85cb84b66671b6) --- .../lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp | 39 ++- llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 68 ++-- .../lib/Target/AMDGPU/SIMachineFunctionInfo.h | 32 +- .../AMDGPU/indirect-call-known-callees.ll | 1 - .../lower-work-group-id-intrinsics-hsa.ll | 295 ++ .../lower-work-group-id-intrinsics-pal.ll | 187 +++ .../AMDGPU/lower-work-group-id-intrinsics.ll | 128 .../AMDGPU/workgroup-id-in-arch-sgprs.ll | 129 +++- 8 files changed, 627 insertions(+), 252 deletions(-) create mode 100644 llvm/test/CodeGen/AMDGPU/lower-work-group-id-intrinsics-hsa.ll create mode 100644 llvm/test/CodeGen/AMDGPU/lower-work-group-id-intrinsics-pal.ll delete mode 100644 llvm/test/CodeGen/AMDGPU/lower-work-group-id-intrinsics.ll diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp index 8e74d4c0e94592b..fc02766a4b27ad9 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp @@ -4178,10 +4178,45 @@ bool AMDGPULegalizerInfo::loadInputValue( Register DstReg, MachineIRBuilder &B, AMDGPUFunctionArgInfo::PreloadedValue ArgType) const { const SIMachineFunctionInfo *MFI = B.getMF().getInfo(); - const ArgDescriptor *Arg; + const ArgDescriptor *Arg = nullptr; const TargetRegisterClass *ArgRC; LLT ArgTy; - std::tie(Arg, ArgRC, ArgTy) = MFI->getPreloadedValue(ArgType); + + CallingConv::ID CC = B.getMF().getFunction().getCallingConv(); + const ArgDescriptor WorkGroupIDX = + ArgDescriptor::createRegister(AMDGPU::TTMP9); + // If GridZ is not programmed in an entry function then the hardware will set + // it to all zeros, so there is no need to mask the GridY value in the low + // order bits. + const ArgDescriptor WorkGroupIDY = ArgDescriptor::createRegister( + AMDGPU::TTMP7, + AMDGPU::isEntryFunctionCC(CC) && !MFI->hasWorkGroupIDZ() ? ~0u : 0xu); + const ArgDescriptor WorkGroupIDZ = + ArgDescriptor::createRegister(AMDGPU::TTMP7, 0xu); + if (ST.hasArchitectedSGPRs() && AMDGPU::isCompute(CC)) { +switch (ArgType) { +case AMDGPUFunctionArgInfo::WORKGROUP_ID_X: + Arg = &WorkGroupIDX; + ArgRC = &AMDGPU::SReg_32RegClass; + ArgTy = LLT::scalar(32); + break; +case AMDGPUFunctionArgInfo::WORKGROUP_ID_Y: + Arg = &WorkGroupIDY; + ArgRC = &AMDGPU::SReg_32RegClass; + ArgTy = LLT::scalar(32); + break; +case AMDGPUFunctionArgInfo::WORKGROUP_ID_Z: + Arg = &WorkGroupIDZ; + ArgRC = &AMDGPU::SReg_32RegClass; + ArgTy = LLT::scalar(32); + break; +default: + break; +} + } + + if (!Arg) +std::tie(Arg, ArgRC, ArgTy) = MFI->getPreloadedValue(ArgType); if (!Arg) { if (ArgType == AMDGPUFunctionArgInfo::KERNARG_SEGMENT_PTR) { diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index cf947dccafac55f..744961eeaaad596 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -2072,11 +2072,45 @@ SDValue SITargetLowering::getPreloadedValue(SelectionDAG &DAG, const SIMachineFunctionInfo &MFI, EVT VT, AMDGPUFunctionArgInfo::PreloadedValue PVID) const { - const ArgDescriptor *Reg; + const ArgDescriptor *Reg = nullptr; const TargetRegisterClass *RC; LLT Ty; - std::tie(Reg, RC, Ty) = MFI.getPreloadedValue(PVID); + CallingConv::ID CC = DAG.getMachineFunction().getFunction().getCallingConv(); + const ArgDescriptor WorkGroupIDX = + ArgDescriptor::createRegister(AMDGPU::TTMP9); + // If GridZ is not programmed in an entry function then the hardware will set + // it to all zeros, so there is no need to mask the GridY value in the low + // order bits. + const ArgDescriptor WorkGroupIDY = ArgDescriptor::createRegister( + AMDGPU::TTMP7, + AMDGPU::isEntryFunctionCC(CC) && !MFI.hasWorkGroupIDZ() ? ~0u : 0xu); + const ArgDescriptor WorkGroupIDZ = + ArgDescriptor::createRegister(AMDGPU::TTMP7, 0xu); + if (Subtarget->hasArchitectedSGPRs() && AMDGPU::isCompute(CC)) { +switch (PVID) { +case AMDGPUFunctionArgInfo::WORKGROUP_ID_X: + Reg = &WorkGroupIDX; + RC = &AMDGPU::SReg_32RegClass; + Ty = LLT::scalar(32); + break; +case AMDGPUFunctionArgInfo::WORKGROUP_ID_Y: + Reg = &WorkGroupIDY; + RC = &AMDGPU::SReg_32RegClass; + Ty = LLT::scalar(32); + break; +case AMDGPUFunctionArgInfo::WORKGROUP_ID_Z: + Reg = &WorkGroupIDZ; + RC =
[llvm-branch-commits] [libcxx] [clang] Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)" in release/18.x (PR #79400)
erichkeane wrote: I'd like us to give the author a chance to fix the original so that this feature can get into 18, but this being here will be helpful in case he is unable to. https://github.com/llvm/llvm-project/pull/79400 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79339 (PR #79357)
https://github.com/smithp35 approved this pull request. LGTM for merging https://github.com/llvm/llvm-project/pull/79357 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] PR for llvm/llvm-project#79339 (PR #79357)
smithp35 wrote: This is good to go for merging, a simple safe change. https://github.com/llvm/llvm-project/pull/79357 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits