diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86VZeroUpper.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/X86VZeroUpper.cpp b/llvm/lib/Target/X86/X86VZeroUpper.cpp index 4465c0f988d..944c76ae68a 100644 --- a/llvm/lib/Target/X86/X86VZeroUpper.cpp +++ b/llvm/lib/Target/X86/X86VZeroUpper.cpp @@ -188,14 +188,15 @@ void VZeroUpperInserter::processBasicBlock(MachineBasicBlock &MBB) { bool IsReturnFromX86INTR = IsX86INTR && MI->isReturn(); bool IsControlFlow = MI->isCall() || MI->isReturn(); - // Shortcut: don't need to check regular instructions in dirty state. - if ((!IsControlFlow || IsReturnFromX86INTR) && CurState == EXITS_DIRTY) + // An existing VZERO* instruction resets the state. + if (MI->getOpcode() == X86::VZEROALL || + MI->getOpcode() == X86::VZEROUPPER) { + CurState = EXITS_CLEAN; continue; + } - // Ignore existing VZERO* instructions. - // FIXME: The existence of these instructions should be used to modify the - // current state and/or used when deciding whether we need to create a VZU. - if (MI->getOpcode() == X86::VZEROALL || MI->getOpcode() == X86::VZEROUPPER) + // Shortcut: don't need to check regular instructions in dirty state. + if ((!IsControlFlow || IsReturnFromX86INTR) && CurState == EXITS_DIRTY) continue; if (hasYmmReg(MI)) { |