diff options
author | Matthias Braun <matze@braunis.de> | 2015-01-08 00:33:48 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2015-01-08 00:33:48 +0000 |
commit | ada0adf39661869f5582c624ddfa3a3f68774563 (patch) | |
tree | fe47e165431953d517316846bef214172c9c40fb /llvm | |
parent | 1a4d0785833bd2bc964844eb25fe0fccdd559a8e (diff) | |
download | bcm5719-llvm-ada0adf39661869f5582c624ddfa3a3f68774563.tar.gz bcm5719-llvm-ada0adf39661869f5582c624ddfa3a3f68774563.zip |
X86: VZeroUpperInserter: shortcut should not trigger if we have any function live-ins.
llvm-svn: 225419
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/X86/X86VZeroUpper.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86VZeroUpper.cpp b/llvm/lib/Target/X86/X86VZeroUpper.cpp index d93baeb7002..5c01f3e1ff6 100644 --- a/llvm/lib/Target/X86/X86VZeroUpper.cpp +++ b/llvm/lib/Target/X86/X86VZeroUpper.cpp @@ -254,16 +254,20 @@ bool VZeroUpperInserter::runOnMachineFunction(MachineFunction &MF) { MachineRegisterInfo &MRI = MF.getRegInfo(); EverMadeChange = false; + bool FnHasLiveInYmm = checkFnHasLiveInYmm(MRI); + // Fast check: if the function doesn't use any ymm registers, we don't need // to insert any VZEROUPPER instructions. This is constant-time, so it is // cheap in the common case of no ymm use. - bool YMMUsed = false; - const TargetRegisterClass *RC = &X86::VR256RegClass; - for (TargetRegisterClass::iterator i = RC->begin(), e = RC->end(); - i != e; i++) { - if (!MRI.reg_nodbg_empty(*i)) { - YMMUsed = true; - break; + bool YMMUsed = FnHasLiveInYmm; + if (!YMMUsed) { + const TargetRegisterClass *RC = &X86::VR256RegClass; + for (TargetRegisterClass::iterator i = RC->begin(), e = RC->end(); i != e; + i++) { + if (!MRI.reg_nodbg_empty(*i)) { + YMMUsed = true; + break; + } } } if (!YMMUsed) { @@ -282,7 +286,7 @@ bool VZeroUpperInserter::runOnMachineFunction(MachineFunction &MF) { // If any YMM regs are live in to this function, add the entry block to the // DirtySuccessors list - if (checkFnHasLiveInYmm(MRI)) + if (FnHasLiveInYmm) addDirtySuccessor(MF.front()); // Re-visit all blocks that are successors of EXITS_DIRTY bsocks. Add |