[llvm-branch-commits] [clang] release/18.x: [clang] Don't assume location of compiler-rt for OpenBSD (#92183) (PR #92293)

2024-05-19 Thread A. Tammy via llvm-branch-commits

epsilon-0 wrote:

Late to the party, but it looks good from my side :)

https://github.com/llvm/llvm-project/pull/92293
___
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] [TypeProf][IndirectCallPromotion]Implement vtable-based transformation (PR #81442)

2024-05-19 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 edited 
https://github.com/llvm/llvm-project/pull/81442
___
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] [Serialization] No transitive identifier change (PR #92085)

2024-05-19 Thread Chuanqi Xu via llvm-branch-commits

ChuanqiXu9 wrote:

@jansvoboda11 @Bigcheese gentle ping

https://github.com/llvm/llvm-project/pull/92085
___
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] [serialization] No transitive type change (PR #92511)

2024-05-19 Thread Chuanqi Xu via llvm-branch-commits

ChuanqiXu9 wrote:

@jansvoboda11 @Bigcheese gentle ping

https://github.com/llvm/llvm-project/pull/92511
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/92713

If __hot_start marker aliases split function, we create non-sensical
__hot_start.cold symbols. Similar to how hot markers are ignored when
reading symbol table, explicitly ignore them as function references in
updating the symbol table and only update their values.

Test Plan: updated hot-end-symbol.s



___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/92713

>From a32bf63f61f6d382f09982d992f3cabc8dc55cfd Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Sun, 19 May 2024 19:44:20 -0700
Subject: [PATCH] drop changes to bolt/test/AArch64/text-data.c

Created using spr 1.3.4
---
 bolt/test/AArch64/text-data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/test/AArch64/text-data.c b/bolt/test/AArch64/text-data.c
index 17e507a7cc1b4..2986fe7840078 100644
--- a/bolt/test/AArch64/text-data.c
+++ b/bolt/test/AArch64/text-data.c
@@ -3,7 +3,7 @@
 
 // RUN: %clang %cflags %s -o %t.exe -Wl,-q
 // RUN: llvm-bolt %t.exe -o %t.bolt --lite=0 --use-old-text=0
-// RUN: llvm-objdump -j .bolt.org.text -d --disassemble-symbols=arr %t.bolt | \
+// RUN: llvm-objdump -j .text -d --disassemble-symbols=arr %t.bolt | \
 // RUN:   FileCheck %s
 
 // CHECK: {{.*}} :

___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

If __hot_start marker aliases split function, we create non-sensical
__hot_start.cold symbols. Similar to how hot markers are ignored when
reading symbol table, explicitly ignore them as function references in
updating the symbol table and only update their values.

Test Plan: updated hot-end-symbol.s


---
Full diff: https://github.com/llvm/llvm-project/pull/92713.diff


2 Files Affected:

- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+9-2) 
- (modified) bolt/test/runtime/X86/hot-end-symbol.s (+3-2) 


