rnk added a comment.

In D78659#2003152 <https://reviews.llvm.org/D78659#2003152>, @zequanwu wrote:

> Add check in LICM to prevent sink or hoist on `nomerge` call


Does sinking and hoisting remove the debug source location? I assumed that it 
wouldn't, but now after all the smooth stepping work, maybe it does.

Maybe we should audit for calls to `DILocation::getMergedLocation`, and use 
that to guide our changes. It would also be good to build an API that ensures 
that passes do not use `getMergedLocation` for instructions marked this way.

---

This also needs to be documented in llvm/docs/LangRef.rst with the other 
function attributes. Check out Arthur's preallocated patch for an example of 
that: D74651 <https://reviews.llvm.org/D74651>



================
Comment at: clang/include/clang/Basic/AttrDocs.td:356-357
+  let Content = [{
+A function declared as ``nomerge`` shall not be tail merged at call sites 
during
+optimization phase.
+  }];
----------------
I think we need to expand on this. This is user facing documentation visible 
here:
http://clang.llvm.org/docs/AttributeReference.html

Here's a suggestion:
"Calls to functions marked ``nomerge`` will not be merged during optimization. 
This attribute can be used to prevent the optimizer from obscuring the source 
location of certain calls. For example, it will prevent tail merging otherwise 
identical code sequences that raise an exception or terminate the program. Tail 
merging normally reduces the precision of source location information, making 
stack traces less useful for debugging. This attribute gives the user control 
over the tradeoff between code size and debug information precision."


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78659/new/

https://reviews.llvm.org/D78659



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to