Fix Regression/Transforms/Reassociate/2005-08-24-Crash.ll

llvm-svn: 23019
This commit is contained in:
Chris Lattner 2005-08-24 17:55:32 +00:00
parent 347f5cb985
commit 8ca5b2a6d2
1 changed files with 7 additions and 1 deletions

View File

@ -496,9 +496,15 @@ void Reassociate::OptimizeExpression(unsigned Opcode,
++NumAnnihil;
} else {
assert(Opcode == Instruction::Xor);
if (e == 2) {
Ops[0].Op = Constant::getNullValue(Ops[0].Op->getType());
Ops.erase(Ops.begin()+1, Ops.end());
++NumAnnihil;
return;
}
// ... X^X -> ...
Ops.erase(Ops.begin()+i, Ops.begin()+i+2);
i -= 2; e -= 2;
i -= 1; e -= 2;
IterateOptimization = true;
++NumAnnihil;
}