summaryrefslogtreecommitdiff
path: root/gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-01-14 19:56:11 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-01-14 19:56:11 +0000
commitca82c85029ae0befb17bc14a4faa9f3d51dd72b3 (patch)
tree2df9dea922feef454abe6d1499112a4abc270079 /gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp
parent04c0d479b956b5e4f4e20ce989b95443aa03da0b (diff)
Import LLVM 3.9.1 including clang and lld.
Diffstat (limited to 'gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp')
-rw-r--r--gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp b/gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp
index 0f425e28fa7..62a9aafc2cf 100644
--- a/gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp
+++ b/gnu/llvm/lib/Target/X86/X86PadShortFunction.cpp
@@ -55,6 +55,11 @@ namespace {
bool runOnMachineFunction(MachineFunction &MF) override;
+ MachineFunctionProperties getRequiredProperties() const override {
+ return MachineFunctionProperties().set(
+ MachineFunctionProperties::Property::AllVRegsAllocated);
+ }
+
const char *getPassName() const override {
return "X86 Atom pad short functions";
}
@@ -93,6 +98,9 @@ FunctionPass *llvm::createX86PadShortFunctions() {
/// runOnMachineFunction - Loop over all of the basic blocks, inserting
/// NOOP instructions before early exits.
bool PadShortFunc::runOnMachineFunction(MachineFunction &MF) {
+ if (skipFunction(*MF.getFunction()))
+ return false;
+
if (MF.getFunction()->optForSize()) {
return false;
}
@@ -179,13 +187,11 @@ bool PadShortFunc::cyclesUntilReturn(MachineBasicBlock *MBB,
unsigned int CyclesToEnd = 0;
- for (MachineBasicBlock::iterator MBBI = MBB->begin();
- MBBI != MBB->end(); ++MBBI) {
- MachineInstr *MI = MBBI;
+ for (MachineInstr &MI : *MBB) {
// Mark basic blocks with a return instruction. Calls to other
// functions do not count because the called function will be padded,
// if necessary.
- if (MI->isReturn() && !MI->isCall()) {
+ if (MI.isReturn() && !MI.isCall()) {
VisitedBBs[MBB] = VisitedBBInfo(true, CyclesToEnd);
Cycles += CyclesToEnd;
return true;