From: Vlad Tsyrklevich Date: Tue, 10 Apr 2018 01:31:01 +0000 (+0000) Subject: ShadowCallStack/x86_64: Ignore pseudo-machine instructions X-Git-Tag: llvmorg-7.0.0-rc1~8563 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cdc6ec5357e9295dcd7bb0ce2a5e1fc5973626f;p=platform%2Fupstream%2Fllvm.git ShadowCallStack/x86_64: Ignore pseudo-machine instructions llvm-svn: 329656 --- diff --git a/llvm/lib/Target/X86/ShadowCallStack.cpp b/llvm/lib/Target/X86/ShadowCallStack.cpp index ba02644..9a39455 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 485b970..f10fabf 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