[PATCH] D45471: ShadowCallStack/x86_64: Ignore pseudo-machine instructions
Vlad Tsyrklevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 18:27:55 PDT 2018
vlad.tsyrklevich created this revision.
vlad.tsyrklevich added a reviewer: pcc.
Herald added a subscriber: llvm-commits.
TBR for a trivial bug fix
Repository:
rL LLVM
https://reviews.llvm.org/D45471
Files:
lib/Target/X86/ShadowCallStack.cpp
test/CodeGen/X86/shadow-call-stack.mir
Index: test/CodeGen/X86/shadow-call-stack.mir
===================================================================
--- test/CodeGen/X86/shadow-call-stack.mir
+++ test/CodeGen/X86/shadow-call-stack.mir
@@ -106,6 +106,14 @@
body: |
; CHECK: bb.0:
bb.0:
+ ; Ensure these are not counted as machine instructions
+ CFI_INSTRUCTION 0
+ CFI_INSTRUCTION 0
+ CFI_INSTRUCTION 0
+ DBG_VALUE 0
+ DBG_VALUE 0
+ DBG_VALUE 0
+
; CHECK: $eax = MOV32ri 13
$eax = MOV32ri 13
Index: lib/Target/X86/ShadowCallStack.cpp
===================================================================
--- lib/Target/X86/ShadowCallStack.cpp
+++ lib/Target/X86/ShadowCallStack.cpp
@@ -242,7 +242,8 @@
for (auto &LiveIn : MBB.liveins())
UsedRegs.set(LiveIn.PhysReg);
for (auto &MI : MBB) {
- InstructionCount++;
+ if (!MI.isDebugValue() && !MI.isCFIInstruction() && !MI.isLabel())
+ InstructionCount++;
for (auto &Op : MI.operands())
if (Op.isReg() && Op.isDef())
UsedRegs.set(Op.getReg());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45471.141777.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180410/d97e8935/attachment.bin>
More information about the llvm-commits
mailing list