[clang] [clang-tools-extra] [llvm] [InstCombine] Convert or concat to fshl if opposite or concat exists (PR #68502)

2023-11-10 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao approved this pull request.

LGTM.

https://github.com/llvm/llvm-project/pull/68502
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[flang] [libc] [llvm] [clang] [libcxx] [lldb] [compiler-rt] [clang-tools-extra] [RegAllocFast] Refactor dominates algorithm for large basic block (PR #72250)

2023-12-22 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao approved this pull request.


https://github.com/llvm/llvm-project/pull/72250
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Update documentation and release notes for llvm-profgen COFF support (PR #84864)

2024-03-21 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao approved this pull request.


https://github.com/llvm/llvm-project/pull/84864
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Update documentation and release notes for llvm-profgen COFF support (PR #84864)

2024-03-21 Thread Wei Xiao via cfe-commits

williamweixiao wrote:

please resolve the conflicts.

https://github.com/llvm/llvm-project/pull/84864
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] Update documentation and release notes for llvm-profgen COFF support (PR #84864)

2024-03-26 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao closed 
https://github.com/llvm/llvm-project/pull/84864
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Improve documented sampling profiler steps to best known methods (PR #88438)

2024-04-19 Thread Wei Xiao via cfe-commits


@@ -2443,27 +2443,29 @@ usual build cycle when using sample profilers for 
optimization:
usual build flags that you always build your application with. The only
requirement is that DWARF debug info including source line information is
generated. This DWARF information is important for the profiler to be able
-   to map instructions back to source line locations.
+   to map instructions back to source line locations. The usefulness of this
+   DWARF information can be improved with the ``-fdebug-info-for-profiling``
+   and ``-funique-internal-linkage-names`` options.

williamweixiao wrote:

do we also need  ``-fdebug-info-for-profiling`` and 
``-funique-internal-linkage-names`` for step 4 
("-fprofile-sample-use=code.prof") ?

https://github.com/llvm/llvm-project/pull/88438
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Improve documented sampling profiler steps to best known methods (PR #88438)

2024-04-28 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao approved this pull request.


https://github.com/llvm/llvm-project/pull/88438
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Improve documented sampling profiler steps to best known methods (PR #88438)

2024-04-28 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao closed 
https://github.com/llvm/llvm-project/pull/88438
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PseudoProbe] Support emitting to COFF object (PR #123870)

2025-08-28 Thread Wei Xiao via cfe-commits


@@ -1221,44 +1231,68 @@ MCObjectFileInfo::getKCFITrapSection(const MCSection 
&TextSec) const {
 
 MCSection *
 MCObjectFileInfo::getPseudoProbeSection(const MCSection &TextSec) const {
-  if (Ctx->getObjectFileType() != MCContext::IsELF)
-return PseudoProbeSection;
-
-  const auto &ElfSec = static_cast(TextSec);
-  unsigned Flags = ELF::SHF_LINK_ORDER;
-  StringRef GroupName;
-  if (const MCSymbol *Group = ElfSec.getGroup()) {
-GroupName = Group->getName();
-Flags |= ELF::SHF_GROUP;
+  auto ObjFileType = Ctx->getObjectFileType();
+  if (ObjFileType == MCContext::IsELF) {
+const auto &ElfSec = static_cast(TextSec);
+unsigned Flags = ELF::SHF_LINK_ORDER;
+StringRef GroupName;
+if (const MCSymbol *Group = ElfSec.getGroup()) {
+  GroupName = Group->getName();
+  Flags |= ELF::SHF_GROUP;
+}
+return Ctx->getELFSection(
+PseudoProbeSection->getName(), ELF::SHT_PROGBITS, Flags, 0, GroupName,
+true, ElfSec.getUniqueID(),
+static_cast(TextSec.getBeginSymbol()));
+  } else if (ObjFileType == MCContext::IsCOFF) {
+StringRef COMDATSymName = "";
+int Selection = 0;
+unsigned Characteristics =
+static_cast(PseudoProbeSection)->getCharacteristics();
+const auto &COFFSec = static_cast(TextSec);
+if (const MCSymbol *COMDATSym = COFFSec.getCOMDATSymbol()) {
+  // Associate .pseudo_probe to its function section.
+  COMDATSymName = COMDATSym->getName();
+  Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
+  Selection = COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE;
+}
+return Ctx->getCOFFSection(PseudoProbeSection->getName(), Characteristics,
+   COMDATSymName, Selection, 
COFFSec.getUniqueID());
   }
 
-  return Ctx->getELFSection(
-  PseudoProbeSection->getName(), ELF::SHT_PROGBITS, Flags, 0, GroupName,
-  true, ElfSec.getUniqueID(),
-  static_cast(TextSec.getBeginSymbol()));
+  return PseudoProbeSection;
 }
 
 MCSection *
 MCObjectFileInfo::getPseudoProbeDescSection(StringRef FuncName) const {
-  if (Ctx->getObjectFileType() == MCContext::IsELF) {
-// Create a separate comdat group for each function's descriptor in order
-// for the linker to deduplicate. The duplication, must be from different
-// tranlation unit, can come from:
-//  1. Inline functions defined in header files;
-//  2. ThinLTO imported funcions;
-//  3. Weak-linkage definitions.
-// Use a concatenation of the section name and the function name as the
-// group name so that descriptor-only groups won't be folded with groups of
-// code.
-if (Ctx->getTargetTriple().supportsCOMDAT() && !FuncName.empty()) {
-  auto *S = static_cast(PseudoProbeDescSection);
-  auto Flags = S->getFlags() | ELF::SHF_GROUP;
-  return Ctx->getELFSection(S->getName(), S->getType(), Flags,
-S->getEntrySize(),
-S->getName() + "_" + FuncName,
-/*IsComdat=*/true);
-}
+  if (!Ctx->getTargetTriple().supportsCOMDAT() || FuncName.empty())
+return PseudoProbeDescSection;
+
+  // Create a separate comdat group for each function's descriptor in order
+  // for the linker to deduplicate. The duplication, must be from different
+  // tranlation unit, can come from:
+  //  1. Inline functions defined in header files;
+  //  2. ThinLTO imported funcions;
+  //  3. Weak-linkage definitions.
+  // Use a concatenation of the section name and the function name as the
+  // group name so that descriptor-only groups won't be folded with groups of
+  // code.
+  auto ObjFileType = Ctx->getObjectFileType();
+  if (ObjFileType == MCContext::IsELF) {
+auto *S = static_cast(PseudoProbeDescSection);
+auto Flags = S->getFlags() | ELF::SHF_GROUP;
+return Ctx->getELFSection(S->getName(), S->getType(), Flags,
+  S->getEntrySize(), S->getName() + "_" + FuncName,
+  /*IsComdat=*/true);
+  } else if (ObjFileType == MCContext::IsCOFF) {
+auto *S = static_cast(PseudoProbeDescSection);
+unsigned Characteristics =
+S->getCharacteristics() | COFF::IMAGE_SCN_LNK_COMDAT;
+std::string COMDATSymName = (S->getName() + "_" + FuncName).str();
+return Ctx->getCOFFSection(S->getName(), Characteristics, COMDATSymName,
+   COFF::IMAGE_COMDAT_SELECT_ANY);

williamweixiao wrote:

IMAGE_COMDAT_SELECT_EXACT_MATCH?

https://github.com/llvm/llvm-project/pull/123870
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PseudoProbe] Support emitting to COFF object (PR #123870)

2025-08-28 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao commented:

LGTM. Just some trivial comments.

https://github.com/llvm/llvm-project/pull/123870
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PseudoProbe] Support emitting to COFF object (PR #123870)

2025-08-28 Thread Wei Xiao via cfe-commits


@@ -1,4 +1,4 @@
-; REQUIRES: x86_64-linux
+; REQUIRES: x86-registered-target

williamweixiao wrote:

The lit case is Linux specific.

https://github.com/llvm/llvm-project/pull/123870
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PseudoProbe] Support emitting to COFF object (PR #123870)

2025-08-28 Thread Wei Xiao via cfe-commits

https://github.com/williamweixiao edited 
https://github.com/llvm/llvm-project/pull/123870
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits