[clang] [Driver] Add LTO support for Haiku and OpenBSD (PR #72047)

2023-11-12 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/72047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Ignore template parameter visibility (PR #72092)

2023-11-13 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/72092 When computing the visibility of a template specialization/instantiation, GCC considers template arguments and ignores type template parameters. We currently consider non-type template parameters, which adds a lo

[clang] 9c1c56a - -fcoverage-mapping: simplify. NFC

2023-11-13 Thread Fangrui Song via cfe-commits
Author: Fangrui Song Date: 2023-11-13T15:16:58-08:00 New Revision: 9c1c56a80323291cd47af59d96122ec5bd42ea83 URL: https://github.com/llvm/llvm-project/commit/9c1c56a80323291cd47af59d96122ec5bd42ea83 DIFF: https://github.com/llvm/llvm-project/commit/9c1c56a80323291cd47af59d96122ec5bd42ea83.diff

[clang] Ignore template parameter visibility (PR #72092)

2023-11-13 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/72092 >From 401af7b4eabe92c8264c722a3f1181875da18438 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 12 Nov 2023 23:22:50 -0800 Subject: [PATCH 1/2] Ignore template parameter visibility When computing the visib

[clang] Ignore template parameter visibility (PR #72092)

2023-11-13 Thread Fangrui Song via cfe-commits
MaskRay wrote: Thanks for the comment. Frankly, I am at a loss in deriving a criterion (for shouldConsiderTemplateVisibility) to select one of the following rules. (1) factor in both template arguments and template parameters (2) factor in only template arguments (3) factor in nothing. Could y

[clang] [Driver][BoundsSafety] Add -fexperimental-bounds-safety flag (PR #70480)

2023-11-13 Thread Fangrui Song via cfe-commits
MaskRay wrote: > @MaskRay To be clear, the check is now in Driver as you suggested. It's just > that the frontend also has some extra checks too. So, you want me to remove > the extra checks in the frontend? Yes, otherwise it's duplicated check. In addition, I think our convention is to add t

[clang] [Driver][BoundsSafety] Add -fexperimental-bounds-safety flag (PR #70480)

2023-11-13 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay requested changes to this pull request. > -fbounds-safety-experimental is an experimental flag for -fbounds-safety, -fexperimental-bounds-safety https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cf

[lld] [llvm] [mlir] [clang] [flang] [ELF] Merge exportDynamic into versionId (PR #71272)

2023-11-13 Thread Fangrui Song via cfe-commits
MaskRay wrote: I'm nervous of making `--version-script` export a symbol when creating an executable. I have implemented https://github.com/llvm/llvm-project/pull/72208 instead to give us more free bits! https://github.com/llvm/llvm-project/pull/71272 __

[clang] Ignore template parameter visibility (PR #72092)

2023-11-13 Thread Fangrui Song via cfe-commits
MaskRay wrote: > > After the change, does it seem more feasible to ignore template parameters? > > Hmm. You're right that considering the type of a non-type template argument > would be enough to give the right visibility to my example. It would not be > enough if the template was used as a te

[clang] [Driver] Default LoongArch to -fno-direct-access-external-data for non-PIC (PR #72221)

2023-11-13 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/72221 For -fno-pic, if an extern variable is defined in a DSO, a copy relocation will be needed. However, loongarch*-linux does not and will not support copy relocations. Change Driver to default to -fno-direct-access-

[clang] [clang][LoongArch] Don't imply -fdirect-access-external-data for non-PIC (PR #71887)

2023-11-13 Thread Fangrui Song via cfe-commits
MaskRay wrote: Thanks for the patch, but I think we can keep the default only in the default so that Frontend does not need to handle target-specific differences. See https://github.com/llvm/llvm-project/pull/72221 and I've added only few tests that make sense (`-fpic -fdirect-access-external-

[clang] [Driver] Handle Flang in same manner between Gnu and *BSD/Solaris ToolChain (PR #70429)

2023-11-14 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/70429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)

2023-11-14 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/71371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)

2023-11-14 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/71371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)

2023-11-14 Thread Fangrui Song via cfe-commits
@@ -461,3 +461,8 @@ // DRIVER-PASS-INCLUDES: "-cc1" {{.*}}"-resource-dir" "[[RESOURCE:[^"]+]]" // DRIVER-PASS-INCLUDES-SAME: "-internal-isystem" "[[RESOURCE]]{{/|}}include" // DRIVER-PASS-INCLUDES-SAME: {{^}} "-internal-externc-isystem" "{{.*}}/usr/include" + +// Che

[clang] [Driver] Make use of AddFilePathLibArgs() on NetBSD. (PR #71371)

2023-11-14 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/71371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Default LoongArch to -fno-direct-access-external-data for non-PIC (PR #72221)

2023-11-14 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay closed https://github.com/llvm/llvm-project/pull/72221 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Mark -arch as TargetSpecific (PR #74365)

2023-12-04 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/74365 `-arch` is a Darwin-specific option that is ignored for other targets and not known by GCC. ``` % clang -arch arm64 -c a.c clang: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-

[clang] [clang] Enhance handling of Apple-specific '-arch'/'-target' option values (PR #72821)

2023-12-04 Thread Fangrui Song via cfe-commits
MaskRay wrote: `-arch ` is also related to universal binary that many other targets don't support (and they likely don't endorse such an approach). For ELF we should definitely encourage `--target=` for cross compilation. (`-target ` has been deprecated since Clang 3.2). Picking a default vers

[clang] [Driver] Mark -arch as TargetSpecific (PR #74365)

2023-12-05 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay closed https://github.com/llvm/llvm-project/pull/74365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Mark -arch as TargetSpecific (PR #74365)

2023-12-05 Thread Fangrui Song via cfe-commits
MaskRay wrote: When the target triple is aarch64 and `-arch ` is specified, e.g. `--target=aarch64 -arch arm64e`, there is currently no warning/error, because `clang/lib/Driver/ToolChains/Arch/AArch64.cpp` claims `OPT_arch` in quite a few places. We can safely remove these references now that

[clang] 7a49c30 - [Driver,test] Remove invalid -arch for non-Darwin AArch64 OSes

2023-12-05 Thread Fangrui Song via cfe-commits
Author: Fangrui Song Date: 2023-12-05T18:07:22-08:00 New Revision: 7a49c30b830471c39d09d71a6a617f2a7f3e711c URL: https://github.com/llvm/llvm-project/commit/7a49c30b830471c39d09d71a6a617f2a7f3e711c DIFF: https://github.com/llvm/llvm-project/commit/7a49c30b830471c39d09d71a6a617f2a7f3e711c.diff

[clang] 8a68671 - [Driver, AArch64] Ensure -arch logic is Darwin-specific

2023-12-05 Thread Fangrui Song via cfe-commits
Author: Fangrui Song Date: 2023-12-05T18:10:39-08:00 New Revision: 8a686716e360157ad5726560cc5ea61be647893c URL: https://github.com/llvm/llvm-project/commit/8a686716e360157ad5726560cc5ea61be647893c DIFF: https://github.com/llvm/llvm-project/commit/8a686716e360157ad5726560cc5ea61be647893c.diff

[clang] [llvm] [clang][RISCV] Change default abi when only have f extension but no d extension (PR #73489)

2023-12-05 Thread Fangrui Song via cfe-commits
@@ -1,4 +1,4 @@ -// Check target CPUs are correctly passed. +ยท// Check target CPUs are correctly passed. MaskRay wrote: Stray `.`? Please fix https://github.com/llvm/llvm-project/pull/73489 ___ cfe-commits mailing list

[clang] [llvm] [clang][RISCV] Change default abi when only have f extension but no d extension (PR #73489)

2023-12-05 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/73489 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang][RISCV] Change default abi when only have f extension but no d extension (PR #73489)

2023-12-05 Thread Fangrui Song via cfe-commits
MaskRay wrote: > when only have f extension but no d extension This can be simplified to "w/ f extension but w/o d extension" https://github.com/llvm/llvm-project/pull/73489 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang-tools-extra] [llvm] [clang] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-05 Thread Fangrui Song via cfe-commits
@@ -1809,6 +1814,255 @@ void AArch64AsmPrinter::emitInstruction(const MachineInstr *MI) { EmitToStreamer(*OutStreamer, TmpInst); } +void AArch64AsmPrinter::emitGlobalIFunc(Module &M, const GlobalIFunc &GI) { + if (!TM.getTargetTriple().isOSBinFormatMachO()) +return Asm

[clang-tools-extra] [llvm] [clang] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-05 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,72 @@ +; RUN: llc -mtriple=arm64-unknown-linux-gnu %s -filetype=asm -o - | FileCheck %s --check-prefixes=ELF MaskRay wrote: Omit `-filetype=asm` (convention). https://github.com/llvm/llvm-project/pull/73686 ___

[llvm] [clang-tools-extra] [clang] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-05 Thread Fangrui Song via cfe-commits
@@ -1,14 +1,49 @@ -; RUN: llvm-as < %s -o - | llc -filetype=asm | FileCheck %s +; RUN: llc -filetype=asm -mtriple=x86_64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefixes=ELF MaskRay wrote: omit `-filetype=asm` https://github.com/llvm/llvm-project/pull/

[clang] [clang] Strict aliasing warning ala GCC [PR50066] (PR #74155)

2023-12-05 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,192 @@ +// RUN: %clang_cc1 %s -O0 -Wstrict-aliasing -S -o %t -verify=quiet +// RUN: %clang_cc1 %s -O2 -Wstrict-aliasing=0 -S -o %t -verify=quiet +// RUN: %clang_cc1 %s -O2 -Wno-strict-aliasing -S -o %t -verify=quiet +// RUN: %clang_cc1 %s -O2 -Wstrict-aliasing=1 -S -o %

[clang] [clang] Strict aliasing warning ala GCC [PR50066] (PR #74155)

2023-12-05 Thread Fangrui Song via cfe-commits
MaskRay wrote: Add @shafik who authors https://gist.github.com/shafik/848ae25ee209f698763cffee272a58f8 ("Although clang allows these flags it apparently does not actually implement the warnings") > [*] I implemented what turned into GCC's level=1 way back when. Cool! FWIW the GCC doc is ht

[clang] [Driver] Add riscv64-suse-linux triple (PR #74513)

2023-12-05 Thread Fangrui Song via cfe-commits
MaskRay wrote: Sorry for causing you trouble but I think removing special cases from these `static const char *const XXXTriples[]` is intentional and we shall not add special cases for vendors. See https://github.com/llvm/llvm-project/issues/72256#issuecomment-1842148887 https://github.co

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s + +// CHECK: @normal ={{.*}} global i32 0, code_model "small" +int normal __attribute__((model("normal"))); + +// CHECK: @medium ={{.*}} global i32 0, code_model "medium" +int medium __attri

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -triple aarch64 -verify=expected,aarch64 -fsyntax-only %s +// RUN: %clang_cc1 -triple loongarch64 -verify=expected,loongarch64 -fsyntax-only %s +// RUN: %clang_cc1 -triple mips64 -verify=expected,mips64 -fsyntax-only %s +// RUN: %clang_cc1 -tr

[clang] [llvm] [clang-tools-extra] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -738,6 +739,36 @@ objcopy::parseObjcopyOptions(ArrayRef RawArgsArr, if (auto Arg = InputArgs.getLastArg(OBJCOPY_extract_partition)) Config.ExtractPartition = Arg->getValue(); + if (const auto *A = InputArgs.getLastArg(OBJCOPY_gap_fill)) { +if (Config.OutputForma

[llvm] [clang] [clang-tools-extra] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,198 @@ +# RUN: yaml2obj --docnum=1 %s -o %t + +# RUN: not llvm-objcopy --gap-fill 1 %t 2>&1 | FileCheck %s --check-prefix=NOT-BINARY +# NOT-BINARY: error: '--gap-fill' is only supported for binary output + +# RUN: not llvm-objcopy -O binary --gap-fill= %t %t.bin 2>&1 |

[llvm] [clang] [clang-tools-extra] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/65815 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,198 @@ +# RUN: yaml2obj --docnum=1 %s -o %t + +# RUN: not llvm-objcopy --gap-fill 1 %t 2>&1 | FileCheck %s --check-prefix=NOT-BINARY +# NOT-BINARY: error: '--gap-fill' is only supported for binary output + +# RUN: not llvm-objcopy -O binary --gap-fill= %t %t.bin 2>&1 |

[clang] [llvm] [clang-tools-extra] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay commented: Sorry for the delay.. https://github.com/llvm/llvm-project/pull/65815 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [clang-tools-extra] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/65815 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [llvm] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -230,3 +230,15 @@ defm add_symbol defm update_section : Eq<"update-section", "Replace the contents of section with contents from a file ">, MetaVarName<"name=file">; + +defm gap_fill +: Eq<"gap-fill", "Fill the gaps between sections with instead of zero. "

[clang-tools-extra] [clang] [llvm] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -230,3 +230,15 @@ defm add_symbol defm update_section : Eq<"update-section", "Replace the contents of section with contents from a file ">, MetaVarName<"name=file">; + +defm gap_fill +: Eq<"gap-fill", "Fill the gaps between sections with instead of zero. "

[clang] [clang-tools-extra] [llvm] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/65815 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -230,3 +230,15 @@ defm add_symbol defm update_section : Eq<"update-section", "Replace the contents of section with contents from a file ">, MetaVarName<"name=file">; + +defm gap_fill +: Eq<"gap-fill", "Fill the gaps between sections with instead of zero. "

[llvm] [clang-tools-extra] [clang] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/65815 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clang] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/65815 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][MachineOutliner] Support -moutline option for aarch64_be (PR #73223)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/73223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][MachineOutliner] Support -moutline option for aarch64_be (PR #73223)

2023-12-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/73223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][MachineOutliner] Support -moutline option for aarch64_be (PR #73223)

2023-12-06 Thread Fangrui Song via cfe-commits
@@ -2400,7 +2400,8 @@ void tools::addMachineOutlinerArgs(const Driver &D, // Otherwise, add the proper mllvm flags. if (!(Triple.isARM() || Triple.isThumb() || Triple.getArch() == llvm::Triple::aarch64 || MaskRay wrote: This can be simp

[clang] [llvm] [RISCV] Always emit relocations for resolved symbols and relax (PR #73793)

2023-12-06 Thread Fangrui Song via cfe-commits
MaskRay wrote: For the driver BareMetal.cpp change, claiming `-mno-relax` should not be done for non-RISCV targets (e.g. AArch32). https://github.com/llvm/llvm-project/pull/73793 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] Fix tests hip-offload-compress-zlib/zstd.hip (PR #74783)

2023-12-07 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. %T is deprecated in lit. You may want to migrate other `%T` related to AMDGPU. https://github.com/llvm/llvm-project/pull/74783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [clang][Driver] Support -fms-volatile as equivalent to /volatile:ms (PR #74790)

2023-12-07 Thread Fangrui Song via cfe-commits
MaskRay wrote: Current behavior: ``` % clang --target=x86_64-linux-musl -fms-volatile -c a.cc clang: warning: argument unused during compilation: '-fms-volatile' [-Wunused-command-line-argument] % clang --target=x86_64-windows -fms-volatile -c a.cc clang: warning: argument unused during compilat

[libunwind] [libunwind] Replace process_vm_readv with pipe (PR #74791)

2023-12-07 Thread Fangrui Song via cfe-commits
@@ -2700,19 +2701,18 @@ bool UnwindCursor::setInfoForSigReturn(Registers_arm64 &) { // [1] https://github.com/torvalds/linux/blob/master/arch/arm64/kernel/vdso/sigreturn.S const pint_t pc = static_cast(this->getReg(UNW_REG_IP)); // The PC might contain an invalid address

[clang] [llvm] [SpecialCaseList] Use glob by default (PR #74809)

2023-12-07 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/74809 https://reviews.llvm.org/D154014 addes glob support and enables it when `#!special-case-list-v2` is the first line. This patch makes the glob support the default (faster than regex after https://reviews.llvm.org/D

[llvm] [clang] [SpecialCaseList] Use glob by default (PR #74809)

2023-12-08 Thread Fangrui Song via cfe-commits
MaskRay wrote: > > > Probably would be good to introduce the `-v1` version and require it > > > first, then eventually change the default - so people don't get a silent > > > behavior change? Even the existing users only using `*` and `.` need to > > > change their syntax to migrate to v2, rig

[llvm] [clang-tools-extra] [clang] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-08 Thread Fangrui Song via cfe-commits
@@ -144,25 +145,27 @@ void GlobalObject::copyAttributesFrom(const GlobalObject *Src) { std::string GlobalValue::getGlobalIdentifier(StringRef Name, GlobalValue::LinkageTypes Linkage, Stri

[clang] [llvm] [clang-tools-extra] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-08 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,60 @@ +#!/bin/bash + +if [ $# -lt 1 ]; then + echo "Path to clang required!" + echo "Usage: update_thinlto_indirect_call_promotion_inputs.sh /path/to/updated/clang" + exit 1 +else + CLANG=$1 +fi + +# Allows the script to be invoked from other directories. +OUTDIR=$

[clang] [llvm] [clang-tools-extra] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-08 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [compiler-rt] [clang] [llvm] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-08 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-08 Thread Fangrui Song via cfe-commits
@@ -1,39 +1,45 @@ -; Do setup work for all below tests: generate bitcode and combined index -; RUN: opt -module-summary %s -o %t.bc -; RUN: opt -module-summary %p/Inputs/thinlto_indirect_call_promotion.ll -o %t2.bc +; The raw profiles and reduced IR inputs are generated from Inp

[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-08 Thread Fangrui Song via cfe-commits
MaskRay wrote: Trying to summarize the issue. `__llvm_prf_nm` contains an entry `getIRPGONameForGlobalObject() == "lib.cc;_ZL7callee0v"`. The hash in the "VP" metadata uses `md5("lib.cc;_ZL7callee0v")`: `!31 = !{!"VP", i32 0, i64 1, i64 8947761083887884635, i64 1}` Without this patch, when i

[llvm] [lld] [clang-tools-extra] [lldb] [clang] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)

2023-12-08 Thread Fangrui Song via cfe-commits
MaskRay wrote: flang and bolt are not changed? https://github.com/llvm/llvm-project/pull/74916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RISCV] Remove Name and OverloadedName from RVVIntrinsicDef. NFC (PR #74907)

2023-12-08 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/74907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][LTO] Copy fix empty stats filename to AMDGPU, HIPAMD, MinGW (PR #74178)

2023-12-09 Thread Fangrui Song via cfe-commits
MaskRay wrote: We should change `addLTSOption` and let it perform: ``` auto Input = llvm::find_if( Inputs, [](const InputInfo &II) -> bool { return II.isFilename(); }); if (Input == Inputs.end()) // For a very rare case, all of the inputs to the linker are // InputArg.

[llvm] [lldb] [clang] [lld] [clang-tools-extra] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)

2023-12-09 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/74916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix test rocm-detect.hip (PR #74872)

2023-12-09 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/74872 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Preprocessor] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 for AArch64 (PR #74954)

2023-12-09 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/74954 GCC sets `#define HAVE_atomic_compare_and_swapti 1` and therefore defines `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16`. Clang compiles the 16-byte legacy `__sync_bool_compare_and_swap` and new `__atomic_compare_exchange

[clang] [Preprocessor] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 for AArch64 (PR #74954)

2023-12-09 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/74954 >From 33f2816d7965ab6de2e401282922d9ddfe2e3222 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 9 Dec 2023 15:15:17 -0800 Subject: [PATCH] [Preprocessor] Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 for AArc

[clang] [Sema] atomic_compare_exchange: check failure memory order (PR #74959)

2023-12-09 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/74959 For `__atomic_compare_exchange{,_n}/__c11_atomic_compare_exchange_{strong,weak}`, GCC checks both the success memory order and the failure memory order under the default -Winvalid-memory-model ("memory model" is c

[clang] [DebugInfo] Fix duplicate DIFile when main file is preprocessed (PR #75022)

2023-12-10 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/75022 When the main file is preprocessed and we change `MainFileName` to the original source file name (e.g. `a.i => a.c`), the source manager does not contain `a.c`, but we incorrectly associate the DIFile(a.c) with md

[flang] [clang] [flang][driver] Rename `flang-new` as `flang` (PR #74377)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -27,7 +27,7 @@ ! FULL-LTO: "-fc1" ! FULL-LTO-SAME: "-flto=full" -! THIN-LTO-ALL: flang-new: warning: the option '-flto=thin' is a work in progress +! THIN-LTO-ALL: flang-{{[0-9]+}}: warning: the option '-flto=thin' is a work in progress MaskRay wrote: Fo

[flang] [clang] [flang][driver] Rename `flang-new` as `flang` (PR #74377)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -1,15 +1,15 @@ -! Test that flang-new OpenMP and OpenMP offload related +! Test that flang OpenMP and OpenMP offload related ! commands forward or expand to the appropriate commands -! for flang-new -fc1 as expected. Assumes a gfx90a, aarch64, +! for flang -fc1 as expected.

[clang] [flang] [flang][driver] Rename `flang-new` as `flang` (PR #74377)

2023-12-10 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74377 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RISCV] Enable target attribute when invoked through clang driver (PR #74889)

2023-12-10 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/74889 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [compiler-rt] [clang] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -144,25 +145,27 @@ void GlobalObject::copyAttributesFrom(const GlobalObject *Src) { std::string GlobalValue::getGlobalIdentifier(StringRef Name, GlobalValue::LinkageTypes Linkage, Stri

[clang] [compiler-rt] [llvm] [clang-tools-extra] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay commented: Mostly looks good with some nits... https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [compiler-rt] [clang] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,97 @@ +// This is a regression test for ThinLTO indirect-call-promotion when candidate +// callees need to be imported from another IR module. In the C++ test case, +// `main` calls `global_func` which is defined in another module. `global_func` +// has two indirect ca

[clang-tools-extra] [llvm] [compiler-rt] [clang] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,97 @@ +// This is a regression test for ThinLTO indirect-call-promotion when candidate +// callees need to be imported from another IR module. In the C++ test case, +// `main` calls `global_func` which is defined in another module. `global_func` +// has two indirect ca

[llvm] [compiler-rt] [clang] [clang-tools-extra] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,97 @@ +// This is a regression test for ThinLTO indirect-call-promotion when candidate +// callees need to be imported from another IR module. In the C++ test case, +// `main` calls `global_func` which is defined in another module. `global_func` +// has two indirect ca

[clang] [llvm] [clang-tools-extra] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -147,6 +147,9 @@ def exclude_unsupported_files_for_aix(dirname): config.substitutions.append( ("%clang_pgouse=", build_invocation(clang_cflags) + " -fprofile-use=") ) +config.substitutions.append( +("%clangxx_pgouse=", build_invocation(clang_cxxflags) + " -fprofile-u

[compiler-rt] [clang] [llvm] [clang-tools-extra] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -41,6 +41,10 @@ namespace Intrinsic { typedef unsigned ID; } // end namespace Intrinsic +// Choose ';' as the delimiter. ':' was used once but it doesn't work well for +// Objective-C functions which commonly have :'s in their names MaskRay wrote: add a fu

[clang] [compiler-rt] [clang-tools-extra] [llvm] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -1,39 +0,0 @@ -; Do setup work for all below tests: generate bitcode and combined index MaskRay wrote: Hmm, I think it is still preferred to have a test here as runtime tests are more sensitive to the environment and may be skipped by some contributors. It m

[clang-tools-extra] [compiler-rt] [llvm] [clang] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-10 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,97 @@ +// This is a regression test for ThinLTO indirect-call-promotion when candidate +// callees need to be imported from another IR module. In the C++ test case, +// `main` calls `global_func` which is defined in another module. `global_func` +// has two indirect ca

[clang] [llvm] [llvm] Add support for building on illumos (PR #74930)

2023-12-10 Thread Fangrui Song via cfe-commits
MaskRay wrote: I hope that someone using illumos can test, but if it is hard to find one I can approve this. https://github.com/llvm/llvm-project/pull/74930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [Sema] atomic_compare_exchange: check failure memory order (PR #74959)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/74959 >From 56a63cd9f910dc78163adda15252e7818cc7a419 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 9 Dec 2023 16:37:51 -0800 Subject: [PATCH 1/2] [Sema] atomic_compare_exchange: check failure memory order Fo

[llvm] [clang] [SpecialCaseList] Use glob by default (PR #74809)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/74809 >From 4aba7a65213971887db7432911e7743365f4f417 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 7 Dec 2023 21:17:24 -0800 Subject: [PATCH 1/2] [SpecialCaseList] Use glob by default https://reviews.llvm.org

[llvm] [clang] [SpecialCaseList] Use glob by default (PR #74809)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay closed https://github.com/llvm/llvm-project/pull/74809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Sema] atomic_compare_exchange: check failure memory order (PR #74959)

2023-12-11 Thread Fangrui Song via cfe-commits
@@ -8728,7 +8728,13 @@ def err_atomic_op_needs_atomic_int : Error< "%select{|atomic }0integer (%1 invalid)">; def warn_atomic_op_has_invalid_memory_order : Warning< "memory order argument to atomic operation is invalid">, - InGroup>; + InGroup; +def warn_atomic_op_has_inv

[compiler-rt] [clang-tools-extra] [llvm] [clang] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-11 Thread Fangrui Song via cfe-commits
@@ -147,6 +147,9 @@ def exclude_unsupported_files_for_aix(dirname): config.substitutions.append( ("%clang_pgouse=", build_invocation(clang_cflags) + " -fprofile-use=") ) +config.substitutions.append( +("%clangxx_pgouse=", build_invocation(clang_cxxflags) + " -fprofile-u

[compiler-rt] [clang-tools-extra] [llvm] [clang] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-11 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,97 @@ +// This is a regression test for ThinLTO indirect-call-promotion when candidate +// callees need to be imported from another IR module. In the C++ test case, +// `main` calls `global_func` which is defined in another module. `global_func` +// has two indirect ca

[clang] [clang][Driver] Support -fms-volatile as equivalent to /volatile:ms (PR #74790)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Driver] Support -fms-volatile as equivalent to /volatile:ms (PR #74790)

2023-12-11 Thread Fangrui Song via cfe-commits
@@ -611,3 +611,9 @@ // CHECK-INT-OBJEMITTER-NOT: unsupported option '-fintegrated-objemitter' for target // RUN: not %clang -### -fno-integrated-objemitter --target=x86_64 %s 2>&1 | FileCheck -check-prefix=CHECK-NOINT-OBJEMITTER %s // CHECK-NOINT-OBJEMITTER: unsupported optio

[clang] [clang][Driver] Support -fms-volatile as equivalent to /volatile:ms (PR #74790)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/74790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [lldb] [clang-tools-extra] [compiler-rt] [flang] [clang] [mlir] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-11 Thread Fangrui Song via cfe-commits
MaskRay wrote: We have this team: @llvm/pr-subscribers-pgo https://github.com/llvm/llvm-project/pull/69493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-11 Thread Fangrui Song via cfe-commits
@@ -1,39 +0,0 @@ -; Do setup work for all below tests: generate bitcode and combined index MaskRay wrote: It looks like that we had 3 precanned profraw files and this patch is adding another one. Since the raw profile isn't stable, this is going to add some inc

[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-11 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,97 @@ +// This is a regression test for ThinLTO indirect-call-promotion when candidate +// callees need to be imported from another IR module. In the C++ test case, +// `main` calls `global_func` which is defined in another module. `global_func` +// has two indirect ca

[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)

2023-12-11 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay approved this pull request. LGTM once these changes are made. * unused `%clangxx_pgouse=` * profraw => proftext for the PGOProfile test * lld-available -fuse-ld=lld and windows triple simplification for the compiler-rt test It seems useful to wait for others' opinion

<    1   2   3   4   5   6   7   8   9   10   >