[llvm-dev] Question regarding correctness of debug information generated by LLC

Dwight Guth via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 30 14:29:34 PST 2021


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal
$ ~/llvm-project/build/bin/llc --version
LLVM (http://llvm.org/):
  LLVM version 13.0.0
  Optimized build.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: znver1

  Registered Targets:
    x86    - 32-bit X86: Pentium-Pro and above
    x86-64 - 64-bit X86: EM64T and AMD64
$ ~/llvm-project/build/bin/llc -mtriple=x86_64-unknown-linux-gnu -O0 debug.ll

If you inspect the debug.s, you will see that all the `tail call
tailcc` calls which are actually in tail position will be compiled to
the `jmp` instruction, as expected. The other calls are either not
`tailcc` calling convention, not marked as a tail call (because in the
original unminimized source, they were not in tail position), or are
not now in tail position (because they were in the original source,
but the minimized version does not put them in that position).

On Tue, Nov 30, 2021 at 3:51 PM <paul.robinson at sony.com> wrote:
>
> > Sorry for the late reply, this is my first day back after a long
> > holiday weekend. The gist of your reply seems to be that it's a little
> > hard to determine what might be going wrong because there is no debug
> > information in the IR I shared. There was debug information in my
> > original IR, it's true, but I was still able to reproduce the issue I
> > was encountering whether or not the debug information was present, so
> > it got removed during the process of minimization. The reason I
> > considered this normal is because LLC still generates CFI/CFA
> > directives in the assembly even when no debug information is present
> > in the IR, and my understanding was that this was the information that
> > the debugger used in order to unwind the stack.
>
> Ah, okay, I misunderstood.  The CFI/CFA directives are not what I
> normally think of as debug information, although of course they are
> used to build the unwind tables in the .debug_frame section (or in
> the .eh_frame section, if you're not producing debug info).
>
> I suspect you are not targeting an X86-family architecture?  I was
> not able to persuade llc for x86_64 Ubuntu to emit the tail calls
> that you describe.  Could you provide a complete llc command line
> (including triple) that demonstrates the problem for you?
>
> Thanks,
> --paulr
>


-- 
Dwight Guth
Chief Information Officer
Runtime Verification, Inc.

Email: dwight.guth at runtimeverification.com


More information about the llvm-dev mailing list