llvm-svn: 294919
This commit is contained in:
Daniel Berlin 2017-02-12 22:02:20 +00:00
parent ce5ce02604
commit 3fecad0d3e
1 changed files with 2 additions and 1 deletions

View File

@ -571,7 +571,7 @@ const Expression *NewGVN::createExpression(Instruction *I) {
// numbers. Since all commutative instructions have two operands it is more
// efficient to sort by hand rather than using, say, std::sort.
assert(I->getNumOperands() == 2 && "Unsupported commutative instruction!");
if (E->getOperand(0) > E->getOperand(1))
if (shouldSwapOperands(E->getOperand(0), E->getOperand(1)))
E->swapOperands(0, 1);
}
@ -2425,6 +2425,7 @@ bool NewGVN::eliminateInstructions(Function &F) {
// we will simplify an operation with all constants so that it doesn't matter
// what order they appear in.
unsigned int NewGVN::getRank(const Value *V) const {
assert(V && "What?");
if (isa<Constant>(V))
return 0;
else if (auto *A = dyn_cast<Argument>(V))