[PATCH] D31345: [XRay] [compiler-rt] Unwriting FDR mode buffers when functions are short.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 16:02:45 PDT 2017


dberris added a comment.

Still LGTM, just a couple more nits.

Can you clarify the order of when these changes can/should be landed? Are there dependencies amongst the changes?



================
Comment at: lib/xray/xray_fdr_logging_impl.h:538-539
+    // LastTSC and count of consecutive FunctionEntry records.
+    if (NumConsecutiveFnEnters > 0 &&
+        (TSC - LastFunctionEntryTSC) < NumberOfTicksThreshold) {
+      RecordPtr -= FunctionRecSize;
----------------
This one you can also probably invert and early return.


================
Comment at: lib/xray/xray_fdr_logging_impl.h:596
+        }
+      } else {
+        LastFunctionEntryTSC = LastFunctionEntryTSC - FuncRecord.TSCDelta;
----------------
I think I understand what this means, but it might look better if you invert the test case and early return. So:

```
if (NumConsecutiveFnEnters > 0) {
  LastFunctionEntryTSC = LastFunctionEntryTSC - FuncRecord.TSCDelta;
  return;
}
// If we've rewound the stack of all function entries, ...
```


https://reviews.llvm.org/D31345





More information about the llvm-commits mailing list