================
@@ -211,6 +211,16 @@ New Compiler Flags
   only for thread-local variables, and none (which corresponds to the
   existing ``-fno-c++-static-destructors`` flag) skips all static
   destructors registration.
+- The ``-fextend-lifetimes`` and ``-fextend-this-ptr`` flags have been added to
+  allow for improved debugging of optimized code. Using ``-fextend-lifetimes``
+  will cause Clang to generate code that tries to preserve the lifetimes of
+  source variables, meaning that variables will typically be visible in a
+  debugger more often. The ``-fextend-this-ptr`` flag has the same behaviour,
+  but applies only to the ``this`` variable in C++ class member functions. Note
+  that this flag modifies the optimizations that Clang performs, which will
+  result in reduced performance in generated code; however, this feature will
+  not extend the lifetime of some variables in cases where doing so would have
----------------
SLTozer wrote:

The main case off the top of my head is that we drop fake uses for inlined 
functions; preserving them results in a fairly significant drop in performance, 
enough to hurt the flag's viability for game debugging. Though now that this is 
coming upstream, it's possible we could try toggling that behaviour (and any 
similar cases) depending on opt level; in the [earlier 
RFC](https://discourse.llvm.org/t/rfc-redefine-og-o1-and-add-a-new-level-of-og/72850)
 I proposed having an extra optimization mode that aims for high performance 
(around 5% 
slower than O2 for some representative benchmarks) while having good debug info 
- an appropriate solution may be that we'd drop inlined fake uses at that opt 
level, while keeping them at Og, for example.

https://github.com/llvm/llvm-project/pull/110000
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to