[PATCH] D19904: XRay: Add entry and exit sleds

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Sun May 8 21:19:15 PDT 2016


dberris added inline comments.

================
Comment at: lib/CodeGen/XRayInstrumentation.cpp:72-77
@@ -70,5 +71,8 @@
     for (auto &Terminator : MBB.terminators()) {
       // FIXME: Handle tail calls here too?
-      if (Terminator.isReturn()) {
+      if (Terminator.isReturn() &&
+          (Terminator.getOpcode() != ISD::CATCHRET ||
+           Terminator.getOpcode() != ISD::CLEANUPRET ||
+           Terminator.getOpcode() != ISD::EH_RETURN)) {
         // Replace return instructions with:
         //   PATCHABLE_RET <Opcode>, <Operand>...
----------------
majnemer wrote:
> I would recommend white-listing the opcodes you know are safe to replace instead of blacklisting the ones you know which are unsafe.
> This would make the pass conservatively correct in the face of future changes to LLVM.
That makes sense, thanks majnemer -- however it's not clear to me how I'd refer to the target-specific opcodes from here. Pardon the newbie question, but how do I say "I just want return instructions here"? The only options I can see are:

- Look at the original LLVM IR to see if it's a ReturnInst.
- Figure out a way for including the X86 opcodes here.

Maybe I'm missing something simpler here?


http://reviews.llvm.org/D19904





More information about the llvm-commits mailing list