mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
Make sure the instruction combiner doesn't lose track of instructions
when replacing them, missing the opportunity to do simplifications git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13308 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2934,9 +2934,8 @@ bool InstCombiner::runOnFunction(Function &F) {
|
|||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
TD = &getAnalysis<TargetData>();
|
TD = &getAnalysis<TargetData>();
|
||||||
|
|
||||||
for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
|
for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i)
|
||||||
WorkList.push_back(&*i);
|
WorkList.push_back(&*i);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
while (!WorkList.empty()) {
|
while (!WorkList.empty()) {
|
||||||
@ -2998,6 +2997,10 @@ bool InstCombiner::runOnFunction(Function &F) {
|
|||||||
BasicBlock *InstParent = I->getParent();
|
BasicBlock *InstParent = I->getParent();
|
||||||
InstParent->getInstList().insert(I, Result);
|
InstParent->getInstList().insert(I, Result);
|
||||||
|
|
||||||
|
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
|
||||||
|
if (Instruction *OpI = dyn_cast<Instruction>(I->getOperand(i)))
|
||||||
|
WorkList.push_back(OpI);
|
||||||
|
|
||||||
// Everything uses the new instruction now...
|
// Everything uses the new instruction now...
|
||||||
I->replaceAllUsesWith(Result);
|
I->replaceAllUsesWith(Result);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user