``diff
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index fa5167490923c..0d11bdc46fa5a 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -4788,6 +4788,9 @@ void RewriteInstance::updateELFSymbolTable(
 if (!IsDynSym && shouldStrip(Symbol))
   continue;
 
+Expected SymbolName = Symbol.getName(StringSection);
+assert(SymbolName && "cannot get symbol name");
+
 const BinaryFunction *Function =
 BC->getBinaryFunctionAtAddress(Symbol.st_value);
 // Ignore false function references, e.g. when the section address matches
@@ -4795,6 +4798,12 @@ void RewriteInstance::updateELFSymbolTable(
 if (Function && Symbol.getType() == ELF::STT_SECTION)
   Function = nullptr;
 
+// Ignore input hot markers as function aliases – markers are handled
+// separately.
+if (Function &&
+(*SymbolName == "__hot_start" || *SymbolName == "__hot_end"))
+  Function = nullptr;
+
 // For non-dynamic symtab, make sure the symbol section matches that of
 // the function. It can mismatch e.g. if the symbol is a section marker
 // in which case we treat the symbol separately from the function.
@@ -4906,8 +4915,6 @@ void RewriteInstance::updateELFSymbolTable(
 }
 
 // Handle special symbols based on their name.
-Expected SymbolName = Symbol.getName(StringSection);
-assert(SymbolName && "cannot get symbol name");
 
 auto updateSymbolValue = [&](const StringRef Name,
  std::optional Value = std::nullopt) 
{
diff --git a/bolt/test/runtime/X86/hot-end-symbol.s 
b/bolt/test/runtime/X86/hot-end-symbol.s
index e6d83d77167ac..f973013b1b3de 100755
--- a/bolt/test/runtime/X86/hot-end-symbol.s
+++ b/bolt/test/runtime/X86/hot-end-symbol.s
@@ -12,7 +12,8 @@
 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
 
 # RUN: llvm-bolt %t.exe --relocs=1 --hot-text --reorder-functions=hfsort \
-# RUN:--data %t.fdata -o %t.out | FileCheck %s
+# RUN:--data %t.fdata -o %t.out --split-functions --split-strategy=all \
+# RUN:| FileCheck %s
 
 # RUN: %t.out 1
 
@@ -30,12 +31,12 @@
 # CHECK-OUTPUT:   __hot_start
 # CHECK-OUTPUT-NEXT:  main
 # CHECK-OUTPUT-NEXT:  __hot_end
+# CHECK-OUTPUT-NOT:   __hot_start.cold
 
   .text
   .globl  main
   .type main, %function
   .globl  __hot_start
-  .type __hot_start, %object
   .p2align  4
 main:
 __hot_start:

``




https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Davide Italiano via llvm-branch-commits

https://github.com/dcci requested changes to this pull request.

Some comments, thanks for working o this.

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Davide Italiano via llvm-branch-commits


@@ -4788,13 +4788,22 @@ void RewriteInstance::updateELFSymbolTable(
 if (!IsDynSym && shouldStrip(Symbol))
   continue;
 
+Expected SymbolName = Symbol.getName(StringSection);
+assert(SymbolName && "cannot get symbol name");
+
 const BinaryFunction *Function =
 BC->getBinaryFunctionAtAddress(Symbol.st_value);
 // Ignore false function references, e.g. when the section address matches
 // the address of the function.
 if (Function && Symbol.getType() == ELF::STT_SECTION)
   Function = nullptr;
 
+// Ignore input hot markers as function aliases – markers are handled
+// separately.
+if (Function &&
+(*SymbolName == "__hot_start" || *SymbolName == "__hot_end"))

dcci wrote:

can you expand this comment -- explaining why we ignore input hot markers?

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Davide Italiano via llvm-branch-commits


@@ -30,12 +31,12 @@
 # CHECK-OUTPUT:   __hot_start
 # CHECK-OUTPUT-NEXT:  main
 # CHECK-OUTPUT-NEXT:  __hot_end
+# CHECK-OUTPUT-NOT:   __hot_start.cold
 
   .text
   .globl  main
   .type main, %function
   .globl  __hot_start
-  .type __hot_start, %object

dcci wrote:

why are you removing this?

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Davide Italiano via llvm-branch-commits


@@ -4788,13 +4788,22 @@ void RewriteInstance::updateELFSymbolTable(
 if (!IsDynSym && shouldStrip(Symbol))
   continue;
 
+Expected SymbolName = Symbol.getName(StringSection);
+assert(SymbolName && "cannot get symbol name");

dcci wrote:

is this assert needed? if Expected returns null, it will blow up, no?

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Davide Italiano via llvm-branch-commits

https://github.com/dcci edited https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits


@@ -4788,13 +4788,22 @@ void RewriteInstance::updateELFSymbolTable(
 if (!IsDynSym && shouldStrip(Symbol))
   continue;
 
+Expected SymbolName = Symbol.getName(StringSection);
+assert(SymbolName && "cannot get symbol name");

aaupov wrote:

Not really. Let me drop it. Yes, Expected will blow up upon null access, and 
the assertion message is not more insightful than SymbolName variable itself.

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits


@@ -30,12 +31,12 @@
 # CHECK-OUTPUT:   __hot_start
 # CHECK-OUTPUT-NEXT:  main
 # CHECK-OUTPUT-NEXT:  __hot_end
+# CHECK-OUTPUT-NOT:   __hot_start.cold
 
   .text
   .globl  main
   .type main, %function
   .globl  __hot_start
-  .type __hot_start, %object

aaupov wrote:

If __hot_start has `%object` type, it will be an absolute symbol and won't 
belong to .text section. When updating function symbols, we check that symbol 
section matches that of the function. So we need hot_start to be a global 
symbol in `.text` section.

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/92713

>From a32bf63f61f6d382f09982d992f3cabc8dc55cfd Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Sun, 19 May 2024 19:44:20 -0700
Subject: [PATCH 1/2] drop changes to bolt/test/AArch64/text-data.c

Created using spr 1.3.4
---
 bolt/test/AArch64/text-data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/test/AArch64/text-data.c b/bolt/test/AArch64/text-data.c
index 17e507a7cc1b4..2986fe7840078 100644
--- a/bolt/test/AArch64/text-data.c
+++ b/bolt/test/AArch64/text-data.c
@@ -3,7 +3,7 @@
 
 // RUN: %clang %cflags %s -o %t.exe -Wl,-q
 // RUN: llvm-bolt %t.exe -o %t.bolt --lite=0 --use-old-text=0
-// RUN: llvm-objdump -j .bolt.org.text -d --disassemble-symbols=arr %t.bolt | \
+// RUN: llvm-objdump -j .text -d --disassemble-symbols=arr %t.bolt | \
 // RUN:   FileCheck %s
 
 // CHECK: {{.*}} :

>From d09b18df4eb75879ef528bfcb43604b86d56860c Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Sun, 19 May 2024 20:13:19 -0700
Subject: [PATCH 2/2] Address comments

Created using spr 1.3.4
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index 0d11bdc46fa5a..ba5cec7d9c596 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -4789,7 +4789,6 @@ void RewriteInstance::updateELFSymbolTable(
   continue;
 
 Expected SymbolName = Symbol.getName(StringSection);
-assert(SymbolName && "cannot get symbol name");
 
 const BinaryFunction *Function =
 BC->getBinaryFunctionAtAddress(Symbol.st_value);
@@ -4798,8 +4797,11 @@ void RewriteInstance::updateELFSymbolTable(
 if (Function && Symbol.getType() == ELF::STT_SECTION)
   Function = nullptr;
 
-// Ignore input hot markers as function aliases – markers are handled
-// separately.
+// Ignore input hot markers as function aliases.
+// If hot markers are treated as function aliases, we may create
+// non-sensical __hot_start.cold symbols which would not have a parent
+// when read by BOLT as we don't register them as function aliases
+// (explicitly ignored in parsing symbol table in discoverFileObjects).
 if (Function &&
 (*SymbolName == "__hot_start" || *SymbolName == "__hot_end"))
   Function = nullptr;

___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Davide Italiano via llvm-branch-commits

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

LG

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits


@@ -4788,13 +4788,22 @@ void RewriteInstance::updateELFSymbolTable(
 if (!IsDynSym && shouldStrip(Symbol))
   continue;
 
+Expected SymbolName = Symbol.getName(StringSection);
+assert(SymbolName && "cannot get symbol name");

aaupov wrote:

> Expected values in success mode must still be checked prior to being 
> destroyed

So we must keep the assertion.

https://github.com/llvm/llvm-project/pull/92713
___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/92713

>From a32bf63f61f6d382f09982d992f3cabc8dc55cfd Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Sun, 19 May 2024 19:44:20 -0700
Subject: [PATCH 1/3] drop changes to bolt/test/AArch64/text-data.c

Created using spr 1.3.4
---
 bolt/test/AArch64/text-data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/test/AArch64/text-data.c b/bolt/test/AArch64/text-data.c
index 17e507a7cc1b4..2986fe7840078 100644
--- a/bolt/test/AArch64/text-data.c
+++ b/bolt/test/AArch64/text-data.c
@@ -3,7 +3,7 @@
 
 // RUN: %clang %cflags %s -o %t.exe -Wl,-q
 // RUN: llvm-bolt %t.exe -o %t.bolt --lite=0 --use-old-text=0
-// RUN: llvm-objdump -j .bolt.org.text -d --disassemble-symbols=arr %t.bolt | \
+// RUN: llvm-objdump -j .text -d --disassemble-symbols=arr %t.bolt | \
 // RUN:   FileCheck %s
 
 // CHECK: {{.*}} :

>From d09b18df4eb75879ef528bfcb43604b86d56860c Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Sun, 19 May 2024 20:13:19 -0700
Subject: [PATCH 2/3] Address comments

Created using spr 1.3.4
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index 0d11bdc46fa5a..ba5cec7d9c596 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -4789,7 +4789,6 @@ void RewriteInstance::updateELFSymbolTable(
   continue;
 
 Expected SymbolName = Symbol.getName(StringSection);
-assert(SymbolName && "cannot get symbol name");
 
 const BinaryFunction *Function =
 BC->getBinaryFunctionAtAddress(Symbol.st_value);
@@ -4798,8 +4797,11 @@ void RewriteInstance::updateELFSymbolTable(
 if (Function && Symbol.getType() == ELF::STT_SECTION)
   Function = nullptr;
 
-// Ignore input hot markers as function aliases – markers are handled
-// separately.
+// Ignore input hot markers as function aliases.
+// If hot markers are treated as function aliases, we may create
+// non-sensical __hot_start.cold symbols which would not have a parent
+// when read by BOLT as we don't register them as function aliases
+// (explicitly ignored in parsing symbol table in discoverFileObjects).
 if (Function &&
 (*SymbolName == "__hot_start" || *SymbolName == "__hot_end"))
   Function = nullptr;

>From b36c250836607410246e6ddf2f855d43df77e80d Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Sun, 19 May 2024 20:17:15 -0700
Subject: [PATCH 3/3] keep assert

Created using spr 1.3.4
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index ba5cec7d9c596..e788ca7afd5ad 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -4789,6 +4789,7 @@ void RewriteInstance::updateELFSymbolTable(
   continue;
 
 Expected SymbolName = Symbol.getName(StringSection);
+assert(SymbolName && "cannot get symbol name");
 
 const BinaryFunction *Function =
 BC->getBinaryFunctionAtAddress(Symbol.st_value);

___
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] [BOLT] Ignore hot markers as function references in updateELFSymbolTable (PR #92713)

2024-05-19 Thread Davide Italiano via llvm-branch-commits


@@ -4788,13 +4788,22 @@ void RewriteInstance::updateELFSymbolTable(
 if (!IsDynSym && shouldStrip(Symbol))
   continue;
 
+Expected SymbolName = Symbol.getName(StringSection);
+assert(SymbolName && "cannot get symbol name");

dcci wrote:

SG

https://github.com/llvm/llvm-project/pull/92713
___
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] [ThinLTO][Bitcode] Generate import type in bitcode (PR #87600)

2024-05-19 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 converted_to_draft 
https://github.com/llvm/llvm-project/pull/87600
___
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] [ThinLTO][Bitcode] Generate import type in bitcode (PR #87600)

2024-05-19 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 edited 
https://github.com/llvm/llvm-project/pull/87600
___
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] [ThinLTO][Bitcode] Generate import type in bitcode (PR #87600)

2024-05-19 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 edited 
https://github.com/llvm/llvm-project/pull/87600
___
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] 45257fc - Revert "[ThinLTO] Populate declaration import status except for distributed T…"

2024-05-19 Thread via llvm-branch-commits

Author: Mingming Liu
Date: 2024-05-19T22:41:50-07:00
New Revision: 45257fcc3f5c86c406a723d8b87192d5c9ca8b4c

URL: 
https://github.com/llvm/llvm-project/commit/45257fcc3f5c86c406a723d8b87192d5c9ca8b4c
DIFF: 
https://github.com/llvm/llvm-project/commit/45257fcc3f5c86c406a723d8b87192d5c9ca8b4c.diff

LOG: Revert "[ThinLTO] Populate declaration import status except for 
distributed T…"

This reverts commit 8de7890572296830b27b6e6db39b36810bc98c31.

Added: 


Modified: 
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/include/llvm/Transforms/IPO/FunctionImport.h
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/test/ThinLTO/X86/funcimport-stats.ll
llvm/test/Transforms/FunctionImport/funcimport.ll
llvm/tools/llvm-link/llvm-link.cpp

Removed: 
llvm/test/ThinLTO/X86/import_callee_declaration.ll



diff  --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index a6bb261af7522..5d137d4b3553c 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -587,10 +587,6 @@ class GlobalValueSummary {
 
   void setImportKind(ImportKind IK) { Flags.ImportType = IK; }
 
-  GlobalValueSummary::ImportKind importType() const {
-return static_cast(Flags.ImportType);
-  }
-
   GlobalValue::VisibilityTypes getVisibility() const {
 return (GlobalValue::VisibilityTypes)Flags.Visibility;
   }
@@ -1276,9 +1272,6 @@ using ModulePathStringTableTy = StringMap;
 /// a particular module, and provide efficient access to their summary.
 using GVSummaryMapTy = DenseMap;
 
-/// A set of global value summary pointers.
-using GVSummaryPtrSet = SmallPtrSet;
-
 /// Map of a type GUID to type id string and summary (multimap used
 /// in case of GUID conflicts).
 using TypeIdSummaryMapTy =

diff  --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h 
b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index 024bba8105b89..c4d19e8641eca 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -31,9 +31,9 @@ class Module;
 /// based on the provided summary informations.
 class FunctionImporter {
 public:
-  /// The functions to import from a source module and their import type.
-  using FunctionsToImportTy =
-  DenseMap;
+  /// Set of functions to import from a source module. Each entry is a set
+  /// containing all the GUIDs of all functions to import for a source module.
+  using FunctionsToImportTy = std::unordered_set;
 
   /// The 
diff erent reasons selectCallee will chose not to import a
   /// candidate.
@@ -99,13 +99,8 @@ class FunctionImporter {
   /// index's module path string table).
   using ImportMapTy = DenseMap;
 
-  /// The map contains an entry for every global value the module exports.
-  /// The key is ValueInfo, and the value indicates whether the definition
-  /// or declaration is visible to another module. If a function's definition 
is
-  /// visible to other modules, the global values this function referenced are
-  /// visible and shouldn't be internalized.
-  /// TODO: Rename to `ExportMapTy`.
-  using ExportSetTy = DenseMap;
+  /// The set contains an entry for every global value the module exports.
+  using ExportSetTy = DenseSet;
 
   /// A function of this type is used to load modules referenced by the index.
   using ModuleLoaderTy =

diff  --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index e2754d74979e8..5c603ac6ab472 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -121,9 +121,6 @@ void llvm::computeLTOCacheKey(
 support::endian::write64le(Data, I);
 Hasher.update(Data);
   };
-  auto AddUint8 = [&](const uint8_t I) {
-Hasher.update(ArrayRef((const uint8_t *)&I, 1));
-  };
   AddString(Conf.CPU);
   // FIXME: Hash more of Options. For now all clients initialize Options from
   // command-line flags (which is unsupported in production), but may set
@@ -159,18 +156,18 @@ void llvm::computeLTOCacheKey(
   auto ModHash = Index.getModuleHash(ModuleID);
   Hasher.update(ArrayRef((uint8_t *)&ModHash[0], sizeof(ModHash)));
 
-  std::vector> ExportsGUID;
+  std::vector ExportsGUID;
   ExportsGUID.reserve(ExportList.size());
-  for (const auto &[VI, ExportType] : ExportList)
-ExportsGUID.push_back(
-std::make_pair(VI.getGUID(), static_cast(ExportType)));
+  for (const auto &VI : ExportList) {
+auto GUID = VI.getGUID();
+ExportsGUID.push_back(GUID);
+  }
 
   // Sort the export list elements GUIDs.
   llvm::sort(ExportsGUID);
-  for (auto [GUID, ExportType] : ExportsGUID) {
+  for (uint64_t GUID : ExportsGUID) {
 // The export list can impact the internalization, be conservative here
 Hasher.update(ArrayRef((uint8_t *)&GUID, sizeof(GUID)));
-AddUint8(ExportType);
   }
 
   // Include the hash for every module we import functions from

[llvm-branch-commits] [llvm] 45257fc - Revert "[ThinLTO] Populate declaration import status except for distributed T…"

2024-05-19 Thread via llvm-branch-commits

Author: Mingming Liu
Date: 2024-05-19T22:41:50-07:00
New Revision: 45257fcc3f5c86c406a723d8b87192d5c9ca8b4c

URL: 
https://github.com/llvm/llvm-project/commit/45257fcc3f5c86c406a723d8b87192d5c9ca8b4c
DIFF: 
https://github.com/llvm/llvm-project/commit/45257fcc3f5c86c406a723d8b87192d5c9ca8b4c.diff

LOG: Revert "[ThinLTO] Populate declaration import status except for 
distributed T…"

This reverts commit 8de7890572296830b27b6e6db39b36810bc98c31.

Added: 


Modified: 
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/include/llvm/Transforms/IPO/FunctionImport.h
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/test/ThinLTO/X86/funcimport-stats.ll
llvm/test/Transforms/FunctionImport/funcimport.ll
llvm/tools/llvm-link/llvm-link.cpp

Removed: 
llvm/test/ThinLTO/X86/import_callee_declaration.ll



diff  --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index a6bb261af7522..5d137d4b3553c 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -587,10 +587,6 @@ class GlobalValueSummary {
 
   void setImportKind(ImportKind IK) { Flags.ImportType = IK; }
 
-  GlobalValueSummary::ImportKind importType() const {
-return static_cast(Flags.ImportType);
-  }
-
   GlobalValue::VisibilityTypes getVisibility() const {
 return (GlobalValue::VisibilityTypes)Flags.Visibility;
   }
@@ -1276,9 +1272,6 @@ using ModulePathStringTableTy = StringMap;
 /// a particular module, and provide efficient access to their summary.
 using GVSummaryMapTy = DenseMap;
 
-/// A set of global value summary pointers.
-using GVSummaryPtrSet = SmallPtrSet;
-
 /// Map of a type GUID to type id string and summary (multimap used
 /// in case of GUID conflicts).
 using TypeIdSummaryMapTy =

diff  --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h 
b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index 024bba8105b89..c4d19e8641eca 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -31,9 +31,9 @@ class Module;
 /// based on the provided summary informations.
 class FunctionImporter {
 public:
-  /// The functions to import from a source module and their import type.
-  using FunctionsToImportTy =
-  DenseMap;
+  /// Set of functions to import from a source module. Each entry is a set
+  /// containing all the GUIDs of all functions to import for a source module.
+  using FunctionsToImportTy = std::unordered_set;
 
   /// The 
diff erent reasons selectCallee will chose not to import a
   /// candidate.
@@ -99,13 +99,8 @@ class FunctionImporter {
   /// index's module path string table).
   using ImportMapTy = DenseMap;
 
-  /// The map contains an entry for every global value the module exports.
-  /// The key is ValueInfo, and the value indicates whether the definition
-  /// or declaration is visible to another module. If a function's definition 
is
-  /// visible to other modules, the global values this function referenced are
-  /// visible and shouldn't be internalized.
-  /// TODO: Rename to `ExportMapTy`.
-  using ExportSetTy = DenseMap;
+  /// The set contains an entry for every global value the module exports.
+  using ExportSetTy = DenseSet;
 
   /// A function of this type is used to load modules referenced by the index.
   using ModuleLoaderTy =

diff  --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index e2754d74979e8..5c603ac6ab472 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -121,9 +121,6 @@ void llvm::computeLTOCacheKey(
 support::endian::write64le(Data, I);
 Hasher.update(Data);
   };
-  auto AddUint8 = [&](const uint8_t I) {
-Hasher.update(ArrayRef((const uint8_t *)&I, 1));
-  };
   AddString(Conf.CPU);
   // FIXME: Hash more of Options. For now all clients initialize Options from
   // command-line flags (which is unsupported in production), but may set
@@ -159,18 +156,18 @@ void llvm::computeLTOCacheKey(
   auto ModHash = Index.getModuleHash(ModuleID);
   Hasher.update(ArrayRef((uint8_t *)&ModHash[0], sizeof(ModHash)));
 
-  std::vector> ExportsGUID;
+  std::vector ExportsGUID;
   ExportsGUID.reserve(ExportList.size());
-  for (const auto &[VI, ExportType] : ExportList)
-ExportsGUID.push_back(
-std::make_pair(VI.getGUID(), static_cast(ExportType)));
+  for (const auto &VI : ExportList) {
+auto GUID = VI.getGUID();
+ExportsGUID.push_back(GUID);
+  }
 
   // Sort the export list elements GUIDs.
   llvm::sort(ExportsGUID);
-  for (auto [GUID, ExportType] : ExportsGUID) {
+  for (uint64_t GUID : ExportsGUID) {
 // The export list can impact the internalization, be conservative here
 Hasher.update(ArrayRef((uint8_t *)&GUID, sizeof(GUID)));
-AddUint8(ExportType);
   }
 
   // Include the hash for every module we import functions from

[llvm-branch-commits] [llvm] a122660 - Revert "Revert "[ThinLTO] Populate declaration import status except for distr…"

2024-05-19 Thread via llvm-branch-commits

Author: Mingming Liu
Date: 2024-05-19T22:43:55-07:00
New Revision: a122660b97848488c1108716c1aa63eb3835f6c6

URL: 
https://github.com/llvm/llvm-project/commit/a122660b97848488c1108716c1aa63eb3835f6c6
DIFF: 
https://github.com/llvm/llvm-project/commit/a122660b97848488c1108716c1aa63eb3835f6c6.diff

LOG: Revert "Revert "[ThinLTO] Populate declaration import status except for 
distr…"

This reverts commit 6b0733e3a35350679ea9c6056ecd28652d99017f.

Added: 
llvm/test/ThinLTO/X86/import_callee_declaration.ll

Modified: 
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/include/llvm/Transforms/IPO/FunctionImport.h
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/test/ThinLTO/X86/funcimport-stats.ll
llvm/test/Transforms/FunctionImport/funcimport.ll
llvm/tools/llvm-link/llvm-link.cpp

Removed: 




diff  --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 5d137d4b3553c..a6bb261af7522 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -587,6 +587,10 @@ class GlobalValueSummary {
 
   void setImportKind(ImportKind IK) { Flags.ImportType = IK; }
 
+  GlobalValueSummary::ImportKind importType() const {
+return static_cast(Flags.ImportType);
+  }
+
   GlobalValue::VisibilityTypes getVisibility() const {
 return (GlobalValue::VisibilityTypes)Flags.Visibility;
   }
@@ -1272,6 +1276,9 @@ using ModulePathStringTableTy = StringMap;
 /// a particular module, and provide efficient access to their summary.
 using GVSummaryMapTy = DenseMap;
 
+/// A set of global value summary pointers.
+using GVSummaryPtrSet = SmallPtrSet;
+
 /// Map of a type GUID to type id string and summary (multimap used
 /// in case of GUID conflicts).
 using TypeIdSummaryMapTy =

diff  --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h 
b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index c4d19e8641eca..024bba8105b89 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -31,9 +31,9 @@ class Module;
 /// based on the provided summary informations.
 class FunctionImporter {
 public:
-  /// Set of functions to import from a source module. Each entry is a set
-  /// containing all the GUIDs of all functions to import for a source module.
-  using FunctionsToImportTy = std::unordered_set;
+  /// The functions to import from a source module and their import type.
+  using FunctionsToImportTy =
+  DenseMap;
 
   /// The 
diff erent reasons selectCallee will chose not to import a
   /// candidate.
@@ -99,8 +99,13 @@ class FunctionImporter {
   /// index's module path string table).
   using ImportMapTy = DenseMap;
 
-  /// The set contains an entry for every global value the module exports.
-  using ExportSetTy = DenseSet;
+  /// The map contains an entry for every global value the module exports.
+  /// The key is ValueInfo, and the value indicates whether the definition
+  /// or declaration is visible to another module. If a function's definition 
is
+  /// visible to other modules, the global values this function referenced are
+  /// visible and shouldn't be internalized.
+  /// TODO: Rename to `ExportMapTy`.
+  using ExportSetTy = DenseMap;
 
   /// A function of this type is used to load modules referenced by the index.
   using ModuleLoaderTy =

diff  --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 5c603ac6ab472..e2754d74979e8 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -121,6 +121,9 @@ void llvm::computeLTOCacheKey(
 support::endian::write64le(Data, I);
 Hasher.update(Data);
   };
+  auto AddUint8 = [&](const uint8_t I) {
+Hasher.update(ArrayRef((const uint8_t *)&I, 1));
+  };
   AddString(Conf.CPU);
   // FIXME: Hash more of Options. For now all clients initialize Options from
   // command-line flags (which is unsupported in production), but may set
@@ -156,18 +159,18 @@ void llvm::computeLTOCacheKey(
   auto ModHash = Index.getModuleHash(ModuleID);
   Hasher.update(ArrayRef((uint8_t *)&ModHash[0], sizeof(ModHash)));
 
-  std::vector ExportsGUID;
+  std::vector> ExportsGUID;
   ExportsGUID.reserve(ExportList.size());
-  for (const auto &VI : ExportList) {
-auto GUID = VI.getGUID();
-ExportsGUID.push_back(GUID);
-  }
+  for (const auto &[VI, ExportType] : ExportList)
+ExportsGUID.push_back(
+std::make_pair(VI.getGUID(), static_cast(ExportType)));
 
   // Sort the export list elements GUIDs.
   llvm::sort(ExportsGUID);
-  for (uint64_t GUID : ExportsGUID) {
+  for (auto [GUID, ExportType] : ExportsGUID) {
 // The export list can impact the internalization, be conservative here
 Hasher.update(ArrayRef((uint8_t *)&GUID, sizeof(GUID)));
+AddUint8(ExportType);
   }
 
   // Include the hash for every module we import functions from