diff options
author | Eric Christopher <echristo@gmail.com> | 2019-04-17 02:12:23 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2019-04-17 02:12:23 +0000 |
commit | a86343512845c9c1fdbac865fea88aa5fce7142a (patch) | |
tree | 666fc6353de19ad8b00e56b67edd33f24104e4a7 /llvm/test/Transforms/MergeFunc | |
parent | 7f8ca6e3679b3af951cb7a4b1377edfaa3244b93 (diff) | |
download | bcm5719-llvm-a86343512845c9c1fdbac865fea88aa5fce7142a.tar.gz bcm5719-llvm-a86343512845c9c1fdbac865fea88aa5fce7142a.zip |
Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).
This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.
llvm-svn: 358546
Diffstat (limited to 'llvm/test/Transforms/MergeFunc')
52 files changed, 0 insertions, 2578 deletions
diff --git a/llvm/test/Transforms/MergeFunc/2011-02-08-RemoveEqual.ll b/llvm/test/Transforms/MergeFunc/2011-02-08-RemoveEqual.ll deleted file mode 100644 index 97e8ed5a6ed..00000000000 --- a/llvm/test/Transforms/MergeFunc/2011-02-08-RemoveEqual.ll +++ /dev/null @@ -1,276 +0,0 @@ -; RUN: opt -mergefunc -disable-output < %s -; This used to crash. - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" -target triple = "i386-pc-linux-gnu" - -%"struct.kc::impl_Ccode_option" = type { %"struct.kc::impl_abstract_phylum" } -%"struct.kc::impl_CexpressionDQ" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_CexpressionDQ"* } -%"struct.kc::impl_Ctext" = type { %"struct.kc::impl_Ccode_option", i32, %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_Ctext_elem"*, %"struct.kc::impl_Ctext"* } -%"struct.kc::impl_Ctext_elem" = type { %"struct.kc::impl_abstract_phylum", i32, %"struct.kc::impl_casestring__Str"* } -%"struct.kc::impl_ID" = type { %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_casestring__Str"*, i32, %"struct.kc::impl_casestring__Str"* } -%"struct.kc::impl_abstract_phylum" = type { i32 (...)** } -%"struct.kc::impl_ac_abstract_declarator_AcAbsdeclDirdecl" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_Ccode_option"*, %"struct.kc::impl_Ccode_option"* } -%"struct.kc::impl_casestring__Str" = type { %"struct.kc::impl_abstract_phylum", i8* } -%"struct.kc::impl_elem_patternrepresentation" = type { %"struct.kc::impl_abstract_phylum", i32, %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_ID"* } -%"struct.kc::impl_fileline" = type { %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_casestring__Str"*, i32 } -%"struct.kc::impl_fileline_FileLine" = type { %"struct.kc::impl_fileline" } -%"struct.kc::impl_outmostpatterns" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_elem_patternrepresentation"*, %"struct.kc::impl_outmostpatterns"* } -%"struct.kc::impl_withcaseinfo_Withcaseinfo" = type { %"struct.kc::impl_Ccode_option", %"struct.kc::impl_outmostpatterns"*, %"struct.kc::impl_outmostpatterns"*, %"struct.kc::impl_Ctext"* } - -@_ZTVN2kc13impl_filelineE = external constant [13 x i32 (...)*], align 32 -@.str = external constant [1 x i8], align 1 -@_ZTVN2kc22impl_fileline_FileLineE = external constant [13 x i32 (...)*], align 32 - -define void @_ZN2kc22impl_fileline_FileLineC2EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -entry: - %this_addr = alloca %"struct.kc::impl_fileline_FileLine"*, align 4 - %_file_addr = alloca %"struct.kc::impl_casestring__Str"*, align 4 - %_line_addr = alloca i32, align 4 - %save_filt.150 = alloca i32 - %save_eptr.149 = alloca i8* - %iftmp.99 = alloca %"struct.kc::impl_casestring__Str"* - %eh_exception = alloca i8* - %eh_selector = alloca i32 - %"alloca point" = bitcast i32 0 to i32 - store %"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_fileline_FileLine"** %this_addr - store %"struct.kc::impl_casestring__Str"* %_file, %"struct.kc::impl_casestring__Str"** %_file_addr - store i32 %_line, i32* %_line_addr - %0 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %1 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %0, i32 0, i32 0 - call void @_ZN2kc13impl_filelineC2Ev() nounwind - %2 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %3 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %2, i32 0, i32 0 - %4 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %3, i32 0, i32 0 - %5 = getelementptr inbounds %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_abstract_phylum"* %4, i32 0, i32 0 - store i32 (...)** getelementptr inbounds ([13 x i32 (...)*], [13 x i32 (...)*]* @_ZTVN2kc22impl_fileline_FileLineE, i32 0, i32 2), i32 (...)*** %5, align 4 - %6 = load %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_casestring__Str"** %_file_addr, align 4 - %7 = icmp eq %"struct.kc::impl_casestring__Str"* %6, null - br i1 %7, label %bb, label %bb1 - -bb: ; preds = %entry - %8 = invoke %"struct.kc::impl_casestring__Str"* @_ZN2kc12mkcasestringEPKci() - to label %invcont unwind label %lpad - -invcont: ; preds = %bb - store %"struct.kc::impl_casestring__Str"* %8, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 - br label %bb2 - -bb1: ; preds = %entry - %9 = load %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_casestring__Str"** %_file_addr, align 4 - store %"struct.kc::impl_casestring__Str"* %9, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 - br label %bb2 - -bb2: ; preds = %bb1, %invcont - %10 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %11 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %10, i32 0, i32 0 - %12 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %11, i32 0, i32 1 - %13 = load %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 - store %"struct.kc::impl_casestring__Str"* %13, %"struct.kc::impl_casestring__Str"** %12, align 4 - %14 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %15 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %14, i32 0, i32 0 - %16 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %15, i32 0, i32 2 - %17 = load i32, i32* %_line_addr, align 4 - store i32 %17, i32* %16, align 4 - ret void - -lpad: ; preds = %bb - %eh_ptr = landingpad { i8*, i32 } - cleanup - %exn = extractvalue { i8*, i32 } %eh_ptr, 0 - store i8* %exn, i8** %eh_exception - %eh_ptr4 = load i8*, i8** %eh_exception - %eh_select5 = extractvalue { i8*, i32 } %eh_ptr, 1 - store i32 %eh_select5, i32* %eh_selector - %eh_select = load i32, i32* %eh_selector - store i32 %eh_select, i32* %save_filt.150, align 4 - %eh_value = load i8*, i8** %eh_exception - store i8* %eh_value, i8** %save_eptr.149, align 4 - %18 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %19 = bitcast %"struct.kc::impl_fileline_FileLine"* %18 to %"struct.kc::impl_fileline"* - call void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %19) nounwind - %20 = load i8*, i8** %save_eptr.149, align 4 - store i8* %20, i8** %eh_exception, align 4 - %21 = load i32, i32* %save_filt.150, align 4 - store i32 %21, i32* %eh_selector, align 4 - %eh_ptr6 = load i8*, i8** %eh_exception - call void @_Unwind_Resume_or_Rethrow() - unreachable -} - -declare void @_ZN2kc13impl_filelineC2Ev() nounwind align 2 - -define void @_ZN2kc13impl_filelineD1Ev(%"struct.kc::impl_fileline"* %this) nounwind align 2 { -entry: - %this_addr = alloca %"struct.kc::impl_fileline"*, align 4 - %"alloca point" = bitcast i32 0 to i32 - store %"struct.kc::impl_fileline"* %this, %"struct.kc::impl_fileline"** %this_addr - %0 = load %"struct.kc::impl_fileline"*, %"struct.kc::impl_fileline"** %this_addr, align 4 - %1 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %0, i32 0, i32 0 - %2 = getelementptr inbounds %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_abstract_phylum"* %1, i32 0, i32 0 - store i32 (...)** getelementptr inbounds ([13 x i32 (...)*], [13 x i32 (...)*]* @_ZTVN2kc13impl_filelineE, i32 0, i32 2), i32 (...)*** %2, align 4 - %3 = trunc i32 0 to i8 - %toBool = icmp ne i8 %3, 0 - br i1 %toBool, label %bb1, label %return - -bb1: ; preds = %entry - %4 = load %"struct.kc::impl_fileline"*, %"struct.kc::impl_fileline"** %this_addr, align 4 - %5 = bitcast %"struct.kc::impl_fileline"* %4 to i8* - call void @_ZdlPv() nounwind - br label %return - -return: ; preds = %bb1, %entry - ret void -} - -declare void @_ZdlPv() nounwind - -define void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %this) nounwind align 2 { -entry: - %this_addr = alloca %"struct.kc::impl_fileline"*, align 4 - %"alloca point" = bitcast i32 0 to i32 - store %"struct.kc::impl_fileline"* %this, %"struct.kc::impl_fileline"** %this_addr - %0 = load %"struct.kc::impl_fileline"*, %"struct.kc::impl_fileline"** %this_addr, align 4 - %1 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %0, i32 0, i32 0 - %2 = getelementptr inbounds %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_abstract_phylum"* %1, i32 0, i32 0 - store i32 (...)** getelementptr inbounds ([13 x i32 (...)*], [13 x i32 (...)*]* @_ZTVN2kc13impl_filelineE, i32 0, i32 2), i32 (...)*** %2, align 4 - %3 = trunc i32 0 to i8 - %toBool = icmp ne i8 %3, 0 - br i1 %toBool, label %bb1, label %return - -bb1: ; preds = %entry - %4 = load %"struct.kc::impl_fileline"*, %"struct.kc::impl_fileline"** %this_addr, align 4 - %5 = bitcast %"struct.kc::impl_fileline"* %4 to i8* - call void @_ZdlPv() nounwind - br label %return - -return: ; preds = %bb1, %entry - ret void -} - -define void @_ZN2kc22impl_fileline_FileLineC1EPNS_20impl_casestring__StrEi(%"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_casestring__Str"* %_file, i32 %_line) align 2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -entry: - %this_addr = alloca %"struct.kc::impl_fileline_FileLine"*, align 4 - %_file_addr = alloca %"struct.kc::impl_casestring__Str"*, align 4 - %_line_addr = alloca i32, align 4 - %save_filt.148 = alloca i32 - %save_eptr.147 = alloca i8* - %iftmp.99 = alloca %"struct.kc::impl_casestring__Str"* - %eh_exception = alloca i8* - %eh_selector = alloca i32 - %"alloca point" = bitcast i32 0 to i32 - store %"struct.kc::impl_fileline_FileLine"* %this, %"struct.kc::impl_fileline_FileLine"** %this_addr - store %"struct.kc::impl_casestring__Str"* %_file, %"struct.kc::impl_casestring__Str"** %_file_addr - store i32 %_line, i32* %_line_addr - %0 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %1 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %0, i32 0, i32 0 - call void @_ZN2kc13impl_filelineC2Ev() nounwind - %2 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %3 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %2, i32 0, i32 0 - %4 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %3, i32 0, i32 0 - %5 = getelementptr inbounds %"struct.kc::impl_abstract_phylum", %"struct.kc::impl_abstract_phylum"* %4, i32 0, i32 0 - store i32 (...)** getelementptr inbounds ([13 x i32 (...)*], [13 x i32 (...)*]* @_ZTVN2kc22impl_fileline_FileLineE, i32 0, i32 2), i32 (...)*** %5, align 4 - %6 = load %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_casestring__Str"** %_file_addr, align 4 - %7 = icmp eq %"struct.kc::impl_casestring__Str"* %6, null - br i1 %7, label %bb, label %bb1 - -bb: ; preds = %entry - %8 = invoke %"struct.kc::impl_casestring__Str"* @_ZN2kc12mkcasestringEPKci() - to label %invcont unwind label %lpad - -invcont: ; preds = %bb - store %"struct.kc::impl_casestring__Str"* %8, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 - br label %bb2 - -bb1: ; preds = %entry - %9 = load %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_casestring__Str"** %_file_addr, align 4 - store %"struct.kc::impl_casestring__Str"* %9, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 - br label %bb2 - -bb2: ; preds = %bb1, %invcont - %10 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %11 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %10, i32 0, i32 0 - %12 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %11, i32 0, i32 1 - %13 = load %"struct.kc::impl_casestring__Str"*, %"struct.kc::impl_casestring__Str"** %iftmp.99, align 4 - store %"struct.kc::impl_casestring__Str"* %13, %"struct.kc::impl_casestring__Str"** %12, align 4 - %14 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %15 = getelementptr inbounds %"struct.kc::impl_fileline_FileLine", %"struct.kc::impl_fileline_FileLine"* %14, i32 0, i32 0 - %16 = getelementptr inbounds %"struct.kc::impl_fileline", %"struct.kc::impl_fileline"* %15, i32 0, i32 2 - %17 = load i32, i32* %_line_addr, align 4 - store i32 %17, i32* %16, align 4 - ret void - -lpad: ; preds = %bb - %eh_ptr = landingpad { i8*, i32 } - cleanup - %exn = extractvalue { i8*, i32 } %eh_ptr, 0 - store i8* %exn, i8** %eh_exception - %eh_ptr4 = load i8*, i8** %eh_exception - %eh_select5 = extractvalue { i8*, i32 } %eh_ptr, 1 - store i32 %eh_select5, i32* %eh_selector - %eh_select = load i32, i32* %eh_selector - store i32 %eh_select, i32* %save_filt.148, align 4 - %eh_value = load i8*, i8** %eh_exception - store i8* %eh_value, i8** %save_eptr.147, align 4 - %18 = load %"struct.kc::impl_fileline_FileLine"*, %"struct.kc::impl_fileline_FileLine"** %this_addr, align 4 - %19 = bitcast %"struct.kc::impl_fileline_FileLine"* %18 to %"struct.kc::impl_fileline"* - call void @_ZN2kc13impl_filelineD2Ev(%"struct.kc::impl_fileline"* %19) nounwind - %20 = load i8*, i8** %save_eptr.147, align 4 - store i8* %20, i8** %eh_exception, align 4 - %21 = load i32, i32* %save_filt.148, align 4 - store i32 %21, i32* %eh_selector, align 4 - %eh_ptr6 = load i8*, i8** %eh_exception - call void @_Unwind_Resume_or_Rethrow() - unreachable -} - -declare i32 @__gxx_personality_v0(...) - -declare void @_Unwind_Resume_or_Rethrow() - -define void @_ZN2kc21printer_functor_classC2Ev(%"struct.kc::impl_abstract_phylum"* %this) nounwind align 2 { -entry: - unreachable -} - -define %"struct.kc::impl_Ccode_option"* @_ZN2kc11phylum_castIPNS_17impl_withcaseinfoES1_EET_PT0_(%"struct.kc::impl_Ccode_option"* %t) nounwind { -entry: - ret %"struct.kc::impl_Ccode_option"* null -} - -define %"struct.kc::impl_abstract_phylum"* @_ZNK2kc43impl_ac_direct_declarator_AcDirectDeclProto9subphylumEi(%"struct.kc::impl_ac_abstract_declarator_AcAbsdeclDirdecl"* %this, i32 %no) nounwind align 2 { -entry: - ret %"struct.kc::impl_abstract_phylum"* undef -} - -define void @_ZN2kc30impl_withcaseinfo_WithcaseinfoD0Ev(%"struct.kc::impl_withcaseinfo_Withcaseinfo"* %this) nounwind align 2 { -entry: - unreachable -} - -define void @_ZN2kc30impl_withcaseinfo_WithcaseinfoC1EPNS_26impl_patternrepresentationES2_PNS_10impl_CtextE(%"struct.kc::impl_withcaseinfo_Withcaseinfo"* %this, %"struct.kc::impl_outmostpatterns"* %_patternrepresentation_1, %"struct.kc::impl_outmostpatterns"* %_patternrepresentation_2, %"struct.kc::impl_Ctext"* %_Ctext_1) nounwind align 2 { -entry: - unreachable -} - -define void @_ZN2kc21impl_rewriteviewsinfoC2EPNS_20impl_rewriteviewinfoEPS0_(%"struct.kc::impl_CexpressionDQ"* %this, %"struct.kc::impl_Ccode_option"* %p1, %"struct.kc::impl_CexpressionDQ"* %p2) nounwind align 2 { -entry: - unreachable -} - -define %"struct.kc::impl_Ctext_elem"* @_ZN2kc11phylum_castIPNS_9impl_termENS_20impl_abstract_phylumEEET_PT0_(%"struct.kc::impl_abstract_phylum"* %t) nounwind { -entry: - unreachable -} - -define void @_ZN2kc27impl_ac_parameter_type_listD2Ev(%"struct.kc::impl_Ccode_option"* %this) nounwind align 2 { -entry: - ret void -} - -define void @_ZN2kc21impl_ac_operator_nameD2Ev(%"struct.kc::impl_Ctext_elem"* %this) nounwind align 2 { -entry: - ret void -} - -declare %"struct.kc::impl_casestring__Str"* @_ZN2kc12mkcasestringEPKci() diff --git a/llvm/test/Transforms/MergeFunc/2013-01-10-MergeFuncAssert.ll b/llvm/test/Transforms/MergeFunc/2013-01-10-MergeFuncAssert.ll deleted file mode 100644 index 3f6a5ba157d..00000000000 --- a/llvm/test/Transforms/MergeFunc/2013-01-10-MergeFuncAssert.ll +++ /dev/null @@ -1,36 +0,0 @@ -; RUN: opt -mergefunc -disable-output < %s -; This used to trigger a ConstantExpr::getBitCast assertion. - -define void @t1() unnamed_addr uwtable ssp align 2 { -entry: - switch i32 undef, label %sw.bb12 [ - i32 127, label %sw.bb - i32 126, label %sw.bb4 - ] - -sw.bb: ; preds = %entry - unreachable - -sw.bb4: ; preds = %entry - unreachable - -sw.bb12: ; preds = %entry - ret void -} - -define void @t2() unnamed_addr uwtable ssp align 2 { -entry: - switch i32 undef, label %sw.bb8 [ - i32 4, label %sw.bb - i32 3, label %sw.bb4 - ] - -sw.bb: ; preds = %entry - unreachable - -sw.bb4: ; preds = %entry - ret void - -sw.bb8: ; preds = %entry - unreachable -} diff --git a/llvm/test/Transforms/MergeFunc/address-spaces.ll b/llvm/test/Transforms/MergeFunc/address-spaces.ll deleted file mode 100644 index 1cfecae979d..00000000000 --- a/llvm/test/Transforms/MergeFunc/address-spaces.ll +++ /dev/null @@ -1,35 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -target datalayout = "p:32:32:32-p1:32:32:32-p2:16:16:16" - -declare void @foo(i32) nounwind - -; None of these functions should be merged - -define i32 @store_as0(i32* %x) { -; CHECK-LABEL: @store_as0( -; CHECK: call void @foo( - %gep = getelementptr i32, i32* %x, i32 4 - %y = load i32, i32* %gep - call void @foo(i32 %y) nounwind - ret i32 %y -} - -define i32 @store_as1(i32 addrspace(1)* %x) { -; CHECK-LABEL: @store_as1( -; CHECK: call void @foo( - %gep = getelementptr i32, i32 addrspace(1)* %x, i32 4 - %y = load i32, i32 addrspace(1)* %gep - call void @foo(i32 %y) nounwind - ret i32 %y -} - -define i32 @store_as2(i32 addrspace(2)* %x) { -; CHECK-LABEL: @store_as2( -; CHECK: call void @foo( - %gep = getelementptr i32, i32 addrspace(2)* %x, i32 4 - %y = load i32, i32 addrspace(2)* %gep - call void @foo(i32 %y) nounwind - ret i32 %y -} - diff --git a/llvm/test/Transforms/MergeFunc/alias.ll b/llvm/test/Transforms/MergeFunc/alias.ll deleted file mode 100644 index ee1c7af5e81..00000000000 --- a/llvm/test/Transforms/MergeFunc/alias.ll +++ /dev/null @@ -1,116 +0,0 @@ -; RUN: opt -S -mergefunc -mergefunc-use-aliases < %s | FileCheck %s - -; Aliases should always be created for the weak functions, and -; for external functions if there is no local function - -; CHECK: @external_external_2 = unnamed_addr alias void (float*), bitcast (void (i32*)* @external_external_1 to void (float*)*) -; CHECK: @weak_weak_2 = weak unnamed_addr alias void (float*), bitcast (void (i32*)* @0 to void (float*)*) -; CHECK: @weak_weak_1 = weak unnamed_addr alias void (i32*), void (i32*)* @0 -; CHECK: @weak_external_1 = weak unnamed_addr alias void (i32*), bitcast (void (float*)* @weak_external_2 to void (i32*)*) -; CHECK: @external_weak_2 = weak unnamed_addr alias void (float*), bitcast (void (i32*)* @external_weak_1 to void (float*)*) -; CHECK: @weak_internal_1 = weak unnamed_addr alias void (i32*), bitcast (void (float*)* @weak_internal_2 to void (i32*)*) -; CHECK: @internal_weak_2 = weak unnamed_addr alias void (float*), bitcast (void (i32*)* @internal_weak_1 to void (float*)*) - -; A strong backing function had to be created for the weak-weak pair - -; CHECK: define private void @0(i32* %a) unnamed_addr -; CHECK_NEXT: call void @dummy4() - -; These internal functions are dropped in favor of the external ones - -; CHECK-NOT: define internal void @external_internal_2(float *%a) unnamed_addr -; CHECK-NOT: define internal void @internal_external_1(i32 *%a) unnamed_addr -; CHECK-NOT: define internal void @internal_external_1(i32 *%a) unnamed_addr -; CHECK-NOT: define internal void @internal_external_2(float *%a) unnamed_addr - -; Only used to mark which functions should be merged. -declare void @dummy1() -declare void @dummy2() -declare void @dummy3() -declare void @dummy4() -declare void @dummy5() -declare void @dummy6() -declare void @dummy7() -declare void @dummy8() -declare void @dummy9() - -define void @external_external_1(i32 *%a) unnamed_addr { - call void @dummy1() - ret void -} -define void @external_external_2(float *%a) unnamed_addr { - call void @dummy1() - ret void -} - -define void @external_internal_1(i32 *%a) unnamed_addr { - call void @dummy2() - ret void -} -define internal void @external_internal_2(float *%a) unnamed_addr { - call void @dummy2() - ret void -} - -define internal void @internal_external_1(i32 *%a) unnamed_addr { - call void @dummy3() - ret void -} -define void @internal_external_2(float *%a) unnamed_addr { - call void @dummy3() - ret void -} - -define weak void @weak_weak_1(i32 *%a) unnamed_addr { - call void @dummy4() - ret void -} -define weak void @weak_weak_2(float *%a) unnamed_addr { - call void @dummy4() - ret void -} - -define weak void @weak_external_1(i32 *%a) unnamed_addr { - call void @dummy5() - ret void -} -define external void @weak_external_2(float *%a) unnamed_addr { - call void @dummy5() - ret void -} - -define external void @external_weak_1(i32 *%a) unnamed_addr { - call void @dummy6() - ret void -} -define weak void @external_weak_2(float *%a) unnamed_addr { - call void @dummy6() - ret void -} - -define weak void @weak_internal_1(i32 *%a) unnamed_addr { - call void @dummy7() - ret void -} -define internal void @weak_internal_2(float *%a) unnamed_addr { - call void @dummy7() - ret void -} - -define internal void @internal_weak_1(i32 *%a) unnamed_addr { - call void @dummy8() - ret void -} -define weak void @internal_weak_2(float *%a) unnamed_addr { - call void @dummy8() - ret void -} - -define internal void @internal_internal_1(i32 *%a) unnamed_addr { - call void @dummy9() - ret void -} -define internal void @internal_internal_2(float *%a) unnamed_addr { - call void @dummy9() - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/alloca.ll b/llvm/test/Transforms/MergeFunc/alloca.ll deleted file mode 100644 index 165fc68365b..00000000000 --- a/llvm/test/Transforms/MergeFunc/alloca.ll +++ /dev/null @@ -1,61 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s - -;; Make sure that two different allocas are not treated as equal. - -target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32" - -%kv1 = type { i32, i32 } -%kv2 = type { i8 } -%kv3 = type { i64, i64 } - -; Size difference. - -; CHECK-LABEL: define void @size1 -; CHECK-NOT: call void @ -define void @size1(i8 *%f) { - %v = alloca %kv1, align 8 - %f_2 = bitcast i8* %f to void (%kv1 *)* - call void %f_2(%kv1 * %v) - call void %f_2(%kv1 * %v) - call void %f_2(%kv1 * %v) - call void %f_2(%kv1 * %v) - ret void -} - -; CHECK-LABEL: define void @size2 -; CHECK-NOT: call void @ -define void @size2(i8 *%f) { - %v = alloca %kv2, align 8 - %f_2 = bitcast i8* %f to void (%kv2 *)* - call void %f_2(%kv2 * %v) - call void %f_2(%kv2 * %v) - call void %f_2(%kv2 * %v) - call void %f_2(%kv2 * %v) - ret void -} - -; Alignment difference. - -; CHECK-LABEL: define void @align1 -; CHECK-NOT: call void @ -define void @align1(i8 *%f) { - %v = alloca %kv3, align 8 - %f_2 = bitcast i8* %f to void (%kv3 *)* - call void %f_2(%kv3 * %v) - call void %f_2(%kv3 * %v) - call void %f_2(%kv3 * %v) - call void %f_2(%kv3 * %v) - ret void -} - -; CHECK-LABEL: define void @align2 -; CHECK-NOT: call void @ -define void @align2(i8 *%f) { - %v = alloca %kv3, align 16 - %f_2 = bitcast i8* %f to void (%kv3 *)* - call void %f_2(%kv3 * %v) - call void %f_2(%kv3 * %v) - call void %f_2(%kv3 * %v) - call void %f_2(%kv3 * %v) - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/apply_function_attributes.ll b/llvm/test/Transforms/MergeFunc/apply_function_attributes.ll deleted file mode 100644 index e9ede451820..00000000000 --- a/llvm/test/Transforms/MergeFunc/apply_function_attributes.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -%Opaque_type = type opaque -%S2i = type <{ i64, i64 }> -%D2i = type <{ i64, i64 }> -%Di = type <{ i32 }> -%Si = type <{ i32 }> - -define void @B(%Opaque_type* sret %a, %S2i* %b, i32* %xp, i32* %yp) { - %x = load i32, i32* %xp - %y = load i32, i32* %yp - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = add i32 %sum2, %y - ret void -} - -define void @C(%Opaque_type* sret %a, %S2i* %b, i32* %xp, i32* %yp) { - %x = load i32, i32* %xp - %y = load i32, i32* %yp - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = add i32 %sum2, %y - ret void -} - -define void @A(%Opaque_type* sret %a, %D2i* %b, i32* %xp, i32* %yp) { - %x = load i32, i32* %xp - %y = load i32, i32* %yp - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = add i32 %sum2, %y - ret void -} - -; Make sure we transfer the parameter attributes to the call site. -; CHECK-LABEL: define void @C(%Opaque_type* sret -; CHECK: tail call void bitcast (void (%Opaque_type*, %D2i*, i32*, i32*)* @A to void (%Opaque_type*, %S2i*, i32*, i32*)*)(%Opaque_type* sret %0, %S2i* %1, i32* %2, i32* %3) -; CHECK: ret void - - -; Make sure we transfer the parameter attributes to the call site. -; CHECK-LABEL: define void @B(%Opaque_type* sret -; CHECK: %5 = bitcast -; CHECK: tail call void @A(%Opaque_type* sret %0, %D2i* %5, i32* %2, i32* %3) -; CHECK: ret void - diff --git a/llvm/test/Transforms/MergeFunc/call-and-invoke-with-ranges.ll b/llvm/test/Transforms/MergeFunc/call-and-invoke-with-ranges.ll deleted file mode 100644 index 4b8d6bb53e4..00000000000 --- a/llvm/test/Transforms/MergeFunc/call-and-invoke-with-ranges.ll +++ /dev/null @@ -1,92 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s - -define i8 @call_with_range() { - bitcast i8 0 to i8 ; dummy to make the function large enough - %out = call i8 @dummy(), !range !0 - ret i8 %out -} - -define i8 @call_no_range() { -; CHECK-LABEL: @call_no_range -; CHECK-NEXT: bitcast i8 0 to i8 -; CHECK-NEXT: %out = call i8 @dummy() -; CHECK-NEXT: ret i8 %out - bitcast i8 0 to i8 - %out = call i8 @dummy() - ret i8 %out -} - -define i8 @call_different_range() { -; CHECK-LABEL: @call_different_range -; CHECK-NEXT: bitcast i8 0 to i8 -; CHECK-NEXT: %out = call i8 @dummy(), !range !1 -; CHECK-NEXT: ret i8 %out - bitcast i8 0 to i8 - %out = call i8 @dummy(), !range !1 - ret i8 %out -} - -define i8 @invoke_with_range() personality i8* undef { - %out = invoke i8 @dummy() to label %next unwind label %lpad, !range !0 - -next: - ret i8 %out - -lpad: - %pad = landingpad { i8*, i32 } cleanup - resume { i8*, i32 } zeroinitializer -} - -define i8 @invoke_no_range() personality i8* undef { -; CHECK-LABEL: @invoke_no_range() -; CHECK-NEXT: invoke i8 @dummy - %out = invoke i8 @dummy() to label %next unwind label %lpad - -next: - ret i8 %out - -lpad: - %pad = landingpad { i8*, i32 } cleanup - resume { i8*, i32 } zeroinitializer -} - -define i8 @invoke_different_range() personality i8* undef { -; CHECK-LABEL: @invoke_different_range() -; CHECK-NEXT: invoke i8 @dummy - %out = invoke i8 @dummy() to label %next unwind label %lpad, !range !1 - -next: - ret i8 %out - -lpad: - %pad = landingpad { i8*, i32 } cleanup - resume { i8*, i32 } zeroinitializer -} - -define i8 @invoke_with_same_range() personality i8* undef { -; CHECK-LABEL: @invoke_with_same_range() -; CHECK: tail call i8 @invoke_with_range() - %out = invoke i8 @dummy() to label %next unwind label %lpad, !range !0 - -next: - ret i8 %out - -lpad: - %pad = landingpad { i8*, i32 } cleanup - resume { i8*, i32 } zeroinitializer -} - -define i8 @call_with_same_range() { -; CHECK-LABEL: @call_with_same_range -; CHECK: tail call i8 @call_with_range - bitcast i8 0 to i8 - %out = call i8 @dummy(), !range !0 - ret i8 %out -} - - -declare i8 @dummy(); -declare i32 @__gxx_personality_v0(...) - -!0 = !{i8 0, i8 2} -!1 = !{i8 5, i8 7} diff --git a/llvm/test/Transforms/MergeFunc/constant-entire-value.ll b/llvm/test/Transforms/MergeFunc/constant-entire-value.ll deleted file mode 100644 index cb193d06ee4..00000000000 --- a/llvm/test/Transforms/MergeFunc/constant-entire-value.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; RUN: opt -S -mergefunc < %s | FileCheck -check-prefix=NOPLUS %s - -; This makes sure that zeros in constants don't cause problems with string based -; memory comparisons -define internal i32 @sum(i32 %x, i32 %y) { -; CHECK-LABEL: @sum - %sum = add i32 %x, %y - %1 = extractvalue [3 x i32] [ i32 3, i32 0, i32 2 ], 2 - %sum2 = add i32 %sum, %1 - %sum3 = add i32 %sum2, %y - ret i32 %sum3 -} - -define internal i32 @add(i32 %x, i32 %y) { -; CHECK-LABEL: @add - %sum = add i32 %x, %y - %1 = extractvalue [3 x i32] [ i32 3, i32 0, i32 1 ], 2 - %sum2 = add i32 %sum, %1 - %sum3 = add i32 %sum2, %y - ret i32 %sum3 -} - -define internal i32 @plus(i32 %x, i32 %y) { -; NOPLUS-NOT: @plus - %sum = add i32 %x, %y - %1 = extractvalue [3 x i32] [ i32 3, i32 0, i32 5 ], 2 - %sum2 = add i32 %sum, %1 - %sum3 = add i32 %sum2, %y - ret i32 %sum3 -} - -define internal i32 @next(i32 %x, i32 %y) { -; CHECK-LABEL: @next - %sum = add i32 %x, %y - %1 = extractvalue [3 x i32] [ i32 3, i32 0, i32 5 ], 2 - %sum2 = add i32 %sum, %1 - %sum3 = add i32 %sum2, %y - ret i32 %sum3 -} - diff --git a/llvm/test/Transforms/MergeFunc/crash.ll b/llvm/test/Transforms/MergeFunc/crash.ll deleted file mode 100644 index 73802203dc5..00000000000 --- a/llvm/test/Transforms/MergeFunc/crash.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt -mergefunc -disable-output < %s -; PR15185 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" -target triple = "i386-pc-linux-gnu" - -%.qux.2496 = type { i32, %.qux.2497 } -%.qux.2497 = type { i8, i32 } -%.qux.2585 = type { i32, i32, i8* } - -@g2 = external unnamed_addr constant [9 x i8], align 1 -@g3 = internal unnamed_addr constant [1 x i8*] [i8* bitcast (i8* (%.qux.2585*)* @func35 to i8*)] - -define internal i32 @func1(i32* %ptr, { i32, i32 }* nocapture %method) align 2 { - br label %1 - -; <label>:1 - br label %2 - -; <label>:2 - ret i32 undef -} - -define internal i32 @func10(%.qux.2496* nocapture %this) align 2 { - %1 = getelementptr inbounds %.qux.2496, %.qux.2496* %this, i32 0, i32 1, i32 1 - %2 = load i32, i32* %1, align 4 - ret i32 %2 -} - -define internal i8* @func29(i32* nocapture %this) align 2 { - ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @g2, i32 0, i32 0) -} - -define internal i32* @func33(%.qux.2585* nocapture %this) align 2 { - ret i32* undef -} - -define internal i32* @func34(%.qux.2585* nocapture %this) align 2 { - %1 = getelementptr inbounds %.qux.2585, %.qux.2585* %this, i32 0 - ret i32* undef -} - -define internal i8* @func35(%.qux.2585* nocapture %this) align 2 { - %1 = getelementptr inbounds %.qux.2585, %.qux.2585* %this, i32 0, i32 2 - %2 = load i8*, i8** %1, align 4 - ret i8* %2 -} diff --git a/llvm/test/Transforms/MergeFunc/crash2.ll b/llvm/test/Transforms/MergeFunc/crash2.ll deleted file mode 100644 index 4b3a3f911e7..00000000000 --- a/llvm/test/Transforms/MergeFunc/crash2.ll +++ /dev/null @@ -1,54 +0,0 @@ -; RUN: opt %s -mergefunc -globalopt -S -o - | FileCheck %s - -; Make sure we don't crash on this example. This test is supposed to test that -; MergeFunctions clears its GlobalNumbers value map. If this map still contains -; entries when running globalopt and the MergeFunctions instance is still alive -; the optimization of @G would cause an assert because globalopt would do an -; RAUW on @G which still exists as an entry in the GlobalNumbers ValueMap which -; causes an assert in the ValueHandle call back because we are RAUWing with a -; different type (AllocaInst) than its key type (GlobalValue). - -@G = internal global i8** null -@G2 = internal global i8** null - -define i32 @main(i32 %argc, i8** %argv) norecurse { -; CHECK: alloca - store i8** %argv, i8*** @G - ret i32 0 -} - -define internal i8** @dead1(i64 %p) { - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - %tmp = load i8**, i8*** @G - ret i8** %tmp -} - -define internal i8** @dead2(i64 %p) { - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - %tmp = load i8**, i8*** @G2 - ret i8** %tmp -} - -define void @left(i64 %p) { -entry-block: - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - ret void -} - -define void @right(i64 %p) { -entry-block: - call void @left(i64 %p) - call void @left(i64 %p) - call void @left(i64 %p) - call void @left(i64 %p) - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/external-before-local.ll b/llvm/test/Transforms/MergeFunc/external-before-local.ll deleted file mode 100644 index 7dcdb0153df..00000000000 --- a/llvm/test/Transforms/MergeFunc/external-before-local.ll +++ /dev/null @@ -1,55 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; We should normalize to test2 rather than test1, -; because it allows us to drop test1 entirely - -; CHECK-NOT: define internal void @test1() unnamed_addr -; CHECK: define void @test3() unnamed_addr -; CHECK-NEXT: call void @test2() -; CHECK-NEXT: call void @test2() - -declare void @dummy() - -define internal void @test1() unnamed_addr { - call void @dummy() - call void @dummy() - ret void -} - -define void @test2() unnamed_addr { - call void @dummy() - call void @dummy() - ret void -} - -define void @test3() unnamed_addr { - call void @test1() - call void @test2() - ret void -} - -; We should normalize to the existing test6 rather than -; to a new anonymous strong backing function - -; CHECK: define weak void @test5() -; CHECK-NEXT: tail call void @test6() -; CHECK: define weak void @test4() -; CHECK-NEXT: tail call void @test6() - -declare void @dummy2() - -define weak void @test4() { - call void @dummy2() - call void @dummy2() - ret void -} -define weak void @test5() { - call void @dummy2() - call void @dummy2() - ret void -} -define void @test6() { - call void @dummy2() - call void @dummy2() - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/fold-weak.ll b/llvm/test/Transforms/MergeFunc/fold-weak.ll deleted file mode 100644 index f8a18887890..00000000000 --- a/llvm/test/Transforms/MergeFunc/fold-weak.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -define weak i32 @sum(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = add i32 %sum2, %y - ret i32 %sum3 -} - -define weak i32 @add(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = add i32 %sum2, %y - ret i32 %sum3 -} - -; Don't replace a weak function use by another equivalent function. We don't -; know whether the symbol that will ulitmately be linked is equivalent - we -; don't know that the weak definition is the definitive definition or whether it -; will be overriden by a stronger definition). - -; CHECK-LABEL: define private i32 @0 -; CHECK: add i32 -; CHECK: add i32 -; CHECK: add i32 -; CHECK: ret - -; CHECK-LABEL: define i32 @use_weak -; CHECK: call i32 @add -; CHECK: call i32 @sum -; CHECK: ret - -; CHECK-LABEL: define weak i32 @sum -; CHECK: tail call i32 @0 -; CHECK: ret - -; CHECK-LABEL: define weak i32 @add -; CHECK: tail call i32 @0 -; CHECK: ret - - -define i32 @use_weak(i32 %a, i32 %b) { - %res = call i32 @add(i32 %a, i32 %b) - %res2 = call i32 @sum(i32 %a, i32 %b) - %res3 = add i32 %res, %res2 - ret i32 %res3 -} diff --git a/llvm/test/Transforms/MergeFunc/functions.ll b/llvm/test/Transforms/MergeFunc/functions.ll deleted file mode 100644 index 006fdf52367..00000000000 --- a/llvm/test/Transforms/MergeFunc/functions.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; Be sure we don't merge cross-referenced functions of same type. - -; CHECK-LABEL: @left -; CHECK-LABEL: entry-block -; CHECK-LABEL: call void @right(i64 %p) -define void @left(i64 %p) { -entry-block: - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - call void @right(i64 %p) - ret void -} - -; CHECK-LABEL: @right -; CHECK-LABEL: entry-block -; CHECK-LABEL: call void @left(i64 %p) -define void @right(i64 %p) { -entry-block: - call void @left(i64 %p) - call void @left(i64 %p) - call void @left(i64 %p) - call void @left(i64 %p) - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/gep-base-type.ll b/llvm/test/Transforms/MergeFunc/gep-base-type.ll deleted file mode 100644 index bfbb247fb3a..00000000000 --- a/llvm/test/Transforms/MergeFunc/gep-base-type.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -; These should not be merged, the type of the GEP pointer argument does not have -; the same stride. - -%"struct1" = type <{ i8*, i32, [4 x i8] }> -%"struct2" = type { i8*, { i64, i64 } } - -define internal %struct2* @Ffunc(%struct2* %P, i64 %i) { -; CHECK-LABEL: @Ffunc( -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: ret - %1 = getelementptr inbounds %"struct2", %"struct2"* %P, i64 %i - %2 = getelementptr inbounds %"struct2", %"struct2"* %P, i64 %i - %3 = getelementptr inbounds %"struct2", %"struct2"* %P, i64 %i - %4 = getelementptr inbounds %"struct2", %"struct2"* %P, i64 %i - %5 = getelementptr inbounds %"struct2", %"struct2"* %P, i64 %i - %6 = getelementptr inbounds %"struct2", %"struct2"* %P, i64 %i - ret %struct2* %6 -} - - -define internal %struct1* @Gfunc(%struct1* %P, i64 %i) { -; CHECK-LABEL: @Gfunc( -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: getelementptr -; CHECK-NEXT: ret - %1 = getelementptr inbounds %"struct1", %"struct1"* %P, i64 %i - %2 = getelementptr inbounds %"struct1", %"struct1"* %P, i64 %i - %3 = getelementptr inbounds %"struct1", %"struct1"* %P, i64 %i - %4 = getelementptr inbounds %"struct1", %"struct1"* %P, i64 %i - %5 = getelementptr inbounds %"struct1", %"struct1"* %P, i64 %i - %6 = getelementptr inbounds %"struct1", %"struct1"* %P, i64 %i - ret %struct1* %6 -} - diff --git a/llvm/test/Transforms/MergeFunc/inline-asm.ll b/llvm/test/Transforms/MergeFunc/inline-asm.ll deleted file mode 100644 index 15760242cf6..00000000000 --- a/llvm/test/Transforms/MergeFunc/inline-asm.ll +++ /dev/null @@ -1,53 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s - -; CHECK-LABEL: @int_ptr_arg_different -; CHECK-NEXT: call void asm - -; CHECK-LABEL: @int_ptr_null -; CHECK-NEXT: tail call void @float_ptr_null() - -; CHECK-LABEL: @int_ptr_arg_same -; CHECK-NEXT: %2 = bitcast i32* %0 to float* -; CHECK-NEXT: tail call void @float_ptr_arg_same(float* %2) - -; Used to satisfy minimum size limit -declare void @stuff() - -; Can be merged -define void @float_ptr_null() { - call void asm "nop", "r"(float* null) - call void @stuff() - ret void -} - -define void @int_ptr_null() { - call void asm "nop", "r"(i32* null) - call void @stuff() - ret void -} - -; Can be merged (uses same argument differing by pointer type) -define void @float_ptr_arg_same(float*) { - call void asm "nop", "r"(float* %0) - call void @stuff() - ret void -} - -define void @int_ptr_arg_same(i32*) { - call void asm "nop", "r"(i32* %0) - call void @stuff() - ret void -} - -; Can not be merged (uses different arguments) -define void @float_ptr_arg_different(float*, float*) { - call void asm "nop", "r"(float* %0) - call void @stuff() - ret void -} - -define void @int_ptr_arg_different(i32*, i32*) { - call void asm "nop", "r"(i32* %1) - call void @stuff() - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/inttoptr-address-space.ll b/llvm/test/Transforms/MergeFunc/inttoptr-address-space.ll deleted file mode 100644 index 86deb2c9495..00000000000 --- a/llvm/test/Transforms/MergeFunc/inttoptr-address-space.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-n8:16:32-S128" - -%.qux.2496 = type { i32, %.qux.2497 } -%.qux.2497 = type { i8, i32 } -%.qux.2585 = type { i32, i32, i8* } - -@g2 = external addrspace(1) constant [9 x i8], align 1 -@g3 = internal unnamed_addr constant [1 x i8*] [i8* bitcast (i8* (%.qux.2585 addrspace(1)*)* @func35 to i8*)] - - -define internal i32 @func10(%.qux.2496 addrspace(1)* nocapture %this) align 2 { -bb: - %tmp = getelementptr inbounds %.qux.2496, %.qux.2496 addrspace(1)* %this, i32 0, i32 1, i32 1 - %tmp1 = load i32, i32 addrspace(1)* %tmp, align 4 - ret i32 %tmp1 -} - -; Check for pointer bitwidth equal assertion failure -define internal i8* @func35(%.qux.2585 addrspace(1)* nocapture %this) align 2 { -bb: -; CHECK-LABEL: @func35( -; CHECK: %[[V2:.+]] = bitcast %.qux.2585 addrspace(1)* %{{.*}} to %.qux.2496 addrspace(1)* -; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496 addrspace(1)* nocapture %[[V2]]) -; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8* - %tmp = getelementptr inbounds %.qux.2585, %.qux.2585 addrspace(1)* %this, i32 0, i32 2 - %tmp1 = load i8*, i8* addrspace(1)* %tmp, align 4 - ret i8* %tmp1 -} diff --git a/llvm/test/Transforms/MergeFunc/inttoptr.ll b/llvm/test/Transforms/MergeFunc/inttoptr.ll deleted file mode 100644 index 05ae766a6e3..00000000000 --- a/llvm/test/Transforms/MergeFunc/inttoptr.ll +++ /dev/null @@ -1,56 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -; PR15185 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" -target triple = "i386-pc-linux-gnu" - -%.qux.2496 = type { i32, %.qux.2497 } -%.qux.2497 = type { i8, i32 } -%.qux.2585 = type { i32, i32, i8* } - -@g2 = external unnamed_addr constant [9 x i8], align 1 -@g3 = internal unnamed_addr constant [1 x i8*] [i8* bitcast (i8* (%.qux.2585*)* @func35 to i8*)] - -define internal i32 @func1(i32* %ptr, { i32, i32 }* nocapture %method) align 2 { -bb: - br label %bb1 - -bb1: ; preds = %bb - br label %bb2 - -bb2: ; preds = %bb1 - ret i32 undef -} - -define internal i32 @func10(%.qux.2496* nocapture %this) align 2 { -bb: - %tmp = getelementptr inbounds %.qux.2496, %.qux.2496* %this, i32 0, i32 1, i32 1 - %tmp1 = load i32, i32* %tmp, align 4 - ret i32 %tmp1 -} - -define internal i8* @func29(i32* nocapture %this) align 2 { -bb: - ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @g2, i32 0, i32 0) -} - -define internal i32* @func33(%.qux.2585* nocapture %this) align 2 { -bb: - ret i32* undef -} - -define internal i32* @func34(%.qux.2585* nocapture %this) align 2 { -bb: - %tmp = getelementptr inbounds %.qux.2585, %.qux.2585* %this, i32 0 - ret i32* undef -} - -define internal i8* @func35(%.qux.2585* nocapture %this) align 2 { -bb: -; CHECK-LABEL: @func35( -; CHECK: %[[V2:.+]] = bitcast %.qux.2585* %{{.*}} to %.qux.2496* -; CHECK: %[[V3:.+]] = tail call i32 @func10(%.qux.2496* nocapture %[[V2]]) -; CHECK: %{{.*}} = inttoptr i32 %[[V3]] to i8* - %tmp = getelementptr inbounds %.qux.2585, %.qux.2585* %this, i32 0, i32 2 - %tmp1 = load i8*, i8** %tmp, align 4 - ret i8* %tmp1 -} diff --git a/llvm/test/Transforms/MergeFunc/linkonce_odr.ll b/llvm/test/Transforms/MergeFunc/linkonce_odr.ll deleted file mode 100644 index 825f9054d7b..00000000000 --- a/llvm/test/Transforms/MergeFunc/linkonce_odr.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s -implicit-check-not=funC - -; Replacments should be totally ordered on the function name. -; If we don't do this we can end up with one module defining a thunk for @funA -; and another module defining a thunk for @funB. -; -; The problem with this is that the linker could then choose these two stubs -; each of the two modules and we end up with two stubs calling each other. - -; CHECK-LABEL: define linkonce_odr i32 @funA -; CHECK-NEXT: add -; CHECK: ret - -; CHECK-LABEL: define linkonce_odr i32 @funB -; CHECK-NEXT: tail call i32 @funA(i32 %0, i32 %1) -; CHECK-NEXT: ret - -define linkonce_odr i32 @funC(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %x, %sum - %sum3 = add i32 %x, %sum2 - ret i32 %sum3 -} - -define linkonce_odr i32 @funB(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %x, %sum - %sum3 = add i32 %x, %sum2 - ret i32 %sum3 -} - -define linkonce_odr i32 @funA(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %x, %sum - %sum3 = add i32 %x, %sum2 - ret i32 %sum3 -} - -; This creates a use of @funB, preventing -mergefunc from deleting it. -; @funC, however, can safely be deleted as it has no uses, and is discardable -; if unused. -@take_addr_of_funB = global i8* bitcast (i32 (i32, i32)* @funB to i8*) diff --git a/llvm/test/Transforms/MergeFunc/merge-block-address-other-function.ll b/llvm/test/Transforms/MergeFunc/merge-block-address-other-function.ll deleted file mode 100644 index ca1a6f2fe2a..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-block-address-other-function.ll +++ /dev/null @@ -1,49 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @_Z1fi(i32 %i) #0 { -entry: - %retval = alloca i32, align 4 - %i.addr = alloca i32, align 4 - store i32 %i, i32* %i.addr, align 4 - %0 = load i32, i32* %i.addr, align 4 - %cmp = icmp eq i32 %0, 1 - br i1 %cmp, label %if.then, label %if.end - -if.then: - store i32 3, i32* %retval - br label %return - -if.end: - %1 = load i32, i32* %i.addr, align 4 - %cmp1 = icmp eq i32 %1, 3 - br i1 %cmp1, label %if.then.2, label %if.end.3 - -if.then.2: - store i32 56, i32* %retval - br label %return - -if.end.3: - store i32 0, i32* %retval - br label %return - -return: - %2 = load i32, i32* %retval - ret i32 %2 -} - - -define internal i8* @Afunc(i32* %P) { - store i32 1, i32* %P - store i32 3, i32* %P - ret i8* blockaddress(@_Z1fi, %if.then.2) -} - -define internal i8* @Bfunc(i32* %P) { -; CHECK-NOT: @Bfunc - store i32 1, i32* %P - store i32 3, i32* %P - ret i8* blockaddress(@_Z1fi, %if.then.2) -} diff --git a/llvm/test/Transforms/MergeFunc/merge-block-address.ll b/llvm/test/Transforms/MergeFunc/merge-block-address.ll deleted file mode 100644 index 4ce13e5da87..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-block-address.ll +++ /dev/null @@ -1,91 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; These two functions are identical. The basic block labels are the same, and -; induce the same CFG. We are testing that block addresses within different -; functions are compared by their value, and not based on order. Both functions -; come from the same C-code, but in the first the two val_0/val_1 basic blocks -; are in a different order (they were manually switched post-compilation). - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @_Z1fi(i32 %i) #0 { -entry: - %i.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %l = alloca i8*, align 8 - store i32 %i, i32* %i.addr, align 4 - store i32 0, i32* %ret, align 4 - store i8* blockaddress(@_Z1fi, %val_0), i8** %l, align 8 - %0 = load i32, i32* %i.addr, align 4 - %and = and i32 %0, 256 - %cmp = icmp eq i32 %and, 0 - br i1 %cmp, label %if.then, label %if.end - -if.then: - store i8* blockaddress(@_Z1fi, %val_1), i8** %l, align 8 - br label %if.end - -if.end: - %1 = load i8*, i8** %l, align 8 - br label %indirectgoto - -val_1: - store i32 42, i32* %ret, align 4 - br label %end - -val_0: - store i32 12, i32* %ret, align 4 - br label %end - - -end: - %2 = load i32, i32* %ret, align 4 - ret i32 %2 - -indirectgoto: - %indirect.goto.dest = phi i8* [ %1, %if.end ] - indirectbr i8* %indirect.goto.dest, [label %val_0, label %val_1] -} - -define i32 @_Z1gi(i32 %i) #0 { -; CHECK-LABEL: define i32 @_Z1gi -; CHECK-NEXT: tail call i32 @_Z1fi -; CHECK-NEXT: ret -entry: - %i.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %l = alloca i8*, align 8 - store i32 %i, i32* %i.addr, align 4 - store i32 0, i32* %ret, align 4 - store i8* blockaddress(@_Z1gi, %val_0), i8** %l, align 8 - %0 = load i32, i32* %i.addr, align 4 - %and = and i32 %0, 256 - %cmp = icmp eq i32 %and, 0 - br i1 %cmp, label %if.then, label %if.end - -if.then: - store i8* blockaddress(@_Z1gi, %val_1), i8** %l, align 8 - br label %if.end - -if.end: - %1 = load i8*, i8** %l, align 8 - br label %indirectgoto - -val_0: - store i32 12, i32* %ret, align 4 - br label %end - -val_1: - store i32 42, i32* %ret, align 4 - br label %end - -end: - %2 = load i32, i32* %ret, align 4 - ret i32 %2 - -indirectgoto: - %indirect.goto.dest = phi i8* [ %1, %if.end ] - indirectbr i8* %indirect.goto.dest, [label %val_0, label %val_1] -} - diff --git a/llvm/test/Transforms/MergeFunc/merge-const-ptr-and-int.ll b/llvm/test/Transforms/MergeFunc/merge-const-ptr-and-int.ll deleted file mode 100644 index 8c86ab1fbc3..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-const-ptr-and-int.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -; RUN: opt -mergefunc -S < %s | FileCheck -check-prefix=MERGE %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -; Afunc and Bfunc differ only in that one returns i64, the other a pointer. -; These should be merged. -define internal i64 @Afunc(i32* %P, i32* %Q) { -; CHECK-LABEL: define internal i64 @Afunc - store i32 4, i32* %P - store i32 6, i32* %Q - ret i64 0 -} - -define internal i64* @Bfunc(i32* %P, i32* %Q) { -; MERGE-NOT: @Bfunc - store i32 4, i32* %P - store i32 6, i32* %Q - ret i64* null -} - diff --git a/llvm/test/Transforms/MergeFunc/merge-different-vector-types.ll b/llvm/test/Transforms/MergeFunc/merge-different-vector-types.ll deleted file mode 100644 index 7696139b332..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-different-vector-types.ll +++ /dev/null @@ -1,18 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -; RUN: opt -mergefunc -S < %s | FileCheck -check-prefix=MERGE %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -; Merging should still work even if the values are wrapped in a vector. -define internal <2 x i64> @Mfunc(i32* %P, i32* %Q) { -; CHECK-LABEL: define internal <2 x i64> @Mfunc - store i32 1, i32* %P - store i32 1, i32* %Q - ret <2 x i64> <i64 0, i64 0> -} - -define internal <2 x i64*> @Nfunc(i32* %P, i32* %Q) { -; MERGE-NOT: @Nfunc - store i32 1, i32* %P - store i32 1, i32* %Q - ret <2 x i64*> <i64* null, i64* null> -} diff --git a/llvm/test/Transforms/MergeFunc/merge-ptr-and-int.ll b/llvm/test/Transforms/MergeFunc/merge-ptr-and-int.ll deleted file mode 100644 index 4e887cec906..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-ptr-and-int.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - - -declare void @stuff() - -; CHECK-LABEL: @f0( -define void @f0(i64 %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - -; CHECK-LABEL: @f1( -; CHECK: ptrtoint i64* -; CHECK: tail call void @f0(i64 - -define void @f1(i64* %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - diff --git a/llvm/test/Transforms/MergeFunc/merge-small-unnamed-addr.ll b/llvm/test/Transforms/MergeFunc/merge-small-unnamed-addr.ll deleted file mode 100644 index 256f6864761..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-small-unnamed-addr.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; CHECK-NOT: @b - -@x = constant { void ()*, void ()* } { void ()* @a, void ()* @b } -; CHECK: { void ()* @a, void ()* @a } - -define internal void @a() unnamed_addr { - ret void -} - -define internal void @b() unnamed_addr { - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/merge-unnamed-addr-bitcast.ll b/llvm/test/Transforms/MergeFunc/merge-unnamed-addr-bitcast.ll deleted file mode 100644 index 3cefc3eb819..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-unnamed-addr-bitcast.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -%A = type { i32 } -%B = type { i32 } - -; CHECK-NOT: @b - -@x = constant { i32 (i32)*, i32 (i32)* } - { i32 (i32)* bitcast (i32 (%A)* @a to i32 (i32)*), - i32 (i32)* bitcast (i32 (%B)* @b to i32 (i32)*) } -; CHECK: { i32 (i32)* bitcast (i32 (%A)* @a to i32 (i32)*), i32 (i32)* bitcast (i32 (%A)* @a to i32 (i32)*) } - -define internal i32 @a(%A) unnamed_addr { - extractvalue %A %0, 0 - xor i32 %2, 0 - ret i32 %3 -} - -define internal i32 @b(%B) unnamed_addr { - extractvalue %B %0, 0 - xor i32 %2, 0 - ret i32 %3 -} - -define i32 @c(i32) { - insertvalue %B undef, i32 %0, 0 - call i32 @b(%B %2) -; CHECK: call i32 bitcast (i32 (%A)* @a to i32 (%B)*)(%B %2) - ret i32 %3 -} diff --git a/llvm/test/Transforms/MergeFunc/merge-unnamed-addr.ll b/llvm/test/Transforms/MergeFunc/merge-unnamed-addr.ll deleted file mode 100644 index cb34d43c08f..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-unnamed-addr.ll +++ /dev/null @@ -1,18 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; CHECK-NOT: @b - -@x = constant { i32 (i32)*, i32 (i32)* } { i32 (i32)* @a, i32 (i32)* @b } -; CHECK: { i32 (i32)* @a, i32 (i32)* @a } - -define internal i32 @a(i32 %a) unnamed_addr { - %b = xor i32 %a, 0 - %c = xor i32 %b, 0 - ret i32 %c -} - -define internal i32 @b(i32 %a) unnamed_addr { - %b = xor i32 %a, 0 - %c = xor i32 %b, 0 - ret i32 %c -} diff --git a/llvm/test/Transforms/MergeFunc/merge-weak-crash.ll b/llvm/test/Transforms/MergeFunc/merge-weak-crash.ll deleted file mode 100644 index 9d2c5caa4e5..00000000000 --- a/llvm/test/Transforms/MergeFunc/merge-weak-crash.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; CHECK-LABEL: define i32 @func1 -; CHECK: call i32 @func2 -; CHECK: ret - -; CHECK-LABEL: define i32 @func2 -; CHECK: call i32 @unknown -; CHECK: ret - -; CHECK-LABEL: define i32 @func4 -; CHECK: call i32 @func2 -; CHECK: ret - -; CHECK-LABEL: define weak i32 @func3_weak -; CHECK: call i32 @func1 -; CHECK: ret - -define i32 @func1(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = call i32 @func4(i32 %sum, i32 %sum2) - ret i32 %sum3 -} - -define i32 @func4(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = call i32 @unknown(i32 %sum, i32 %sum2) - ret i32 %sum3 -} - -define weak i32 @func3_weak(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = call i32 @func2(i32 %sum, i32 %sum2) - ret i32 %sum3 -} - -define i32 @func2(i32 %x, i32 %y) { - %sum = add i32 %x, %y - %sum2 = add i32 %sum, %y - %sum3 = call i32 @unknown(i32 %sum, i32 %sum2) - ret i32 %sum3 -} - -declare i32 @unknown(i32 %x, i32 %y) diff --git a/llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll b/llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll deleted file mode 100644 index bb633586e87..00000000000 --- a/llvm/test/Transforms/MergeFunc/mergefunc-preserve-debug-info.ll +++ /dev/null @@ -1,223 +0,0 @@ -; RUN: opt -O0 -S -mergefunc -mergefunc-preserve-debug-info < %s | FileCheck %s --check-prefix=OPTIMIZATION_LEVEL_0 -; RUN: opt -O2 -S -mergefunc -mergefunc-preserve-debug-info < %s | FileCheck %s --check-prefix=OPTIMIZATION_LEVEL_2 - -; Preserve debug info in thunks under -mergefunc -mergefunc-preserve-debug-info -; -; We test that: -; At -O0 we have preserved the generated @llvm.dbg.declare debug intrinsics. -; At -O2 we have preserved the generated @llvm.dbg.value debug intrinsics. -; At -O0, stores from the incoming parameters to locations on the stack-frame -; and allocas that create these locations on the stack-frame are preserved. -; Debug info got generated for the call made by the thunk and for its return value. -; The foregoing is the only content of a thunk's entry block. -; A thunk makes a tail call to the shared implementation. -; A thunk's call site is preserved to point to the thunk (with only -mergefunc the -; call site is modified to point to the shared implementation) when both occur -; within the same translation unit. - -; The source code that was used to test and generate this LLVM IR is: -; -; int maxA(int x, int y) { -; int i, m, j; -; if (x > y) -; m = x; -; else -; m = y; -; return m; -; } -; -; int maxB(int x, int y) { -; int i, m, j; -; if (x > y) -; m = x; -; else -; m = y; -; return m; -; } -; -; void f(void) { -; -; maxA(3, 4); -; maxB(1, 9); -; } - -; Function Attrs: nounwind uwtable -define i32 @maxA(i32 %x, i32 %y) !dbg !6 { -entry: - %x.addr = alloca i32, align 4 - %y.addr = alloca i32, align 4 - %i = alloca i32, align 4 - %m = alloca i32, align 4 - %j = alloca i32, align 4 - store i32 %x, i32* %x.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !11, metadata !12), !dbg !13 - store i32 %y, i32* %y.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %y.addr, metadata !14, metadata !12), !dbg !15 - call void @llvm.dbg.declare(metadata i32* %i, metadata !16, metadata !12), !dbg !17 - call void @llvm.dbg.declare(metadata i32* %m, metadata !18, metadata !12), !dbg !19 - call void @llvm.dbg.declare(metadata i32* %j, metadata !20, metadata !12), !dbg !21 - %0 = load i32, i32* %x.addr, align 4, !dbg !22 - %1 = load i32, i32* %y.addr, align 4, !dbg !24 - %cmp = icmp sgt i32 %0, %1, !dbg !25 - br i1 %cmp, label %if.then, label %if.else, !dbg !26 - -if.then: ; preds = %entry - %2 = load i32, i32* %x.addr, align 4, !dbg !27 - store i32 %2, i32* %m, align 4, !dbg !28 - br label %if.end, !dbg !29 - -if.else: ; preds = %entry - %3 = load i32, i32* %y.addr, align 4, !dbg !30 - store i32 %3, i32* %m, align 4, !dbg !31 - br label %if.end - -if.end: ; preds = %if.else, %if.then - %4 = load i32, i32* %m, align 4, !dbg !32 - ret i32 %4, !dbg !33 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) - -; Function Attrs: nounwind uwtable -define i32 @maxB(i32 %x, i32 %y) !dbg !34 { - -; OPTIMIZATION_LEVEL_0: define i32 @maxB(i32 %x, i32 %y) -; OPTIMIZATION_LEVEL_0-NEXT: entry: -; OPTIMIZATION_LEVEL_0-NEXT: %x.addr = alloca i32, align 4 -; OPTIMIZATION_LEVEL_0-NEXT: %y.addr = alloca i32, align 4 -; OPTIMIZATION_LEVEL_0-NEXT: store i32 %x, i32* %x.addr, align 4 -; OPTIMIZATION_LEVEL_0-NEXT: call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_0-NEXT: store i32 %y, i32* %y.addr, align 4 -; OPTIMIZATION_LEVEL_0-NEXT: call void @llvm.dbg.declare(metadata i32* %y.addr, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_0-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_0-NEXT: ret i32 %0, !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_0-NEXT: } - -; OPTIMIZATION_LEVEL_2: define i32 @maxB(i32 %x, i32 %y) -; OPTIMIZATION_LEVEL_2-NEXT: entry: -; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %x, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_2-NEXT: call void @llvm.dbg.value(metadata i32 %y, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_2-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y) #{{[0-9]+}}, !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_2-NEXT: ret i32 %0, !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_2-NEXT: } - -entry: - %x.addr = alloca i32, align 4 - %y.addr = alloca i32, align 4 - %i = alloca i32, align 4 - %m = alloca i32, align 4 - %j = alloca i32, align 4 - store i32 %x, i32* %x.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !35, metadata !12), !dbg !36 - store i32 %y, i32* %y.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %y.addr, metadata !37, metadata !12), !dbg !38 - call void @llvm.dbg.declare(metadata i32* %i, metadata !39, metadata !12), !dbg !40 - call void @llvm.dbg.declare(metadata i32* %m, metadata !41, metadata !12), !dbg !42 - call void @llvm.dbg.declare(metadata i32* %j, metadata !43, metadata !12), !dbg !44 - %0 = load i32, i32* %x.addr, align 4, !dbg !45 - %1 = load i32, i32* %y.addr, align 4, !dbg !47 - %cmp = icmp sgt i32 %0, %1, !dbg !48 - br i1 %cmp, label %if.then, label %if.else, !dbg !49 - -if.then: ; preds = %entry - %2 = load i32, i32* %x.addr, align 4, !dbg !50 - store i32 %2, i32* %m, align 4, !dbg !51 - br label %if.end, !dbg !52 - -if.else: ; preds = %entry - %3 = load i32, i32* %y.addr, align 4, !dbg !53 - store i32 %3, i32* %m, align 4, !dbg !54 - br label %if.end - -if.end: ; preds = %if.else, %if.then - %4 = load i32, i32* %m, align 4, !dbg !55 - ret i32 %4, !dbg !56 -} - -; Function Attrs: nounwind uwtable -define void @f() !dbg !57 { -entry: - -; OPTIMIZATION_LEVEL_0: define void @f() -; OPTIMIZATION_LEVEL_0-NEXT: entry: -; OPTIMIZATION_LEVEL_0-NEXT: %call = call i32 @maxA(i32 3, i32 4), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_0-NEXT: %call1 = call i32 @maxB(i32 1, i32 9), !dbg !{{[0-9]+}} -; OPTIMIZATION_LEVEL_0-NEXT: ret void, !dbg !{{[0-9]+}} - -; OPTIMIZATION_LEVEL_2: define void @f() -; OPTIMIZATION_LEVEL_2-NEXT: entry: -; OPTIMIZATION_LEVEL_2-NEXT: ret void, !dbg !{{[0-9]+}} - - %call = call i32 @maxA(i32 3, i32 4), !dbg !60 - %call1 = call i32 @maxB(i32 1, i32 9), !dbg !61 - ret void, !dbg !62 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3, !4} -!llvm.ident = !{!5} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) -!1 = !DIFile(filename: "mergefunc-preserve-debug-info.c", directory: "") -!2 = !{} -!3 = !{i32 2, !"Dwarf Version", i32 4} -!4 = !{i32 2, !"Debug Info Version", i32 3} -!5 = !{!""} -!6 = distinct !DISubprogram(name: "maxA", scope: !7, file: !7, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) -!7 = !DIFile(filename: "./mergefunc-preserve-debug-info.c", directory: "") -!8 = !DISubroutineType(types: !9) -!9 = !{!10, !10, !10} -!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!11 = !DILocalVariable(name: "x", arg: 1, scope: !6, file: !7, line: 1, type: !10) -!12 = !DIExpression() -!13 = !DILocation(line: 1, column: 14, scope: !6) -!14 = !DILocalVariable(name: "y", arg: 2, scope: !6, file: !7, line: 1, type: !10) -!15 = !DILocation(line: 1, column: 21, scope: !6) -!16 = !DILocalVariable(name: "i", scope: !6, file: !7, line: 2, type: !10) -!17 = !DILocation(line: 2, column: 7, scope: !6) -!18 = !DILocalVariable(name: "m", scope: !6, file: !7, line: 2, type: !10) -!19 = !DILocation(line: 2, column: 10, scope: !6) -!20 = !DILocalVariable(name: "j", scope: !6, file: !7, line: 2, type: !10) -!21 = !DILocation(line: 2, column: 13, scope: !6) -!22 = !DILocation(line: 3, column: 7, scope: !23) -!23 = distinct !DILexicalBlock(scope: !6, file: !7, line: 3, column: 7) -!24 = !DILocation(line: 3, column: 11, scope: !23) -!25 = !DILocation(line: 3, column: 9, scope: !23) -!26 = !DILocation(line: 3, column: 7, scope: !6) -!27 = !DILocation(line: 4, column: 9, scope: !23) -!28 = !DILocation(line: 4, column: 7, scope: !23) -!29 = !DILocation(line: 4, column: 5, scope: !23) -!30 = !DILocation(line: 6, column: 9, scope: !23) -!31 = !DILocation(line: 6, column: 7, scope: !23) -!32 = !DILocation(line: 7, column: 10, scope: !6) -!33 = !DILocation(line: 7, column: 3, scope: !6) -!34 = distinct !DISubprogram(name: "maxB", scope: !7, file: !7, line: 10, type: !8, isLocal: false, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) -!35 = !DILocalVariable(name: "x", arg: 1, scope: !34, file: !7, line: 10, type: !10) -!36 = !DILocation(line: 10, column: 14, scope: !34) -!37 = !DILocalVariable(name: "y", arg: 2, scope: !34, file: !7, line: 10, type: !10) -!38 = !DILocation(line: 10, column: 21, scope: !34) -!39 = !DILocalVariable(name: "i", scope: !34, file: !7, line: 11, type: !10) -!40 = !DILocation(line: 11, column: 7, scope: !34) -!41 = !DILocalVariable(name: "m", scope: !34, file: !7, line: 11, type: !10) -!42 = !DILocation(line: 11, column: 10, scope: !34) -!43 = !DILocalVariable(name: "j", scope: !34, file: !7, line: 11, type: !10) -!44 = !DILocation(line: 11, column: 13, scope: !34) -!45 = !DILocation(line: 12, column: 7, scope: !46) -!46 = distinct !DILexicalBlock(scope: !34, file: !7, line: 12, column: 7) -!47 = !DILocation(line: 12, column: 11, scope: !46) -!48 = !DILocation(line: 12, column: 9, scope: !46) -!49 = !DILocation(line: 12, column: 7, scope: !34) -!50 = !DILocation(line: 13, column: 9, scope: !46) -!51 = !DILocation(line: 13, column: 7, scope: !46) -!52 = !DILocation(line: 13, column: 5, scope: !46) -!53 = !DILocation(line: 15, column: 9, scope: !46) -!54 = !DILocation(line: 15, column: 7, scope: !46) -!55 = !DILocation(line: 16, column: 10, scope: !34) -!56 = !DILocation(line: 16, column: 3, scope: !34) -!57 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 19, type: !58, isLocal: false, isDefinition: true, scopeLine: 19, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) -!58 = !DISubroutineType(types: !59) -!59 = !{null} -!60 = !DILocation(line: 21, column: 3, scope: !57) -!61 = !DILocation(line: 22, column: 3, scope: !57) -!62 = !DILocation(line: 23, column: 1, scope: !57) diff --git a/llvm/test/Transforms/MergeFunc/mergefunc-struct-return.ll b/llvm/test/Transforms/MergeFunc/mergefunc-struct-return.ll deleted file mode 100644 index 14db39995e7..00000000000 --- a/llvm/test/Transforms/MergeFunc/mergefunc-struct-return.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s - -; This test makes sure that the mergefunc pass, uses extract and insert value -; to convert the struct result type; as struct types cannot be bitcast. - -target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32" - -%kv1 = type { i32*, i32* } -%kv2 = type { i8*, i8* } - -declare void @noop() - -define %kv1 @fn1() { -; CHECK-LABEL: @fn1( - %tmp = alloca %kv1 - %v1 = getelementptr %kv1, %kv1* %tmp, i32 0, i32 0 - store i32* null, i32** %v1 - %v2 = getelementptr %kv1, %kv1* %tmp, i32 0, i32 0 - store i32* null, i32** %v2 - call void @noop() - %v3 = load %kv1, %kv1* %tmp - ret %kv1 %v3 -} - -define %kv2 @fn2() { -; CHECK-LABEL: @fn2( -; CHECK: %1 = tail call %kv1 @fn1() -; CHECK: %2 = extractvalue %kv1 %1, 0 -; CHECK: %3 = bitcast i32* %2 to i8* -; CHECK: %4 = insertvalue %kv2 undef, i8* %3, 0 - %tmp = alloca %kv2 - %v1 = getelementptr %kv2, %kv2* %tmp, i32 0, i32 0 - store i8* null, i8** %v1 - %v2 = getelementptr %kv2, %kv2* %tmp, i32 0, i32 0 - store i8* null, i8** %v2 - call void @noop() - - %v3 = load %kv2, %kv2* %tmp - ret %kv2 %v3 -} diff --git a/llvm/test/Transforms/MergeFunc/no-merge-block-address-different-labels.ll b/llvm/test/Transforms/MergeFunc/no-merge-block-address-different-labels.ll deleted file mode 100644 index 3024a9a76a7..00000000000 --- a/llvm/test/Transforms/MergeFunc/no-merge-block-address-different-labels.ll +++ /dev/null @@ -1,96 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; There is a slight different in these two functions, in that the label values -; are switched. They are thus not mergeable. This tests that block addresses -; referring to blocks within each respective compared function are correctly -; ordered. - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; Function Attrs: nounwind uwtable -define i32 @_Z1fi(i32 %i) #0 { -; CHECK-LABEL: define i32 @_Z1fi -; CHECK-NEXT: entry: -; CHECK-NEXT: alloca -entry: - %i.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %l = alloca i8*, align 8 - store i32 %i, i32* %i.addr, align 4 - store i32 0, i32* %ret, align 4 -; Right here, this is val_0, and later the if might assign val_1 - store i8* blockaddress(@_Z1fi, %val_0), i8** %l, align 8 - %0 = load i32, i32* %i.addr, align 4 - %and = and i32 %0, 256 - %cmp = icmp eq i32 %and, 0 - br i1 %cmp, label %if.then, label %if.end - -if.then: - store i8* blockaddress(@_Z1fi, %val_1), i8** %l, align 8 - br label %if.end - -if.end: - %1 = load i8*, i8** %l, align 8 - br label %indirectgoto - -val_0: - store i32 12, i32* %ret, align 4 - br label %end - -val_1: - store i32 42, i32* %ret, align 4 - br label %end - -end: - %2 = load i32, i32* %ret, align 4 - ret i32 %2 - -indirectgoto: - %indirect.goto.dest = phi i8* [ %1, %if.end ] - indirectbr i8* %indirect.goto.dest, [label %val_0, label %val_1] -} - -; Function Attrs: nounwind uwtable -define i32 @_Z1gi(i32 %i) #0 { -; CHECK-LABEL: define i32 @_Z1gi -; CHECK-NEXT: entry: -; CHECK-NEXT: alloca -entry: - %i.addr = alloca i32, align 4 - %ret = alloca i32, align 4 - %l = alloca i8*, align 8 - store i32 %i, i32* %i.addr, align 4 - store i32 0, i32* %ret, align 4 -; This time, we store val_1 initially, and later the if might assign val_0 - store i8* blockaddress(@_Z1gi, %val_1), i8** %l, align 8 - %0 = load i32, i32* %i.addr, align 4 - %and = and i32 %0, 256 - %cmp = icmp eq i32 %and, 0 - br i1 %cmp, label %if.then, label %if.end - -if.then: - store i8* blockaddress(@_Z1gi, %val_0), i8** %l, align 8 - br label %if.end - -if.end: - %1 = load i8*, i8** %l, align 8 - br label %indirectgoto - -val_0: - store i32 12, i32* %ret, align 4 - br label %end - -val_1: - store i32 42, i32* %ret, align 4 - br label %end - -end: - %2 = load i32, i32* %ret, align 4 - ret i32 %2 - -indirectgoto: - %indirect.goto.dest = phi i8* [ %1, %if.end ] - indirectbr i8* %indirect.goto.dest, [label %val_1, label %val_0] -} - diff --git a/llvm/test/Transforms/MergeFunc/no-merge-block-address-other-function.ll b/llvm/test/Transforms/MergeFunc/no-merge-block-address-other-function.ll deleted file mode 100644 index e1aa30ac55a..00000000000 --- a/llvm/test/Transforms/MergeFunc/no-merge-block-address-other-function.ll +++ /dev/null @@ -1,61 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; We should not merge these two functions, because the blocks are different. -; This tests the handling of block addresses from different functions. -; ModuleID = '<stdin>' -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - - -define internal i8* @Afunc(i32* %P) { -; CHECK-LABEL: @Afunc -; CHECK-NEXT: store -; CHECK-NEXT: store -; CHECK-NEXT: ret - store i32 1, i32* %P - store i32 3, i32* %P - ret i8* blockaddress(@_Z1fi, %if.then) -} - -define internal i8* @Bfunc(i32* %P) { -; CHECK-LABEL: @Bfunc -; CHECK-NEXT: store -; CHECK-NEXT: store -; CHECK-NEXT: ret - store i32 1, i32* %P - store i32 3, i32* %P - ret i8* blockaddress(@_Z1fi, %if.then.2) -} - - -; Function Attrs: nounwind uwtable -define i32 @_Z1fi(i32 %i) #0 { -entry: - %retval = alloca i32, align 4 - %i.addr = alloca i32, align 4 - store i32 %i, i32* %i.addr, align 4 - %0 = load i32, i32* %i.addr, align 4 - %cmp = icmp eq i32 %0, 1 - br i1 %cmp, label %if.then, label %if.end - -if.then: - store i32 3, i32* %retval - br label %return - -if.end: - %1 = load i32, i32* %i.addr, align 4 - %cmp1 = icmp eq i32 %1, 3 - br i1 %cmp1, label %if.then.2, label %if.end.3 - -if.then.2: - store i32 56, i32* %retval - br label %return - -if.end.3: - store i32 0, i32* %retval - br label %return - -return: - %2 = load i32, i32* %retval - ret i32 %2 -} diff --git a/llvm/test/Transforms/MergeFunc/no-merge-ptr-different-sizes.ll b/llvm/test/Transforms/MergeFunc/no-merge-ptr-different-sizes.ll deleted file mode 100644 index c0c6dab792d..00000000000 --- a/llvm/test/Transforms/MergeFunc/no-merge-ptr-different-sizes.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -; These should not be merged, as the datalayout says a pointer is 64 bits. No -; sext/zext is specified, so these functions could lower differently. -define internal i32 @Ffunc(i32* %P, i32* %Q) { -; CHECK-LABEL: define internal i32 @Ffunc -; CHECK-NEXT: store -; CHECK-NEXT: store -; CHECK-NEXT: ret - store i32 1, i32* %P - store i32 3, i32* %Q - ret i32 0 -} - -define internal i64* @Gfunc(i32* %P, i32* %Q) { -; CHECK-LABEL: define internal i64* @Gfunc -; CHECK-NEXT: store -; CHECK-NEXT: store -; CHECK-NEXT: ret - store i32 1, i32* %P - store i32 3, i32* %Q - ret i64* null -} diff --git a/llvm/test/Transforms/MergeFunc/no-merge-ptr-int-different-values.ll b/llvm/test/Transforms/MergeFunc/no-merge-ptr-int-different-values.ll deleted file mode 100644 index 6bd656408ac..00000000000 --- a/llvm/test/Transforms/MergeFunc/no-merge-ptr-int-different-values.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -; These should not be merged, as 1 != 0. -define internal i64 @Ifunc(i32* %P, i32* %Q) { -; CHECK-LABEL: define internal i64 @Ifunc -; CHECK-NEXT: store -; CHECK-NEXT: store -; CHECK-NEXT: ret - store i32 10, i32* %P - store i32 10, i32* %Q - ret i64 1 -} - -define internal i64* @Jfunc(i32* %P, i32* %Q) { -; CHECK-LABEL: define internal i64* @Jfunc -; CHECK-NEXT: store -; CHECK-NEXT: store -; CHECK-NEXT: ret - store i32 10, i32* %P - store i32 10, i32* %Q - ret i64* null -} diff --git a/llvm/test/Transforms/MergeFunc/nonzero-address-spaces.ll b/llvm/test/Transforms/MergeFunc/nonzero-address-spaces.ll deleted file mode 100644 index 3ee887c9de0..00000000000 --- a/llvm/test/Transforms/MergeFunc/nonzero-address-spaces.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; MergeFunctions should respect the default function address -; space specified in the data layout. - -target datalayout = "e-P1-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -declare void @stuff() - -; CHECK-LABEL: @f0( -define void @f0(i64 %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - -; CHECK-LABEL: @f1( -; CHECK: ptrtoint i64* -; CHECK: tail call addrspace(1) void @f0(i64 - -define void @f1(i64* %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - diff --git a/llvm/test/Transforms/MergeFunc/phi-check-blocks.ll b/llvm/test/Transforms/MergeFunc/phi-check-blocks.ll deleted file mode 100644 index b2de9a0c028..00000000000 --- a/llvm/test/Transforms/MergeFunc/phi-check-blocks.ll +++ /dev/null @@ -1,50 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; Ensure that we do not merge functions that are identical with the -; exception of the order of the incoming blocks to a phi. - -; CHECK-LABEL: define linkonce_odr hidden i1 @first(i2) -define linkonce_odr hidden i1 @first(i2) { -entry: -; CHECK: switch i2 - switch i2 %0, label %default [ - i2 0, label %L1 - i2 1, label %L2 - i2 -2, label %L3 - ] -default: - unreachable -L1: - br label %done -L2: - br label %done -L3: - br label %done -done: - %result = phi i1 [ true, %L1 ], [ false, %L2 ], [ false, %L3 ] -; CHECK: ret i1 - ret i1 %result -} - -; CHECK-LABEL: define linkonce_odr hidden i1 @second(i2) -define linkonce_odr hidden i1 @second(i2) { -entry: -; CHECK: switch i2 - switch i2 %0, label %default [ - i2 0, label %L1 - i2 1, label %L2 - i2 -2, label %L3 - ] -default: - unreachable -L1: - br label %done -L2: - br label %done -L3: - br label %done -done: - %result = phi i1 [ true, %L3 ], [ false, %L2 ], [ false, %L1 ] -; CHECK: ret i1 - ret i1 %result -} diff --git a/llvm/test/Transforms/MergeFunc/phi-speculation1.ll b/llvm/test/Transforms/MergeFunc/phi-speculation1.ll deleted file mode 100644 index 548e5102be1..00000000000 --- a/llvm/test/Transforms/MergeFunc/phi-speculation1.ll +++ /dev/null @@ -1,30 +0,0 @@ -; REQUIRES: asserts -; RUN: opt < %s -mergefunc -stats -disable-output 2>&1 | not grep "functions merged" - -define i32 @foo1(i32 %x) { -entry: - %A = add i32 %x, 1 - %B = call i32 @foo1(i32 %A) - br label %loop -loop: - %C = phi i32 [%B, %entry], [%D, %loop] - %D = add i32 %x, 2 - %E = icmp ugt i32 %D, 10000 - br i1 %E, label %loopexit, label %loop -loopexit: - ret i32 %D -} - -define i32 @foo2(i32 %x) { -entry: - %0 = add i32 %x, 1 - %1 = call i32 @foo2(i32 %0) - br label %loop -loop: - %2 = phi i32 [%1, %entry], [%3, %loop] - %3 = add i32 %2, 2 - %4 = icmp ugt i32 %3, 10000 - br i1 %4, label %loopexit, label %loop -loopexit: - ret i32 %3 -} diff --git a/llvm/test/Transforms/MergeFunc/phi-speculation2.ll b/llvm/test/Transforms/MergeFunc/phi-speculation2.ll deleted file mode 100644 index d42a465d0c6..00000000000 --- a/llvm/test/Transforms/MergeFunc/phi-speculation2.ll +++ /dev/null @@ -1,30 +0,0 @@ -; REQUIRES: asserts -; RUN: opt < %s -mergefunc -stats -disable-output 2>&1 | grep "functions merged" - -define i32 @foo1(i32 %x) { -entry: - %A = add i32 %x, 1 - %B = call i32 @foo1(i32 %A) - br label %loop -loop: - %C = phi i32 [%B, %entry], [%D, %loop] - %D = add i32 %C, 2 - %E = icmp ugt i32 %D, 10000 - br i1 %E, label %loopexit, label %loop -loopexit: - ret i32 %D -} - -define i32 @foo2(i32 %x) { -entry: - %0 = add i32 %x, 1 - %1 = call i32 @foo2(i32 %0) - br label %loop -loop: - %2 = phi i32 [%1, %entry], [%3, %loop] - %3 = add i32 %2, 2 - %4 = icmp ugt i32 %3, 10000 - br i1 %4, label %loopexit, label %loop -loopexit: - ret i32 %3 -} diff --git a/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-1.ll b/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-1.ll deleted file mode 100644 index d6ff10f8257..00000000000 --- a/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-1.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt -S -mergefunc < %s | not grep "functions merged" -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -declare void @stuff() - -define void @f0(i64 %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - -define void @f2(i64 addrspace(1)* %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - diff --git a/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-2.ll b/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-2.ll deleted file mode 100644 index c9fb6a6ea35..00000000000 --- a/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-2.ll +++ /dev/null @@ -1,25 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -declare void @stuff() - -define void @f0(i64 %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - -; CHECK-LABEL: @f0 -; CHECK: %2 = ptrtoint i64* %0 to i64 -; CHECK: tail call void @f0(i64 %2) -; CHECK: ret void -define void @f1(i64 addrspace(0)* %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - diff --git a/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-3.ll b/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-3.ll deleted file mode 100644 index 8f00f033396..00000000000 --- a/llvm/test/Transforms/MergeFunc/ptr-int-transitivity-3.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt -S -mergefunc < %s | not grep "functions merged" -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -declare void @stuff() - -define void @f0(i64 addrspace(0)* %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - -define void @f2(i64 addrspace(1)* %p0) { -entry: - call void @stuff() - call void @stuff() - call void @stuff() - ret void -} - diff --git a/llvm/test/Transforms/MergeFunc/ranges-multiple.ll b/llvm/test/Transforms/MergeFunc/ranges-multiple.ll deleted file mode 100644 index bfa775d217a..00000000000 --- a/llvm/test/Transforms/MergeFunc/ranges-multiple.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -define i1 @cmp_with_range(i8*, i8*) { - %v1 = load i8, i8* %0, !range !0 - %v2 = load i8, i8* %1, !range !0 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -define i1 @cmp_no_range(i8*, i8*) { -; CHECK-LABEL: @cmp_no_range -; CHECK-NEXT: %v1 = load i8, i8* %0 -; CHECK-NEXT: %v2 = load i8, i8* %1 -; CHECK-NEXT: %out = icmp eq i8 %v1, %v2 -; CHECK-NEXT: ret i1 %out - %v1 = load i8, i8* %0 - %v2 = load i8, i8* %1 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -define i1 @cmp_different_range(i8*, i8*) { -; CHECK-LABEL: @cmp_different_range -; CHECK-NEXT: %v1 = load i8, i8* %0, !range !1 -; CHECK-NEXT: %v2 = load i8, i8* %1, !range !1 -; CHECK-NEXT: %out = icmp eq i8 %v1, %v2 -; CHECK-NEXT: ret i1 %out - %v1 = load i8, i8* %0, !range !1 - %v2 = load i8, i8* %1, !range !1 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -define i1 @cmp_with_same_range(i8*, i8*) { -; CHECK-LABEL: @cmp_with_same_range -; CHECK: tail call i1 @cmp_with_range - %v1 = load i8, i8* %0, !range !0 - %v2 = load i8, i8* %1, !range !0 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -; The comparison must check every element of the range, not just the first pair. -!0 = !{i8 0, i8 2, i8 21, i8 30} -!1 = !{i8 0, i8 2, i8 21, i8 25} diff --git a/llvm/test/Transforms/MergeFunc/ranges.ll b/llvm/test/Transforms/MergeFunc/ranges.ll deleted file mode 100644 index 44e71300703..00000000000 --- a/llvm/test/Transforms/MergeFunc/ranges.ll +++ /dev/null @@ -1,43 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -define i1 @cmp_with_range(i8*, i8*) { - %v1 = load i8, i8* %0, !range !0 - %v2 = load i8, i8* %1, !range !0 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -define i1 @cmp_no_range(i8*, i8*) { -; CHECK-LABEL: @cmp_no_range -; CHECK-NEXT: %v1 = load i8, i8* %0 -; CHECK-NEXT: %v2 = load i8, i8* %1 -; CHECK-NEXT: %out = icmp eq i8 %v1, %v2 -; CHECK-NEXT: ret i1 %out - %v1 = load i8, i8* %0 - %v2 = load i8, i8* %1 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -define i1 @cmp_different_range(i8*, i8*) { -; CHECK-LABEL: @cmp_different_range -; CHECK-NEXT: %v1 = load i8, i8* %0, !range !1 -; CHECK-NEXT: %v2 = load i8, i8* %1, !range !1 -; CHECK-NEXT: %out = icmp eq i8 %v1, %v2 -; CHECK-NEXT: ret i1 %out - %v1 = load i8, i8* %0, !range !1 - %v2 = load i8, i8* %1, !range !1 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -define i1 @cmp_with_same_range(i8*, i8*) { -; CHECK-LABEL: @cmp_with_same_range -; CHECK: tail call i1 @cmp_with_range - %v1 = load i8, i8* %0, !range !0 - %v2 = load i8, i8* %1, !range !0 - %out = icmp eq i8 %v1, %v2 - ret i1 %out -} - -!0 = !{i8 0, i8 2} -!1 = !{i8 5, i8 7} diff --git a/llvm/test/Transforms/MergeFunc/self-referential-global.ll b/llvm/test/Transforms/MergeFunc/self-referential-global.ll deleted file mode 100644 index d3d1c62aa7f..00000000000 --- a/llvm/test/Transforms/MergeFunc/self-referential-global.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: opt -mergefunc -disable-output < %s - -; A linked list type and simple payload -%LL = type { %S, %LL* } -%S = type { void (%S*, i32)* } - -; Table refers to itself via GEP -@Table = internal global [3 x %LL] [%LL { %S { void (%S*, i32)* @B }, %LL* getelementptr inbounds ([3 x %LL], [3 x %LL]* @Table, i32 0, i32 0) }, %LL { %S { void (%S*, i32)* @A }, %LL* getelementptr inbounds ([3 x %LL], [3 x %LL]* @Table, i32 0, i32 0) }, %LL { %S { void (%S*, i32)* @A }, %LL* getelementptr inbounds ([3 x %LL], [3 x %LL]* @Table, i32 0, i32 0) }], align 16 - -; The body of this is irrelevant; it is long so that mergefunc doesn't skip it as a small function. -define internal void @A(%S* %self, i32 %a) { - %1 = add i32 %a, 32 - %2 = add i32 %1, 32 - %3 = add i32 %2, 32 - %4 = add i32 %3, 32 - %5 = add i32 %4, 32 - %6 = add i32 %5, 32 - %7 = add i32 %6, 32 - %8 = add i32 %7, 32 - %9 = add i32 %8, 32 - %10 = add i32 %9, 32 - %11 = add i32 %10, 32 - ret void -} - -define internal void @B(%S* %self, i32 %a) { - %1 = add i32 %a, 32 - %2 = add i32 %1, 32 - %3 = add i32 %2, 32 - %4 = add i32 %3, 32 - %5 = add i32 %4, 32 - %6 = add i32 %5, 32 - %7 = add i32 %6, 32 - %8 = add i32 %7, 32 - %9 = add i32 %8, 32 - %10 = add i32 %9, 32 - %11 = add i32 %10, 32 - ret void -} - diff --git a/llvm/test/Transforms/MergeFunc/tailcall.ll b/llvm/test/Transforms/MergeFunc/tailcall.ll deleted file mode 100644 index 8adf45ab2ff..00000000000 --- a/llvm/test/Transforms/MergeFunc/tailcall.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s - -declare void @dummy() - -; CHECK-LABEL: define{{.*}}@foo -; CHECK: call {{.*}}@dummy -; CHECK: musttail {{.*}}@dummy -define void @foo() { - call void @dummy() - musttail call void @dummy() - ret void -} - -; CHECK-LABEL: define{{.*}}@bar -; CHECK: call {{.*}}@dummy -; CHECK: call {{.*}}@dummy -define void @bar() { - call void @dummy() - call void @dummy() - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/too-small.ll b/llvm/test/Transforms/MergeFunc/too-small.ll deleted file mode 100644 index 1a526ffd50a..00000000000 --- a/llvm/test/Transforms/MergeFunc/too-small.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -define void @foo(i32 %x) { -; CHECK-LABEL: @foo( -; CHECK-NOT: call - ret void -} - -define void @bar(i32 %x) { -; CHECK-LABEL: @bar( -; CHECK-NOT: call - ret void -} - diff --git a/llvm/test/Transforms/MergeFunc/undef-different-types.ll b/llvm/test/Transforms/MergeFunc/undef-different-types.ll deleted file mode 100644 index 4694146e55f..00000000000 --- a/llvm/test/Transforms/MergeFunc/undef-different-types.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s -; RUN: opt -mergefunc -S < %s | FileCheck -check-prefix=MERGE %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -; Cfunc and Dfunc differ only in that one returns i64, the other a pointer, and -; both return undef. They should be merged. Note undef cannot be merged with -; anything else, because this implies the ordering will be inconsistent (i.e. -; -1 == undef and undef == 1, but -1 < 1, so we must have undef != <any int>). -define internal i64 @Cfunc(i32* %P, i32* %Q) { -; CHECK-LABEL: define internal i64 @Cfunc - store i32 4, i32* %P - store i32 6, i32* %Q - ret i64 undef -} - -define internal i64* @Dfunc(i32* %P, i32* %Q) { -; MERGE-NOT: @Dfunc - store i32 4, i32* %P - store i32 6, i32* %Q - ret i64* undef -} diff --git a/llvm/test/Transforms/MergeFunc/unnamed-addr-reprocessing.ll b/llvm/test/Transforms/MergeFunc/unnamed-addr-reprocessing.ll deleted file mode 100644 index 5902edc0e88..00000000000 --- a/llvm/test/Transforms/MergeFunc/unnamed-addr-reprocessing.ll +++ /dev/null @@ -1,35 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s - -; After test3 and test4 have been merged, we should detect that -; test1 and test2 can also be merged. - -; CHECK: define void @test4() unnamed_addr -; CHECK-NEXT: tail call void @test3() -; CHECK: define void @test2() unnamed_addr -; CHECK-NEXT: tail call void @test1() - -declare void @dummy() - -define void @test1() unnamed_addr { - call void @test3() - call void @test3() - ret void -} - -define void @test2() unnamed_addr { - call void @test4() - call void @test4() - ret void -} - -define void @test3() unnamed_addr { - call void @dummy() - call void @dummy() - ret void -} - -define void @test4() unnamed_addr { - call void @dummy() - call void @dummy() - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/va_arg.ll b/llvm/test/Transforms/MergeFunc/va_arg.ll deleted file mode 100644 index 1a48a6395ed..00000000000 --- a/llvm/test/Transforms/MergeFunc/va_arg.ll +++ /dev/null @@ -1,93 +0,0 @@ -; RUN: opt -S -mergefunc < %s | FileCheck %s -; RUN: opt -S -mergefunc -mergefunc-use-aliases < %s | FileCheck %s -check-prefix=ALIAS - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; ALIAS: @_Z9simple_vaPKcz = unnamed_addr alias void (i8*, ...), void (i8*, ...)* @_Z10simple_va2PKcz -; ALIAS-NOT: @_Z9simple_vaPKcz - -%struct.__va_list_tag = type { i32, i32, i8*, i8* } - -; CHECK-LABEL: define {{.*}}@_Z9simple_vaPKcz -; CHECK: call void @llvm.va_start -; CHECK: call void @llvm.va_end -define dso_local void @_Z9simple_vaPKcz(i8* nocapture readnone, ...) unnamed_addr { - %2 = alloca [1 x %struct.__va_list_tag], align 16 - %3 = bitcast [1 x %struct.__va_list_tag]* %2 to i8* - call void @llvm.va_start(i8* nonnull %3) - %4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 0 - %5 = load i32, i32* %4, align 16 - %6 = icmp ult i32 %5, 41 - br i1 %6, label %7, label %13 - -; <label>:7: ; preds = %1 - %8 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 3 - %9 = load i8*, i8** %8, align 16 - %10 = sext i32 %5 to i64 - %11 = getelementptr i8, i8* %9, i64 %10 - %12 = add i32 %5, 8 - store i32 %12, i32* %4, align 16 - br label %17 - -; <label>:13: ; preds = %1 - %14 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 2 - %15 = load i8*, i8** %14, align 8 - %16 = getelementptr i8, i8* %15, i64 8 - store i8* %16, i8** %14, align 8 - br label %17 - -; <label>:17: ; preds = %13, %7 - %18 = phi i8* [ %11, %7 ], [ %15, %13 ] - %19 = bitcast i8* %18 to i32* - %20 = load i32, i32* %19, align 4 - call void @_Z6escapei(i32 %20) - call void @llvm.va_end(i8* nonnull %3) - ret void -} - -; Function Attrs: nounwind -declare void @llvm.va_start(i8*) - -; Function Attrs: minsize optsize -declare dso_local void @_Z6escapei(i32) local_unnamed_addr - -; Function Attrs: nounwind -declare void @llvm.va_end(i8*) - -; CHECK-LABEL: define {{.*}}@_Z10simple_va2PKcz -; CHECK: call void @llvm.va_start -; CHECK: call void @llvm.va_end -define dso_local void @_Z10simple_va2PKcz(i8* nocapture readnone, ...) unnamed_addr { - %2 = alloca [1 x %struct.__va_list_tag], align 16 - %3 = bitcast [1 x %struct.__va_list_tag]* %2 to i8* - call void @llvm.va_start(i8* nonnull %3) - %4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 0 - %5 = load i32, i32* %4, align 16 - %6 = icmp ult i32 %5, 41 - br i1 %6, label %7, label %13 - -; <label>:7: ; preds = %1 - %8 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 3 - %9 = load i8*, i8** %8, align 16 - %10 = sext i32 %5 to i64 - %11 = getelementptr i8, i8* %9, i64 %10 - %12 = add i32 %5, 8 - store i32 %12, i32* %4, align 16 - br label %17 - -; <label>:13: ; preds = %1 - %14 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %2, i64 0, i64 0, i32 2 - %15 = load i8*, i8** %14, align 8 - %16 = getelementptr i8, i8* %15, i64 8 - store i8* %16, i8** %14, align 8 - br label %17 - -; <label>:17: ; preds = %13, %7 - %18 = phi i8* [ %11, %7 ], [ %15, %13 ] - %19 = bitcast i8* %18 to i32* - %20 = load i32, i32* %19, align 4 - call void @_Z6escapei(i32 %20) - call void @llvm.va_end(i8* nonnull %3) - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/vector-GEP-crash.ll b/llvm/test/Transforms/MergeFunc/vector-GEP-crash.ll deleted file mode 100644 index d0e86ebf54b..00000000000 --- a/llvm/test/Transforms/MergeFunc/vector-GEP-crash.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: opt -mergefunc -disable-output < %s -; This used to cause a crash when compairing the GEPs - -define void @foo(<2 x i64*>) { - %tmp = getelementptr i64, <2 x i64*> %0, <2 x i64> <i64 0, i64 0> - ret void -} - -define void @bar(<2 x i64*>) { - %tmp = getelementptr i64, <2 x i64*> %0, <2 x i64> <i64 0, i64 0> - ret void -} diff --git a/llvm/test/Transforms/MergeFunc/vector.ll b/llvm/test/Transforms/MergeFunc/vector.ll deleted file mode 100644 index db95ec742ba..00000000000 --- a/llvm/test/Transforms/MergeFunc/vector.ll +++ /dev/null @@ -1,72 +0,0 @@ -; REQUIRES: asserts -; RUN: opt -mergefunc -stats -disable-output < %s 2>&1 | grep "functions merged" - -; This test is checks whether we can merge -; vector<intptr_t>::push_back(0) -; and -; vector<void *>::push_back(0) -; . - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -target triple = "x86_64-unknown-linux-gnu" - -%0 = type { i32, void ()* } -%1 = type { i64, i1 } -%"class.std::vector" = type { [24 x i8] } - -@vi = global %"class.std::vector" zeroinitializer, align 8 -@__dso_handle = external unnamed_addr global i8* -@vp = global %"class.std::vector" zeroinitializer, align 8 -@llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @_GLOBAL__I_a }] - -define linkonce_odr void @_ZNSt6vectorIlSaIlEED1Ev(%"class.std::vector"* nocapture %this) unnamed_addr align 2 { -entry: - %tmp2.i.i = bitcast %"class.std::vector"* %this to i64** - %tmp3.i.i = load i64*, i64** %tmp2.i.i, align 8 - %tobool.i.i.i = icmp eq i64* %tmp3.i.i, null - br i1 %tobool.i.i.i, label %_ZNSt6vectorIlSaIlEED2Ev.exit, label %if.then.i.i.i - -if.then.i.i.i: ; preds = %entry - %0 = bitcast i64* %tmp3.i.i to i8* - tail call void @_ZdlPv(i8* %0) nounwind - ret void - -_ZNSt6vectorIlSaIlEED2Ev.exit: ; preds = %entry - ret void -} - -declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) - -define linkonce_odr void @_ZNSt6vectorIPvSaIS0_EED1Ev(%"class.std::vector"* nocapture %this) unnamed_addr align 2 { -entry: - %tmp2.i.i = bitcast %"class.std::vector"* %this to i8*** - %tmp3.i.i = load i8**, i8*** %tmp2.i.i, align 8 - %tobool.i.i.i = icmp eq i8** %tmp3.i.i, null - br i1 %tobool.i.i.i, label %_ZNSt6vectorIPvSaIS0_EED2Ev.exit, label %if.then.i.i.i - -if.then.i.i.i: ; preds = %entry - %0 = bitcast i8** %tmp3.i.i to i8* - tail call void @_ZdlPv(i8* %0) nounwind - ret void - -_ZNSt6vectorIPvSaIS0_EED2Ev.exit: ; preds = %entry - ret void -} - -declare void @_Z1fv() - -declare void @_ZNSt6vectorIPvSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_(%"class.std::vector"* nocapture %this, i8** %__position.coerce, i8** nocapture %__x) align 2 - -declare void @_ZdlPv(i8*) nounwind - -declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind - -declare void @_ZSt17__throw_bad_allocv() noreturn - -declare noalias i8* @_Znwm(i64) - -declare void @_ZNSt6vectorIlSaIlEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPlS1_EERKl(%"class.std::vector"* nocapture %this, i64* %__position.coerce, i64* nocapture %__x) align 2 - -declare void @_GLOBAL__I_a() - -declare %1 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone diff --git a/llvm/test/Transforms/MergeFunc/vectors-and-arrays.ll b/llvm/test/Transforms/MergeFunc/vectors-and-arrays.ll deleted file mode 100644 index 22747224a19..00000000000 --- a/llvm/test/Transforms/MergeFunc/vectors-and-arrays.ll +++ /dev/null @@ -1,19 +0,0 @@ -; REQUIRES: asserts -; RUN: opt -mergefunc < %s -disable-output -stats | not grep merged -; This used to crash with an assert. - -define <2 x i8> @v1(<2 x i8> %x) { - ret <2 x i8> %x -} - -define <4 x i8> @v2(<4 x i8> %x) { - ret <4 x i8> %x -} - -define [2 x i8] @a1([2 x i8] %x) { - ret [2 x i8] %x -} - -define [4 x i8] @a2([4 x i8] %x) { - ret [4 x i8] %x -} diff --git a/llvm/test/Transforms/MergeFunc/weak-small.ll b/llvm/test/Transforms/MergeFunc/weak-small.ll deleted file mode 100644 index 64f10831746..00000000000 --- a/llvm/test/Transforms/MergeFunc/weak-small.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: opt -mergefunc -S < %s | FileCheck %s - -; Weak functions too small for merging to be profitable - -; CHECK: define weak i32 @foo(i8*, i32) -; CHECK-NEXT: ret i32 %1 -; CHECK: define weak i32 @bar(i8*, i32) -; CHECK-NEXT: ret i32 %1 - -define weak i32 @foo(i8*, i32) #0 { - ret i32 %1 -} - -define weak i32 @bar(i8*, i32) #0 { - ret i32 %1 -} |