From 8e6493db9162d4143f8a129ac25d345e0b91e62f Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Thu, 12 Nov 2015 19:31:46 +0000 Subject: [PATCH] [ThinLTO] Update test to be more tolerant of ordering changes Update the ThinLTO function importing test to use DAG forms of checks so that it is more tolerant of changes to relative ordering between imported decls/defs. This reduces the number of changes required by the comdat importing patch I am sending for review shortly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252932 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Linker/funcimport.ll | 80 +++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/test/Linker/funcimport.ll b/test/Linker/funcimport.ll index 2efbc29f5d3..dad9b95bb9f 100644 --- a/test/Linker/funcimport.ll +++ b/test/Linker/funcimport.ll @@ -6,11 +6,11 @@ ; Ensure statics are promoted/renamed correctly from this file (all but ; constant variable need promotion). ; RUN: llvm-link %t.bc -functionindex=%t3.thinlto.bc -S | FileCheck %s --check-prefix=EXPORTSTATIC -; EXPORTSTATIC: @staticvar.llvm.1 = hidden global -; EXPORTSTATIC: @staticconstvar = internal unnamed_addr constant -; EXPORTSTATIC: @P.llvm.1 = hidden global void ()* null -; EXPORTSTATIC: define hidden i32 @staticfunc.llvm.1 -; EXPORTSTATIC: define hidden void @staticfunc2.llvm.1 +; EXPORTSTATIC-DAG: @staticvar.llvm.1 = hidden global +; EXPORTSTATIC-DAG: @staticconstvar = internal unnamed_addr constant +; EXPORTSTATIC-DAG: @P.llvm.1 = hidden global void ()* null +; EXPORTSTATIC-DAG: define hidden i32 @staticfunc.llvm.1 +; EXPORTSTATIC-DAG: define hidden void @staticfunc2.llvm.1 ; Ensure that both weak alias to an imported function and strong alias to a ; non-imported function are correctly turned into declarations. @@ -18,76 +18,76 @@ ; and that the associated linkonce function is not in the output, as it is ; lazily linked and never referenced/materialized. ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc1:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB1 -; IMPORTGLOB1: define available_externally void @globalfunc1 -; IMPORTGLOB1: declare void @globalfunc2 -; IMPORTGLOB1: declare extern_weak void @weakalias -; IMPORTGLOB1: declare void @analias -; IMPORTGLOB1: declare void @linkoncealias +; IMPORTGLOB1-DAG: define available_externally void @globalfunc1 +; IMPORTGLOB1-DAG: declare void @globalfunc2 +; IMPORTGLOB1-DAG: declare extern_weak void @weakalias +; IMPORTGLOB1-DAG: declare void @analias +; IMPORTGLOB1-DAG: declare void @linkoncealias ; IMPORTGLOB1-NOT: @linkoncefunc ; Ensure that weak alias to a non-imported function is correctly ; turned into a declaration, but that strong alias to an imported function ; is imported as alias. ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc2:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB2 -; IMPORTGLOB2: @analias = alias void (...), bitcast (void ()* @globalfunc2 -; IMPORTGLOB2: declare void @globalfunc1 -; IMPORTGLOB2: define available_externally void @globalfunc2 -; IMPORTGLOB2: declare extern_weak void @weakalias +; IMPORTGLOB2-DAG: @analias = alias void (...), bitcast (void ()* @globalfunc2 +; IMPORTGLOB2-DAG: declare void @globalfunc1 +; IMPORTGLOB2-DAG: define available_externally void @globalfunc2 +; IMPORTGLOB2-DAG: declare extern_weak void @weakalias ; Ensure that strong alias imported in second pass of importing ends up ; as an alias. ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc1:%t.bc -import=globalfunc2:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB3 -; IMPORTGLOB3: @analias = alias void (...), bitcast (void ()* @globalfunc2 -; IMPORTGLOB3: define available_externally void @globalfunc1 -; IMPORTGLOB3: define available_externally void @globalfunc2 -; IMPORTGLOB3: declare extern_weak void @weakalias +; IMPORTGLOB3-DAG: @analias = alias void (...), bitcast (void ()* @globalfunc2 +; IMPORTGLOB3-DAG: define available_externally void @globalfunc1 +; IMPORTGLOB3-DAG: define available_externally void @globalfunc2 +; IMPORTGLOB3-DAG: declare extern_weak void @weakalias ; Ensure that strong alias imported in first pass of importing ends up ; as an alias, and that seeing the alias definition during a second inlining ; pass is handled correctly. ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc2:%t.bc -import=globalfunc1:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB4 -; IMPORTGLOB4: @analias = alias void (...), bitcast (void ()* @globalfunc2 -; IMPORTGLOB4: define available_externally void @globalfunc2 -; IMPORTGLOB4: define available_externally void @globalfunc1 -; IMPORTGLOB4: declare extern_weak void @weakalias +; IMPORTGLOB4-DAG: @analias = alias void (...), bitcast (void ()* @globalfunc2 +; IMPORTGLOB4-DAG: define available_externally void @globalfunc2 +; IMPORTGLOB4-DAG: define available_externally void @globalfunc1 +; IMPORTGLOB4-DAG: declare extern_weak void @weakalias ; Ensure that imported static variable and function references are correctly ; promoted and renamed (including static constant variable). ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=referencestatics:%t.bc -S | FileCheck %s --check-prefix=IMPORTSTATIC -; IMPORTSTATIC: @staticvar.llvm.1 = available_externally hidden global -; IMPORTSTATIC: @staticconstvar.llvm.1 = internal unnamed_addr constant -; IMPORTSTATIC: define available_externally i32 @referencestatics -; IMPORTSTATIC: %call = call i32 @staticfunc.llvm.1 -; IMPORTSTATIC: %0 = load i32, i32* @staticvar.llvm.1 -; IMPORTSTATIC: declare hidden i32 @staticfunc.llvm.1 +; IMPORTSTATIC-DAG: @staticvar.llvm.1 = available_externally hidden global +; IMPORTSTATIC-DAG: @staticconstvar.llvm.1 = internal unnamed_addr constant +; IMPORTSTATIC-DAG: define available_externally i32 @referencestatics +; IMPORTSTATIC-DAG: %call = call i32 @staticfunc.llvm.1 +; IMPORTSTATIC-DAG: %0 = load i32, i32* @staticvar.llvm.1 +; IMPORTSTATIC-DAG: declare hidden i32 @staticfunc.llvm.1 ; Ensure that imported global (external) function and variable references ; are handled correctly (including referenced variable imported as ; available_externally definition) ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=referenceglobals:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOBALS -; IMPORTGLOBALS: @globalvar = available_externally global -; IMPORTGLOBALS: declare void @globalfunc1() -; IMPORTGLOBALS: define available_externally i32 @referenceglobals +; IMPORTGLOBALS-DAG: @globalvar = available_externally global +; IMPORTGLOBALS-DAG: declare void @globalfunc1() +; IMPORTGLOBALS-DAG: define available_externally i32 @referenceglobals ; Ensure that common variable correctly imported as common defition. ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=referencecommon:%t.bc -S | FileCheck %s --check-prefix=IMPORTCOMMON -; IMPORTCOMMON: @commonvar = common global -; IMPORTCOMMON: define available_externally i32 @referencecommon +; IMPORTCOMMON-DAG: @commonvar = common global +; IMPORTCOMMON-DAG: define available_externally i32 @referencecommon ; Ensure that imported static function pointer correctly promoted and renamed. ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=callfuncptr:%t.bc -S | FileCheck %s --check-prefix=IMPORTFUNCPTR -; IMPORTFUNCPTR: @P.llvm.1 = available_externally hidden global void ()* null -; IMPORTFUNCPTR: define available_externally void @callfuncptr -; IMPORTFUNCPTR: %0 = load void ()*, void ()** @P.llvm.1 +; IMPORTFUNCPTR-DAG: @P.llvm.1 = available_externally hidden global void ()* null +; IMPORTFUNCPTR-DAG: define available_externally void @callfuncptr +; IMPORTFUNCPTR-DAG: %0 = load void ()*, void ()** @P.llvm.1 ; Ensure that imported weak function reference/definition handled properly. ; Imported weak_any definition should be skipped with warning, and imported ; reference should turned into an external_weak declaration. ; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=callweakfunc:%t.bc -import=weakfunc:%t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORTWEAKFUNC -; IMPORTWEAKFUNC: Ignoring import request for weak-any function weakfunc -; IMPORTWEAKFUNC: @weakvar = extern_weak global i32, align 4 -; IMPORTWEAKFUNC: declare extern_weak void @weakfunc -; IMPORTWEAKFUNC: define available_externally void @callweakfunc +; IMPORTWEAKFUNC-DAG: Ignoring import request for weak-any function weakfunc +; IMPORTWEAKFUNC-DAG: @weakvar = extern_weak global i32, align 4 +; IMPORTWEAKFUNC-DAG: declare extern_weak void @weakfunc +; IMPORTWEAKFUNC-DAG: define available_externally void @callweakfunc @globalvar = global i32 1, align 4 @staticvar = internal global i32 1, align 4 -- 2.34.1