diff --git a/bolt/test/X86/fdata-yaml.test b/bolt/test/X86/fdata-yaml.test new file mode 100644 --- /dev/null +++ b/bolt/test/X86/fdata-yaml.test @@ -0,0 +1,30 @@ +# This test checks that BOLT produces the same binary with yaml and fdata +# profiles obtained from the same pre-aggregated perf profile. +REQUIRES: system-linux + +RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe +RUN: perf2bolt %t.exe -o %t.fdata --pa -p %p/Inputs/pre-aggregated.txt -w %t.yaml + +RUN: llvm-bolt %t.exe -data %t.fdata -o %t.exe.fdata \ +RUN: --reorder-blocks=ext-tsp --split-functions --bolt-info=0 +RUN: llvm-bolt %t.exe -data %t.yaml -o %t.exe.yaml \ +RUN: --reorder-blocks=ext-tsp --split-functions --bolt-info=0 +RUN: cmp %t.exe.fdata %t.exe.yaml + +# Check that converted profiles are identical: +# fdata from pre-aggregated perf -> yaml +# vs +# yaml from pre-aggregated perf +RUN: llvm-bolt %t.exe --aggregate-only \ +RUN: --perfdata %t.fdata --profile-format=yaml -o %t.fdata.yaml +RUN: cmp <(grep -v profile-origin %t.yaml) <(grep -v profile-origin %t.fdata.yaml) + +# Check that using yaml profile obtained from converting fdata produces the same +# output binary as using the original fdata profile. +RUN: llvm-bolt %t.exe --aggregate-only \ +RUN: --perfdata %p/Inputs/blarge.fdata --profile-format=yaml -o %t.fdata.yaml2 +RUN: llvm-bolt %t.exe -data %p/Inputs/blarge.fdata -o %t.exe.fdata2 \ +RUN: --reorder-blocks=ext-tsp --split-functions --bolt-info=0 +RUN: llvm-bolt %t.exe -data %t.fdata.yaml2 -o %t.exe.yaml2 \ +RUN: --reorder-blocks=ext-tsp --split-functions --bolt-info=0 +RUN: cmp %t.exe.fdata2 %t.exe.yaml2 diff --git a/bolt/test/runtime/meta-merge-fdata.test b/bolt/test/runtime/meta-merge-fdata.test --- a/bolt/test/runtime/meta-merge-fdata.test +++ b/bolt/test/runtime/meta-merge-fdata.test @@ -42,12 +42,21 @@ RUN: cmp %t.fdata.base %t.fdata.inst # Optimize using merged fdata -RUN: llvm-bolt merge-fdata -o %t.opt --data %t.fdata.base \ +RUN: llvm-bolt merge-fdata -o %t.opt.fdata --data %t.fdata.base \ RUN: --reorder-blocks=ext-tsp --reorder-functions=hfsort+ \ -RUN: --split-functions \ +RUN: --split-functions --bolt-info=0 \ RUN: | FileCheck %s --check-prefix=CHECK-BOLT2 CHECK-BOLT2-NOT: invalid (possibly stale) profile # Check that optimized binary produces the same result -RUN: %t.opt %t.fdata1 %t.fdata2 > %t.fdata.opt +RUN: %t.opt.fdata %t.fdata1 %t.fdata2 > %t.fdata.opt RUN: cmp %t.fdata.base %t.fdata.opt + +# Fdata -> yaml conversion testing +RUN: llvm-bolt merge-fdata --aggregate-only --perfdata %t.fdata.base \ +RUN: --profile-format=yaml -o %t.yaml.base +RUN: llvm-bolt merge-fdata -o %t.opt.yaml --data %t.yaml.base \ +RUN: --reorder-blocks=ext-tsp --reorder-functions=hfsort+ \ +RUN: --split-functions --bolt-info=0 \ +RUN: | FileCheck %s --check-prefix=CHECK-BOLT2 +RUN: cmp %t.opt.fdata %t.opt.yaml