And the clang behavior can be controlled with -fdiscard-value-names/-fno-discard-value-names ~Craig On Wed, Jan 9, 2019 at 2:16 PM Davide Italiano via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On Wed, Jan 9, 2019 at 2:12 PM David Greene via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > I like my LLVM IR text to have nice value names, e.g. > > > > %add = add ... > > %mul = mul ... > > > > And this all works well if the build has asserts enabled. If the build > > does not have asserts enabled, it's not so nice: > > > > %1 = add ... > > %2 = mul ... > > > > I understand the use for obfuscating names, but the choice to make this > > dependent on whether or not asserts are enabled seems odd to me. At the > > very least it's surprising. It took some time for me to figure out why > > some of our builds behaved differently than others. > > > > Is this an intentional design choice? If so, what's the rationale? If > > not, would it make sense to add a CMake option to specify whether > > textual IR preserves names or not rather than overloading > > ENABLE_ASSERTIONS? > > > > You can use `opt -instnamer`. > > -- > Davide > > "There are no solved problems; there are only problems that are more > or less solved" -- Henri Poincare > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190109/d24931f0/attachment.html>
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-namesThat's a little better for users, but again, why should the default behavior change based on whether or not asserts are enabled? -David
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>
Maybe Matching Threads
- Textual IR value names
- Textual IR value names
- Textual IR value names
- Question: Should we consider valid a variable defined #ifndef NDEBUG scope and used in assert?
- Question: Should we consider valid a variable defined #ifndef NDEBUG scope and used in assert?