[PATCH] D23988: [compiler-rt][XRay] Support tail call sleds

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 01:17:24 PDT 2016


dberris added a comment.

In https://reviews.llvm.org/D23988#553965, @rSerge wrote:

> So in this implementation the handler doesn't receive `XRayEntryType::TAIL` type of event, but instead receives `XRayEntryType::EXIT`, right? Is it also intended for now?


Yes, this is intended for now.

In https://reviews.llvm.org/D23988#554292, @rSerge wrote:

> I've tried seemingly the same approach on ARM with the following program:


[snipped]

> So for function `fC()` the exit sled seems to be called too much before function exit: before printing `In fC()`. I compiled with the following generic flags: `-O3 -g -fxray-instrument -Wall -std=c++14  -ffunction-sections -fdata-sections` (this list doesn't include my specific flags like `--target=armv7-linux-gnueabihf` etc.).

> 

> Does the code snippet work correctly for you on x86_64? Or is the above output expected?


It's certainly not expected, but I think I can explain this.

Since `printf` isn't instrumented, this means the implementation of `fC()` could be tail-calling into `printf` (which is a perfectly good optimisation to make). Of course this mis-accounts the time but we really can't do anything about that yet, unless we know that we're tail-calling into something else, which will come later when we have different records for tail calls. We should probably do that when we have a more substantial change in the format once some of the stuff I'm working on (to support richer records into the log) goes upstream and increment the file version number.

Does that make sense?


https://reviews.llvm.org/D23988





More information about the llvm-commits mailing list