summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/X86/ShadowCallStack.cpp3
-rw-r--r--llvm/test/CodeGen/X86/shadow-call-stack.mir8
2 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/ShadowCallStack.cpp b/llvm/lib/Target/X86/ShadowCallStack.cpp
index ba02644273b..9a39455f9dd 100644
--- a/llvm/lib/Target/X86/ShadowCallStack.cpp
+++ b/llvm/lib/Target/X86/ShadowCallStack.cpp
@@ -242,7 +242,8 @@ bool ShadowCallStack::runOnMachineFunction(MachineFunction &Fn) {
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());
diff --git a/llvm/test/CodeGen/X86/shadow-call-stack.mir b/llvm/test/CodeGen/X86/shadow-call-stack.mir
index 485b970540f..f10fabf587d 100644
--- a/llvm/test/CodeGen/X86/shadow-call-stack.mir
+++ b/llvm/test/CodeGen/X86/shadow-call-stack.mir
@@ -106,6 +106,14 @@ frameInfo:
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
OpenPOWER on IntegriCloud