Skip to content

No error or warning when the same instruction is listed multiple times in histogram #470

Description

@Maksim-Sebelev

Hi!

Snippy does not report an error or warning if the same instruction appears multiple times in the histogram

layout.yaml:

sections:
    - name:      1
      VMA:       0x10000
      SIZE:      0x10000
      LMA:       0x10000
      ACCESS:    rx
      PHDR:      'header1'
    - name:      2
      VMA:       0x20000
      SIZE:      0x200
      LMA:       0x20000
      ACCESS:    rw
      PHDR:      'header2'

histogram:
    - [ADD, 1.0]
    - [ADD, 9.0] # ADD weight reinint
    - [SUB, 1.0]


options:
    mtriple: "riscv64"
    mcpu: generic-rv64
    march: "rv64ifc_zifencei"
    model-plugin: None

And snippy generates snippet with this settings:

llvm-snippy layout.yaml -o test.elf
llvm-objdump -dC -M intel test.elf > test.s
cat test.s

test.elf:  file format elf64-littleriscv

Disassembly of section .snippy.1.rx:

0000000000000000 <SnippyFunction>:
       0: 33 0f fa 01    add  t5, s4, t6
       4: 33 0c 8e 00    add  s8, t3, s0
       8: 33 8d d6 00    add  s10, a3, a3
       c: b3 0b d3 00    add  s7, t1, a3
      10: 33 83 7d 01    add  t1, s11, s7
      14: b3 05 2b 00    add  a1, s6, sp
      18: 33 8a 96 00    add  s4, a3, s1
      1c: 33 0a b6 01    add  s4, a2, s11
      20: 33 00 6f 01    add  zero, t5, s6
      24: 33 0e e7 00    add  t3, a4, a4

0000000000000028 <__snippy_exit>:
      28: 73 00 10 00    ebreak

Snippy silently uses the last weight and discards previous weights for duplicated instructions without any warning or error.

:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions