[PATCH] D44802: Add the ShadowCallStack pass

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 28 11:33:27 PDT 2018


vlad.tsyrklevich marked an inline comment as done.
vlad.tsyrklevich added inline comments.


================
Comment at: lib/Target/X86/ShadowCallStack.cpp:89
+  const unsigned OffsetReg = X86::R11;
+  assert(!MBB->isLiveIn(X86::R10) && !MBB->isLiveIn(X86::R11));
+
----------------
pcc wrote:
> I think this is possible if the function takes a nest parameter -- probably best to disable the protection in that case for now.
Yup, I double checked and that looks like the case in X86FrameLowering.


================
Comment at: lib/Target/X86/ShadowCallStack.cpp:95
+  if (MBB->empty())
+    Noop = BuildMI(MBB, DL, TII->get(X86::NOOP));
+
----------------
eugenis wrote:
> AFAIK you can do it without a dummy instruction by using the iterator form of BuildMI and passing MBB->end() or MBB->begin() in case of the empty basic block.
You could use the MBB->begin() form and insert them backwards, but for the sake of readability I insert them forwards.


Repository:
  rL LLVM

https://reviews.llvm.org/D44802





More information about the llvm-commits mailing list