The current Intel Atom microarchitecture has a feature whereby when a function

returns early then it is slightly faster to execute a sequence of NOP
instructions to wait until the return address is ready,
as opposed to simply stalling on the ret instruction
until the return address is ready.

When compiling for X86 Atom only, this patch will run a pass, called
"X86PadShortFunction" which will add NOP instructions where less than four
cycles elapse between function entry and return.

It includes tests.

Patch by Andy Zhang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171524 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Preston Gurd
2013-01-04 20:54:54 +00:00
parent 60507d53e7
commit dd30b47175
11 changed files with 282 additions and 8 deletions
+4
View File
@@ -190,6 +190,10 @@ bool X86PassConfig::addPreEmitPass() {
addPass(createX86IssueVZeroUpperPass());
ShouldPrint = true;
}
if (getX86Subtarget().padShortFunctions()){
addPass(createX86PadShortFunctions());
ShouldPrint = true;
}
return ShouldPrint;
}