The names are dropped to save memory when a release build of the compiler is being used. This is what you probably want on a release compiler you intend to ship since it should be faster. The NDEBUG check is an easy way to tell the difference between release and debug builds. People probably don't want to have to remember to set an additional cmake option to make a release compiler faster. The -fdiscard-value-names/-fno-discard-value-names was added about a year ago https://reviews.llvm.org/D42887 not sure if there is more discussion about the asserts behavior discussed there. ~Craig On Wed, Jan 9, 2019 at 2:25 PM David Greene <dag at cray.com> wrote:> Craig Topper via llvm-dev <llvm-dev at lists.llvm.org> writes: > > > And the clang behavior can be controlled with - > > fdiscard-value-names/-fno-discard-value-names > > That's a little better for users, but again, why should the default > behavior change based on whether or not asserts are enabled? > > -David >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190109/803a322c/attachment.html>
Also, the textual IR is really a developer/debugging tool, not something an end-user would be expected to look at, so the textual names would be largely pointless in a release build. If you are writing lit tests that look at textual IR, and they are failing with release builds, you can add the "REQUIRES: asserts" directive to the lit test so that the test won't be run for a release build. --paulr From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Craig Topper via llvm-dev Sent: Wednesday, January 09, 2019 5:41 PM To: David Greene Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] Textual IR value names The names are dropped to save memory when a release build of the compiler is being used. This is what you probably want on a release compiler you intend to ship since it should be faster. The NDEBUG check is an easy way to tell the difference between release and debug builds. People probably don't want to have to remember to set an additional cmake option to make a release compiler faster. The -fdiscard-value-names/-fno-discard-value-names was added about a year ago https://reviews.llvm.org/D42887 not sure if there is more discussion about the asserts behavior discussed there. ~Craig On Wed, Jan 9, 2019 at 2:25 PM David Greene <dag at cray.com<mailto:dag at cray.com>> wrote: Craig Topper via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> writes:> And the clang behavior can be controlled with - > fdiscard-value-names/-fno-discard-value-namesThat's a little better for users, but again, why should the default behavior change based on whether or not asserts are enabled? -David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190110/6e3410d6/attachment.html>
Craig Topper via llvm-dev <llvm-dev at lists.llvm.org> writes:> The names are dropped to save memory when a release build of the > compiler is being used. This is what you probably want on a release > compiler you intend to ship since it should be faster. The NDEBUG > check is an easy way to tell the difference between release and debug > builds. People probably don't want to have to remember to set an > additional cmake option to make a release compiler faster.The CMake option could override the current behavior. Then users wouldn't be forced to remember to set an option to make release compilers faster. In the end it's not a huge deal, I just found keying off asserts to be quite surprising and it took some time for me to figure out what was going on. -David
via llvm-dev <llvm-dev at lists.llvm.org> writes:> Also, the textual IR is really a developer/debugging tool, not > something an end-user would be expected to look at, so the textual > names would be largely pointless in a release build.Our customers using our (non-LLVM-based) Fortran compiler have the ability to dump internal IR(-ish) and examine it. Some find it useful to understand how the compiler transforms their code. So it's not quite right to say such dumps are pointless. It depends on the user. -David
While I understand the value of turning it off, it is somewhat annoying when you're trying to run a clang -S -emit-llvm to discover that you're not getting any value names. I would suggest that, irrespective of the kind of build you use, -S -emit-llvm should cause the value names to be defaulted to on as a principle of least surprise to the user. -----Original Message----- From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of David Greene via llvm-dev Sent: Thursday, January 10, 2019 15:05 To: Craig Topper <craig.topper at gmail.com> Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] Textual IR value names Craig Topper via llvm-dev <llvm-dev at lists.llvm.org> writes:> The names are dropped to save memory when a release build of the > compiler is being used. This is what you probably want on a release > compiler you intend to ship since it should be faster. The NDEBUG > check is an easy way to tell the difference between release and debug > builds. People probably don't want to have to remember to set an > additional cmake option to make a release compiler faster.The CMake option could override the current behavior. Then users wouldn't be forced to remember to set an option to make release compilers faster. In the end it's not a huge deal, I just found keying off asserts to be quite surprising and it took some time for me to figure out what was going on. -David _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Seemingly Similar Threads
- Textual IR value names
- Textual IR value names
- Question: Should we consider valid a variable defined #ifndef NDEBUG scope and used in assert?
- How to know the sub-class of a Value class?
- Question: Should we consider valid a variable defined #ifndef NDEBUG scope and used in assert?