summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineLICM.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-07-14 01:22:19 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-07-14 01:22:19 +0000
commitdb8980903717e1127463f00a34cae9bd29f82a91 (patch)
treecb250ca2613d031edc1a7c36bef5a121871e2c90 /lib/CodeGen/MachineLICM.cpp
parent9e82bf12a03117bfce78217662d5cf8e74aef357 (diff)
downloadllvm-db8980903717e1127463f00a34cae9bd29f82a91.tar.gz
llvm-db8980903717e1127463f00a34cae9bd29f82a91.tar.bz2
llvm-db8980903717e1127463f00a34cae9bd29f82a91.tar.xz
Teach ProcessImplicitDefs to transform more COPY instructions into IMPLICIT_DEF (and subsequently eliminate them). This allows machine LICM to hoist IMPLICIT_DEF's. PR7620.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineLICM.cpp')
-rw-r--r--lib/CodeGen/MachineLICM.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp
index 956d21c0b3..4c054f51f3 100644
--- a/lib/CodeGen/MachineLICM.cpp
+++ b/lib/CodeGen/MachineLICM.cpp
@@ -497,11 +497,6 @@ void MachineLICM::HoistRegion(MachineDomTreeNode *N) {
/// candidate for LICM. e.g. If the instruction is a call, then it's obviously
/// not safe to hoist it.
bool MachineLICM::IsLICMCandidate(MachineInstr &I) {
- // It is not profitable to hoist implicitdefs. FIXME: Why not? what if they
- // are an argument to some other otherwise-hoistable instruction?
- if (I.isImplicitDef())
- return false;
-
// Check if it's safe to move the instruction.
bool DontMoveAcrossStore = true;
if (!I.isSafeToMove(TII, AA, DontMoveAcrossStore))
@@ -717,7 +712,9 @@ MachineLICM::LookForDuplicate(const MachineInstr *MI,
bool MachineLICM::EliminateCSE(MachineInstr *MI,
DenseMap<unsigned, std::vector<const MachineInstr*> >::iterator &CI) {
- if (CI == CSEMap.end())
+ // Do not CSE implicit_def so ProcessImplicitDefs can properly propagate
+ // the undef property onto uses.
+ if (CI == CSEMap.end() || MI->isImplicitDef())
return false;
if (const MachineInstr *Dup = LookForDuplicate(MI, CI->second)) {