brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · c24e492 Raw
53 lines · plain
1; REQUIRES: asserts2; RUN: rm -rf %t3; RUN: mkdir %t4; RUN: cp %s %t/1234.ll5;6; default behavior7; RUN: opt -passes=elim-avail-extern -stats -S 2>&1 %s | FileCheck %s --check-prefix=NOOP8;9; check the -avail-extern-to-local flag works as intended10; RUN: opt -passes=elim-avail-extern -avail-extern-to-local -stats -S 2>&1 %t/1234.ll | FileCheck %s11; RUN: opt -passes=elim-avail-extern -avail-extern-to-local -stats -S 2>&1 %s | FileCheck %s12;13; RUN: echo '{"Contexts": [{"Guid":1234, "TotalRootEntryCount": 5, "Counters": [1]}]}' | llvm-ctxprof-util fromYAML --input=- --output=%t_profile.ctxprofdata14;15; Because we pass a contextual profile with a root defined in this module, we expect the outcome to be the same as-if16; we passed -avail-extern-to-local, i.e. available_externally don't get elided and instead get converted to local linkage17;18; RUN: opt -passes='assign-guid,require<ctx-prof-analysis>,elim-avail-extern' -use-ctx-profile=%t_profile.ctxprofdata -stats -S 2>&1 %t/1234.ll | FileCheck %s19 20; If the profile doesn't apply to this module, available_externally won't get converted to internal linkage, and will be21; removed instead.22; RUN: echo '{"Contexts": [{"Guid":5678, "TotalRootEntryCount": 3, "Counters": [1]}]}' | llvm-ctxprof-util fromYAML --input=- --output=%t_profile_bad.ctxprofdata23; RUN: opt -passes='assign-guid,require<ctx-prof-analysis>,elim-avail-extern' -use-ctx-profile=%t_profile_bad.ctxprofdata -stats -S %s 2>&1 | FileCheck %s --check-prefix=NOOP24 25declare void @call_out(ptr %fct)26 27define available_externally hidden void @f() {28  ret void29}30 31define available_externally hidden void @g() {32  ret void33}34 35define void @hello(ptr %g) !guid !0 {36  call void @f()37  %f = load ptr, ptr @f38  call void @call_out(ptr %f)39  ret void40}41 42!0 = !{i64 1234}43 44; CHECK: define internal void @f.__uniq.{{[0-9|a-f]*}}()45; CHECK: declare hidden void @g()46; CHECK: call void @f.__uniq.{{[0-9|a-f]*}}()47; CHECK-NEXT: load ptr, ptr @f48; CHECK-NEXT: call void @call_out(ptr %f)49; CHECK: Statistics Collected50; CHECK: 1 elim-avail-extern - Number of functions converted51; CHECK: 1 elim-avail-extern - Number of functions removed52 53; NOOP: 2 elim-avail-extern - Number of functions removed