summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-04-26 23:44:14 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-04-26 23:44:14 +0000
commit4ff3cfb6733235b8fbf1f08f1f53bedc37d86e9f (patch)
tree14fd75d48238c04d5990750ba6ae85a51fc62b7e /llvm/lib/Target/X86/X86FrameLowering.cpp
parent9491371f6ff345a820ff98e398b194604fd341dc (diff)
downloadbcm5719-llvm-4ff3cfb6733235b8fbf1f08f1f53bedc37d86e9f.tar.gz
bcm5719-llvm-4ff3cfb6733235b8fbf1f08f1f53bedc37d86e9f.zip
[X86] Make sure it is safe to clobber EFLAGS, if need be, when choosing
the prologue. Do not use basic blocks that have EFLAGS live-in as prologue if we need to realign the stack. Realigning the stack uses AND instruction and this clobbers EFLAGS. An other alternative would have been to save and restore EFLAGS around the stack realignment code, but this is likely inefficient. Fixes PR27531. llvm-svn: 267634
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 8efe7038daf..155cb3c02b2 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -2609,6 +2609,12 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
return I;
}
+bool X86FrameLowering::canUseAsPrologue(const MachineBasicBlock &MBB) const {
+ assert(MBB.getParent() && "Block is not attached to a function!");
+ const MachineFunction &MF = *MBB.getParent();
+ return !TRI->needsStackRealignment(MF) || !MBB.isLiveIn(X86::EFLAGS);
+}
+
bool X86FrameLowering::canUseAsEpilogue(const MachineBasicBlock &MBB) const {
assert(MBB.getParent() && "Block is not attached to a function!");
OpenPOWER on IntegriCloud