[llvm-dev] Debug info interacting with optimization and code generation

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 7 14:33:45 PDT 2016


(Resend with llvm-dev added back)

At Sony we have an internal test run that compares generated code with/without –g, in our suite of regression tests.  See our lightning talk slides from EuroLLVM 2015.  I believe we list some PRs in there for things we have found and fixed in the past.
http://llvm.org/devmtg/2015-04/slides/Verifying_code_gen_dash_g_final.pdf

At the moment we have a backlog of about a half-dozen differences worth investigating.  I have to admit we have not yet looked at whether some of your recent work has fixed any of them; it is not our top priority, although obviously it is something we do look at and keep track of.
There are some very minor differences in instruction order that we see, and I think in most cases that is because –g emits .cfi directives which act as scheduling barriers.  It might be the case that if we enabled exceptions, we would not see these as –g differences; we have not experimented with that.
--paulr


From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Dehao Chen via llvm-dev
Sent: Friday, October 07, 2016 1:28 PM
To: llvm-dev at lists.llvm.org
Cc: David Li
Subject: [llvm-dev] Debug info interacting with optimization and code generation

In theory, compiler should generate bit-identical code with and without debug info. I.e.
# clang -c -O2 -g a.cc -o a.g.o
# clang -c -O2 -g0 a.cc -o a.g0.o
# strip a.g.o a.g0.o
# diff a.g.o a.g0.o
The diff should find two binaries identical. For brevity, in the rest of the mail, I'll refer to this requirement as "codegen consistency" (any better name?)

Unfortunately, LLVM does not guarantee codegen consistency. Recently, I've spent quite some time try to fix related issues (e.g. https://reviews.llvm.org/D25286 and https://reviews.llvm.org/D25098). The most recent issue I'm looking at is that during isel, the IROrder is used by both debug info and the actual codegen, which is relative harder to fix.

I initially thought that it's just a couple of careless bugs to fix. But looks like there are much more issues than I expected. So I'm calling the community for help:

* Is there anyone else who also cares about codegen consistency?
* Any volunteers to help fix codegen consistency issues? (It is easy to find issues, just build speccpu with -g and -g0, then compare the "objdump -d" output)
* How to setup a regression test to ensure future changes does not break codegen consistency?

Any comments?

Thanks,
Dehao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161007/db6f471d/attachment-0001.html>


More information about the llvm-dev mailing list