mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-04 21:30:49 +00:00
Fix a problem that Dan Berlin noticed, where reassociation would not succeed
in building maximal expressions before simplifying them. In particular, i cases like this: X-(A+B+X) the code would consider A+B+X to be a maximal expression (not understanding that the single use '-' would be turned into a + later), simplify it (a noop) then later get simplified again. Each of these simplify steps is where the cost of reassociation comes from, so this patch should speed up the already fast pass a bit. Thanks to Dan for noticing this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23214 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2cd85da3ed
commit
7b4ad94282
@ -612,6 +612,12 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
|
||||
if (I->hasOneUse() && isReassociableOp(I->use_back(), I->getOpcode()))
|
||||
continue;
|
||||
|
||||
// If this is an add tree that is used by a sub instruction, ignore it
|
||||
// until we process the subtract.
|
||||
if (I->hasOneUse() && I->getOpcode() == Instruction::Add &&
|
||||
cast<Instruction>(I->use_back())->getOpcode() == Instruction::Sub)
|
||||
continue;
|
||||
|
||||
// First, walk the expression tree, linearizing the tree, collecting
|
||||
std::vector<ValueEntry> Ops;
|
||||
LinearizeExprTree(I, Ops);
|
||||
|
Loading…
Reference in New Issue
Block a user