diff options
author | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-08-12 10:14:58 +0000 |
---|---|---|
committer | Michael Kuperstein <michael.m.kuperstein@intel.com> | 2015-08-12 10:14:58 +0000 |
commit | bc7f99a3ab802f4f5be6f3b0a97df03e6bfd3375 (patch) | |
tree | d38ad79676f320526b91fdd49d00f02429204ff4 /llvm/lib/CodeGen | |
parent | c5746865296fc07bb7f985d44d14ce780ac12086 (diff) | |
download | bcm5719-llvm-bc7f99a3ab802f4f5be6f3b0a97df03e6bfd3375.tar.gz bcm5719-llvm-bc7f99a3ab802f4f5be6f3b0a97df03e6bfd3375.zip |
[X86] Allow x86 call frame optimization to fold more loads into pushes
This abstracts away the test for "when can we fold across a MachineInstruction"
into the the MI interface, and changes call-frame optimization use the same test
the peephole optimizer users.
Differential Revision: http://reviews.llvm.org/D11945
llvm-svn: 244729
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/PeepholeOptimizer.cpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index c3d58426277..e072ee1d6d5 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1503,6 +1503,10 @@ bool MachineInstr::hasUnmodeledSideEffects() const { return false; } +bool MachineInstr::isLoadFoldBarrier() const { + return mayStore() || isCall() || hasUnmodeledSideEffects(); +} + /// allDefsAreDead - Return true if all the defs of this instruction are dead. /// bool MachineInstr::allDefsAreDead() const { diff --git a/llvm/lib/CodeGen/PeepholeOptimizer.cpp b/llvm/lib/CodeGen/PeepholeOptimizer.cpp index 3dc73bac5b8..4d593543806 100644 --- a/llvm/lib/CodeGen/PeepholeOptimizer.cpp +++ b/llvm/lib/CodeGen/PeepholeOptimizer.cpp @@ -1234,9 +1234,9 @@ bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) { if (MI->isDebugValue()) continue; - // If there exists an instruction which belongs to the following - // categories, we will discard the load candidates. - if (MI->mayStore() || MI->isCall() || MI->hasUnmodeledSideEffects()) + // If we run into an instruction we can't fold across, discard + // the load candidates. + if (MI->isLoadFoldBarrier()) FoldAsLoadDefCandidates.clear(); if (MI->isPosition() || MI->isPHI() || MI->isImplicitDef() || |