mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Insert new instructions in AliasSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37390 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aa7d3351f0
commit
e7ae1a9dee
@ -476,9 +476,11 @@ void LICM::sink(Instruction &I) {
|
|||||||
// Firstly, we create a stack object to hold the value...
|
// Firstly, we create a stack object to hold the value...
|
||||||
AllocaInst *AI = 0;
|
AllocaInst *AI = 0;
|
||||||
|
|
||||||
if (I.getType() != Type::VoidTy)
|
if (I.getType() != Type::VoidTy) {
|
||||||
AI = new AllocaInst(I.getType(), 0, I.getName(),
|
AI = new AllocaInst(I.getType(), 0, I.getName(),
|
||||||
I.getParent()->getParent()->getEntryBlock().begin());
|
I.getParent()->getParent()->getEntryBlock().begin());
|
||||||
|
CurAST->add(AI);
|
||||||
|
}
|
||||||
|
|
||||||
// Secondly, insert load instructions for each use of the instruction
|
// Secondly, insert load instructions for each use of the instruction
|
||||||
// outside of the loop.
|
// outside of the loop.
|
||||||
@ -499,6 +501,7 @@ void LICM::sink(Instruction &I) {
|
|||||||
// Insert a new load instruction right before the terminator in
|
// Insert a new load instruction right before the terminator in
|
||||||
// the predecessor block.
|
// the predecessor block.
|
||||||
PredVal = new LoadInst(AI, "", Pred->getTerminator());
|
PredVal = new LoadInst(AI, "", Pred->getTerminator());
|
||||||
|
CurAST->add(cast<LoadInst>(PredVal));
|
||||||
}
|
}
|
||||||
|
|
||||||
UPN->setIncomingValue(i, PredVal);
|
UPN->setIncomingValue(i, PredVal);
|
||||||
@ -507,6 +510,7 @@ void LICM::sink(Instruction &I) {
|
|||||||
} else {
|
} else {
|
||||||
LoadInst *L = new LoadInst(AI, "", U);
|
LoadInst *L = new LoadInst(AI, "", U);
|
||||||
U->replaceUsesOfWith(&I, L);
|
U->replaceUsesOfWith(&I, L);
|
||||||
|
CurAST->add(L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user