diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-05-29 00:06:36 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-05-29 00:06:36 +0000 |
commit | 032f3261a2dba742ee6b893b4b752d9fbf53cf39 (patch) | |
tree | 818abf6edecec70d5d588028bd0aae9a3e572297 /llvm/lib/CodeGen/MachineLICM.cpp | |
parent | 417fc5e434ef8157dca6109a981658e4361969e9 (diff) | |
download | bcm5719-llvm-032f3261a2dba742ee6b893b4b752d9fbf53cf39.tar.gz bcm5719-llvm-032f3261a2dba742ee6b893b4b752d9fbf53cf39.zip |
Doh. Machine LICM is re-initializing the CSE map over and over. Patch by Anna Zaks. rdar://8037934.
llvm-svn: 105065
Diffstat (limited to 'llvm/lib/CodeGen/MachineLICM.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineLICM.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp index 61206173e64..d9623ab45c9 100644 --- a/llvm/lib/CodeGen/MachineLICM.cpp +++ b/llvm/lib/CodeGen/MachineLICM.cpp @@ -62,6 +62,7 @@ namespace { // State that is updated as we process loops bool Changed; // True if a loop is changed. + bool FirstInLoop; // True if it's the first LICM in the loop. MachineLoop *CurLoop; // The current loop we are working on. MachineBasicBlock *CurPreheader; // The preheader for CurLoop. @@ -207,7 +208,7 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) { else DEBUG(dbgs() << "******** Post-regalloc Machine LICM ********\n"); - Changed = false; + Changed = FirstInLoop = false; TM = &MF.getTarget(); TII = TM->getInstrInfo(); TRI = TM->getRegisterInfo(); @@ -244,6 +245,7 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) { // CSEMap is initialized for loop header when the first instruction is // being hoisted. MachineDomTreeNode *N = DT->getNode(CurLoop->getHeader()); + FirstInLoop = true; HoistRegion(N); CSEMap.clear(); } @@ -776,7 +778,10 @@ void MachineLICM::Hoist(MachineInstr *MI) { // If this is the first instruction being hoisted to the preheader, // initialize the CSE map with potential common expressions. - InitCSEMap(CurPreheader); + if (FirstInLoop) { + InitCSEMap(CurPreheader); + FirstInLoop = false; + } // Look for opportunity to CSE the hoisted instruction. unsigned Opcode = MI->getOpcode(); |