From 83c2755e64d9e6492426c967b32c9cf53744b494 Mon Sep 17 00:00:00 2001 From: mingmingl Date: Mon, 25 Nov 2024 09:23:29 -0800 Subject: [PATCH 1/3] [NFC]Update test case --- llvm/test/ThinLTO/X86/distributed_indexes.ll | 4 ++++ llvm/test/ThinLTO/X86/import_callee_declaration.ll | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/llvm/test/ThinLTO/X86/distributed_indexes.ll b/llvm/test/ThinLTO/X86/distributed_indexes.ll index 4f2662b1b34e1..b70342fd0c96f 100644 --- a/llvm/test/ThinLTO/X86/distributed_indexes.ll +++ b/llvm/test/ThinLTO/X86/distributed_indexes.ll @@ -48,6 +48,10 @@ ; RUN: llvm-dis %t1.bc.thinlto.bc -o - | FileCheck %s --check-prefix=DIS ; DIS: aliasee: null +; function-import pass crashed when alias is imported but aliasee doesn't. +; TODO: Import both alias and aliasee, or neither of them. +; RUN: not --crash opt -passes=function-import -summary-file=%t1.bc.thinlto.bc %t1.bc -o /dev/null 2>&1 + target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" declare void @g(...) diff --git a/llvm/test/ThinLTO/X86/import_callee_declaration.ll b/llvm/test/ThinLTO/X86/import_callee_declaration.ll index 246920e5db0dc..96257214c0a1a 100644 --- a/llvm/test/ThinLTO/X86/import_callee_declaration.ll +++ b/llvm/test/ThinLTO/X86/import_callee_declaration.ll @@ -62,6 +62,10 @@ ; these two GUIDs are declaration. ; ; RUN: llvm-dis main.bc.thinlto.bc -o - | FileCheck %s --check-prefix=MAIN-DIS + +; function-import pass crashed when alias is imported but aliasee doesn't. +; TODO: Import both alias and aliasee, or neither of them. +; RUN: not --crash opt -passes=function-import -summary-file=main.bc.thinlto.bc main.bc -o /dev/null 2>&1 ; ; MAIN-DIS: [[LIBMOD:\^[0-9]+]] = module: (path: "lib.bc", hash: (0, 0, 0, 0, 0)) ; MAIN-DIS: gv: (guid: 2418497564662708935, summaries: (function: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), insts: 8, {{.*}}))) From 82cc4aa5f6f24ad63084d22c7d221b33b5ceceb0 Mon Sep 17 00:00:00 2001 From: mingmingl Date: Mon, 2 Dec 2024 14:18:16 -0800 Subject: [PATCH 2/3] Use -import-all-index to do backend compile and update distributed_indexes.ll. Revert changes to import_callee_declaration.ll --- llvm/test/ThinLTO/X86/distributed_indexes.ll | 5 ++++- llvm/test/ThinLTO/X86/import_callee_declaration.ll | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/test/ThinLTO/X86/distributed_indexes.ll b/llvm/test/ThinLTO/X86/distributed_indexes.ll index b70342fd0c96f..91ad48cfff04a 100644 --- a/llvm/test/ThinLTO/X86/distributed_indexes.ll +++ b/llvm/test/ThinLTO/X86/distributed_indexes.ll @@ -50,7 +50,10 @@ ; function-import pass crashed when alias is imported but aliasee doesn't. ; TODO: Import both alias and aliasee, or neither of them. -; RUN: not --crash opt -passes=function-import -summary-file=%t1.bc.thinlto.bc %t1.bc -o /dev/null 2>&1 +; RUN: opt -passes=function-import -import-all-index -summary-file=%t1.bc.thinlto.bc %t1.bc -S -o - 2>&1 | FileCheck %s --check-prefix=IR + +; Tests that analias definition is imported. +; IR: define available_externally void @analias target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" diff --git a/llvm/test/ThinLTO/X86/import_callee_declaration.ll b/llvm/test/ThinLTO/X86/import_callee_declaration.ll index 96257214c0a1a..246920e5db0dc 100644 --- a/llvm/test/ThinLTO/X86/import_callee_declaration.ll +++ b/llvm/test/ThinLTO/X86/import_callee_declaration.ll @@ -62,10 +62,6 @@ ; these two GUIDs are declaration. ; ; RUN: llvm-dis main.bc.thinlto.bc -o - | FileCheck %s --check-prefix=MAIN-DIS - -; function-import pass crashed when alias is imported but aliasee doesn't. -; TODO: Import both alias and aliasee, or neither of them. -; RUN: not --crash opt -passes=function-import -summary-file=main.bc.thinlto.bc main.bc -o /dev/null 2>&1 ; ; MAIN-DIS: [[LIBMOD:\^[0-9]+]] = module: (path: "lib.bc", hash: (0, 0, 0, 0, 0)) ; MAIN-DIS: gv: (guid: 2418497564662708935, summaries: (function: (module: [[LIBMOD]], flags: ({{.*}} importType: declaration), insts: 8, {{.*}}))) From 89b994b8bb96cb30fba25ab380428f16263fdddd Mon Sep 17 00:00:00 2001 From: mingmingl Date: Mon, 2 Dec 2024 15:01:14 -0800 Subject: [PATCH 3/3] remove outdated comments --- llvm/test/ThinLTO/X86/distributed_indexes.ll | 3 --- 1 file changed, 3 deletions(-) diff --git a/llvm/test/ThinLTO/X86/distributed_indexes.ll b/llvm/test/ThinLTO/X86/distributed_indexes.ll index 91ad48cfff04a..824c582c2025e 100644 --- a/llvm/test/ThinLTO/X86/distributed_indexes.ll +++ b/llvm/test/ThinLTO/X86/distributed_indexes.ll @@ -48,10 +48,7 @@ ; RUN: llvm-dis %t1.bc.thinlto.bc -o - | FileCheck %s --check-prefix=DIS ; DIS: aliasee: null -; function-import pass crashed when alias is imported but aliasee doesn't. -; TODO: Import both alias and aliasee, or neither of them. ; RUN: opt -passes=function-import -import-all-index -summary-file=%t1.bc.thinlto.bc %t1.bc -S -o - 2>&1 | FileCheck %s --check-prefix=IR - ; Tests that analias definition is imported. ; IR: define available_externally void @analias