forked from OSchip/llvm-project
X86: VZeroUpperInserter: shortcut should not trigger if we have any function live-ins.
llvm-svn: 225419
This commit is contained in:
parent
1a4d078583
commit
ada0adf396
|
@ -254,18 +254,22 @@ bool VZeroUpperInserter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
MachineRegisterInfo &MRI = MF.getRegInfo();
|
MachineRegisterInfo &MRI = MF.getRegInfo();
|
||||||
EverMadeChange = false;
|
EverMadeChange = false;
|
||||||
|
|
||||||
|
bool FnHasLiveInYmm = checkFnHasLiveInYmm(MRI);
|
||||||
|
|
||||||
// Fast check: if the function doesn't use any ymm registers, we don't need
|
// 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
|
// to insert any VZEROUPPER instructions. This is constant-time, so it is
|
||||||
// cheap in the common case of no ymm use.
|
// cheap in the common case of no ymm use.
|
||||||
bool YMMUsed = false;
|
bool YMMUsed = FnHasLiveInYmm;
|
||||||
|
if (!YMMUsed) {
|
||||||
const TargetRegisterClass *RC = &X86::VR256RegClass;
|
const TargetRegisterClass *RC = &X86::VR256RegClass;
|
||||||
for (TargetRegisterClass::iterator i = RC->begin(), e = RC->end();
|
for (TargetRegisterClass::iterator i = RC->begin(), e = RC->end(); i != e;
|
||||||
i != e; i++) {
|
i++) {
|
||||||
if (!MRI.reg_nodbg_empty(*i)) {
|
if (!MRI.reg_nodbg_empty(*i)) {
|
||||||
YMMUsed = true;
|
YMMUsed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!YMMUsed) {
|
if (!YMMUsed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -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
|
// If any YMM regs are live in to this function, add the entry block to the
|
||||||
// DirtySuccessors list
|
// DirtySuccessors list
|
||||||
if (checkFnHasLiveInYmm(MRI))
|
if (FnHasLiveInYmm)
|
||||||
addDirtySuccessor(MF.front());
|
addDirtySuccessor(MF.front());
|
||||||
|
|
||||||
// Re-visit all blocks that are successors of EXITS_DIRTY bsocks. Add
|
// Re-visit all blocks that are successors of EXITS_DIRTY bsocks. Add
|
||||||
|
|
Loading…
Reference in New Issue