<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 9, 2015 at 2:52 PM, Chris Bieneman <span dir="ltr"><<a href="mailto:beanz@apple.com" target="_blank">beanz@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">For one, setting -DNDEBUG on parts (but not all) of the code isn’t safe. We have headers in libSupport that change ifdef on NDEBUG, and that could cause subtle bugs.<br></blockquote><div><br></div><div><div>$ git grep NDEBUG ../include/llvm/Support/</div><div>../include/llvm/Support/Allocator.h:#ifndef NDEBUG</div><div>../include/llvm/Support/Allocator.h:#ifndef NDEBUG</div><div><br></div><div>I added these long ago, let's remove them.</div><div><br></div><div>../include/llvm/Support/Compiler.h:#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)</div><div><br></div><div>We could work around this by defining LLVM_ENABLE_DUMP as well as NDEBUG.</div><div><br></div><div>../include/llvm/Support/Debug.h:#ifndef NDEBUG</div><div><br></div><div>Ouch, that is used, but I suppose we want this to be compiled out of Support and TableGen LLVM_OPTIMIZED_TABLEGEN is on.</div><div><br></div><div>../include/llvm/Support/ErrorHandling.h:/// In !NDEBUG builds, prints the message and location info to stderr.</div><div>../include/llvm/Support/ErrorHandling.h:/// In NDEBUG builds, becomes an optimizer hint that the current location</div><div>../include/llvm/Support/ErrorHandling.h:#ifndef NDEBUG</div><div><br></div><div>Implementation of llvm_unreachable, we want this.</div><div><br></div><div>../include/llvm/Support/Valgrind.h:#if LLVM_ENABLE_THREADS != 0 && !defined(NDEBUG)</div><div>../include/llvm/Support/Valgrind.h:#if LLVM_ENABLE_THREADS != 0 && !defined(NDEBUG)</div></div><div><br></div><div>Valgrind is dead, long live the sanitizers.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Also I don’t like the idea of bleeding the non-debug code into what you might be debugging. It would kinda suck to be debugging something and suddenly lose your debug granularity because you stepped into optimized code.</blockquote><div><br></div><div>Yeah, but Support is pretty well tested. I think this is a reasonable cost for LLVM_OPTIMIZE_TABLEGEN.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
One of the big appeals to me about using the cross-compiling support for this is it means that your output from a debug build remains the same (barring debug tablegen behaving wildly different from a release one).</blockquote><div><br></div><div>That's a reasonable concern.</div></div></div></div>