mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Doh. Machine LICM is re-initializing the CSE map over and over. Patch by Anna Zaks. rdar://8037934.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105065 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7c9a6e3284
commit
82e0a1a1a8
@ -62,6 +62,7 @@ namespace {
|
|||||||
|
|
||||||
// State that is updated as we process loops
|
// State that is updated as we process loops
|
||||||
bool Changed; // True if a loop is changed.
|
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.
|
MachineLoop *CurLoop; // The current loop we are working on.
|
||||||
MachineBasicBlock *CurPreheader; // The preheader for CurLoop.
|
MachineBasicBlock *CurPreheader; // The preheader for CurLoop.
|
||||||
|
|
||||||
@ -207,7 +208,7 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
else
|
else
|
||||||
DEBUG(dbgs() << "******** Post-regalloc Machine LICM ********\n");
|
DEBUG(dbgs() << "******** Post-regalloc Machine LICM ********\n");
|
||||||
|
|
||||||
Changed = false;
|
Changed = FirstInLoop = false;
|
||||||
TM = &MF.getTarget();
|
TM = &MF.getTarget();
|
||||||
TII = TM->getInstrInfo();
|
TII = TM->getInstrInfo();
|
||||||
TRI = TM->getRegisterInfo();
|
TRI = TM->getRegisterInfo();
|
||||||
@ -244,6 +245,7 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
// CSEMap is initialized for loop header when the first instruction is
|
// CSEMap is initialized for loop header when the first instruction is
|
||||||
// being hoisted.
|
// being hoisted.
|
||||||
MachineDomTreeNode *N = DT->getNode(CurLoop->getHeader());
|
MachineDomTreeNode *N = DT->getNode(CurLoop->getHeader());
|
||||||
|
FirstInLoop = true;
|
||||||
HoistRegion(N);
|
HoistRegion(N);
|
||||||
CSEMap.clear();
|
CSEMap.clear();
|
||||||
}
|
}
|
||||||
@ -776,7 +778,10 @@ void MachineLICM::Hoist(MachineInstr *MI) {
|
|||||||
|
|
||||||
// If this is the first instruction being hoisted to the preheader,
|
// If this is the first instruction being hoisted to the preheader,
|
||||||
// initialize the CSE map with potential common expressions.
|
// initialize the CSE map with potential common expressions.
|
||||||
InitCSEMap(CurPreheader);
|
if (FirstInLoop) {
|
||||||
|
InitCSEMap(CurPreheader);
|
||||||
|
FirstInLoop = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Look for opportunity to CSE the hoisted instruction.
|
// Look for opportunity to CSE the hoisted instruction.
|
||||||
unsigned Opcode = MI->getOpcode();
|
unsigned Opcode = MI->getOpcode();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user