Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Hardware tracing and optimisations #66

@ptersilie

Description

@ptersilie

When we add hardware tracing some programs using specific libraries currently make the compiler segfault. The segfault happens in LLVM in a method called getInstructionIndex. This function essentially walks through a Bundle and skips all debug instructions until it finds a "real" instruction. LLVM expects to find at least 1 "real" instruction. The segfault happens, when the only instruction within the Bundle is a debug instruction. The segfault only happens when we enabled optimisations with -O.

What I think happens (though I'm not entirely sure), is that when enabling optimisations, LLVM optimises away some stuff, leaving an empty Bundle. Typically this Bundle would also be optimised away, however, since we inserted YK debug labels, the Bundle isn't actually empty and thus LLVM can't/doesn't remove it. Then LLVM tries to codegen the empty Bundle, but expects there to be at least one "real" instruction, which it cannot find and segfaults.

A possible solution to this problem is to disable hardware tracing when optimisations are enabled. I believe currently the debug labels are inaccurate anyways with optimisations on, since LLVM moves things around after they were inserted. So we may not be able to use optimisations anyways for the time being.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions