[PATCH] D92073: [CodeGen] Add text section prefix for COFF object file

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 14:46:13 PST 2020


rnk added inline comments.


================
Comment at: llvm/test/CodeGen/X86/text-section-prefix.ll:9
+;; CHECK hot section name
+; SECTION-HOT-ELF:  .section        .text.hot
+; SECTION-HOT-COFF: .section        .text$hot
----------------
TaoPan wrote:
> pengfei wrote:
> > TaoPan wrote:
> > > pengfei wrote:
> > > > You don't need to distinguish `HOT` and `UNLIKLY` since they are in different functions. You just need `SECTION-ELF` and `SECTION-COFF`.
> > > > You may also need to add
> > > > ```
> > > > ; RUN: llc -mtriple x86_64-linux-gnu -unique-section-names=0 %s -o - | FileCheck %s --check-prefix=ELF-NOUNIQ
> > > > ; RUN: llc -mtriple x86_64-windows-mingw64 %s -o - | FileCheck %s --check-prefix=MINGW
> > > > ```
> > > > as Reid suggested.
> > > Thanks for your review comments! I removed HOT and UNLIKELY, and added ELF-NOUNIQ and MINGW, could you please have a look?
> > Nit: It seems no difference between `MSVC` and `MINGW`, you can use `COFF` for both to reduce the duplicated check.
> Thanks! It's good idea, I combined MSVC and MINGW into COFF.
They will differ if you use a linkonce_odr comdat function. These are very common in C++, it is worth testing this case. Try:

```
$foocomdat = comdat any
define linkonce_odr dso_local i32 @foocomdat(i32 %0, i32 %1) comdat {
  %3 = add nsw i32 %1, %0
  ret i32 %3
}
```
The sections for foocomdat will have a suffix on mingw.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92073/new/

https://reviews.llvm.org/D92073



More information about the llvm-commits mailing list