blob: 937bf89532d35da192092d96724094291352c720 [file] [log] [blame]
; REQUIRES: x86_64-linux
; RUN: mkdir -p %t
; RUN: llvm-ctxprof-util fromYAML --input %S/Inputs/empty.yaml -output %t/empty.bitstream
; RUN: llvm-bcanalyzer --dump %t/empty.bitstream | FileCheck %s --check-prefix=EMPTY
; RUN: llvm-ctxprof-util fromYAML -input %S/Inputs/valid.yaml -output %t/valid.bitstream
; RUN: llvm-ctxprof-util toYAML -input %t/valid.bitstream -output %t/valid2.yaml
; RUN: diff %t/valid2.yaml %S/Inputs/valid.yaml
; RUN: llvm-ctxprof-util fromYAML -input %S/Inputs/valid-ctx-only.yaml -output %t/valid-ctx-only.bitstream
; RUN: llvm-ctxprof-util toYAML -input %t/valid-ctx-only.bitstream -output %t/valid-ctx-only.yaml
; RUN: diff %t/valid-ctx-only.yaml %S/Inputs/valid-ctx-only.yaml
; RUN: llvm-ctxprof-util fromYAML -input %S/Inputs/valid-flat-only.yaml -output %t/valid-flat-only.bitstream
; RUN: llvm-ctxprof-util toYAML -input %t/valid-flat-only.bitstream -output %t/valid-flat-only.yaml
; RUN: diff %t/valid-flat-only.yaml %S/Inputs/valid-flat-only.yaml
; This case is the "valid.yaml" case but with the flat profile first.
; The output, though, should match valid.yaml
; RUN: llvm-ctxprof-util fromYAML -input %S/Inputs/valid-flat-first.yaml -output %t/valid-flat-first.bitstream
; RUN: llvm-ctxprof-util toYAML -input %t/valid-flat-first.bitstream -output %t/valid-flat-first.yaml
; RUN: diff %t/valid-flat-first.yaml %S/Inputs/valid.yaml
; For the valid case, check against a reference output.
; Note that uint64_t are printed as signed values by llvm-bcanalyzer:
; * 18446744073709551613 in yaml is -3 in the output
; * 18446744073709551612 in yaml is -4 in the output
; Also we have no callee/context at index 0, 2 callsites for index 1, and one for
; index 2.
; RUN: llvm-bcanalyzer --dump %t/valid.bitstream | FileCheck %s --check-prefix=VALID
; EMPTY: <BLOCKINFO_BLOCK/>
; EMPTY-NEXT: <Metadata NumWords=1 BlockCodeSize=2>
; EMPTY-NEXT: <Version op0=3/>
; EMPTY-NEXT: </Metadata>
; VALID: <BLOCKINFO_BLOCK/>
; VALID-NEXT: <Metadata NumWords=46 BlockCodeSize=2>
; VALID-NEXT: <Version op0=3/>
; VALID-NEXT: <Contexts NumWords=30 BlockCodeSize=2>
; VALID-NEXT: <Root NumWords=20 BlockCodeSize=2>
; VALID-NEXT: <GUID op0=1000/>
; VALID-NEXT: <TotalRootEntryCount op0=5/>
; VALID-NEXT: <Counters op0=1 op1=2 op2=3/>
; VALID-NEXT: <Context NumWords=5 BlockCodeSize=2>
; VALID-NEXT: <GUID op0=-3/>
; VALID-NEXT: <CalleeIndex op0=1/>
; VALID-NEXT: <Counters op0=6 op1=7 op2=8/>
; VALID-NEXT: </Context>
; VALID-NEXT: <Context NumWords=3 BlockCodeSize=2>
; VALID-NEXT: <GUID op0=2000/>
; VALID-NEXT: <CalleeIndex op0=1/>
; VALID-NEXT: <Counters op0=4 op1=5/>
; VALID-NEXT: </Context>
; VALID-NEXT: <Context NumWords=3 BlockCodeSize=2>
; VALID-NEXT: <GUID op0=3000/>
; VALID-NEXT: <CalleeIndex op0=2/>
; VALID-NEXT: <Counters op0=40 op1=50/>
; VALID-NEXT: </Context>
; VALID-NEXT: </Root>
; VALID-NEXT: <Root NumWords=5 BlockCodeSize=2>
; VALID-NEXT: <GUID op0=-4/>
; VALID-NEXT: <TotalRootEntryCount op0=45/>
; VALID-NEXT: <Counters op0=5 op1=9 op2=10/>
; VALID-NEXT: </Root>
; VALID-NEXT: </Contexts>
; VALID-NEXT: <FlatProfiles NumWords=10 BlockCodeSize=2>
; VALID-NEXT: <Flat NumWords=3 BlockCodeSize=2>
; VALID-NEXT: <GUID op0=1234/>
; VALID-NEXT: <Counters op0=5 op1=6 op2=7/>
; VALID-NEXT: </Flat>
; VALID-NEXT: <Flat NumWords=2 BlockCodeSize=2>
; VALID-NEXT: <GUID op0=5555/>
; VALID-NEXT: <Counters op0=1/>
; VALID-NEXT: </Flat>
; VALID-NEXT: </FlatProfiles>
; VALID-NEXT: </Metadata>