Skip to content
Reassociate.cpp 37.5 KiB
Newer Older
  DEBUG(errs() << "RAOut:\t"; PrintOps(I, Ops); errs() << '\n');
  
  if (Ops.size() == 1) {
    // This expression tree simplified to something that isn't a tree,
    // eliminate it.
    I->replaceAllUsesWith(Ops[0].Op);
    RemoveDeadBinaryOp(I);
  
  // Now that we ordered and optimized the expressions, splat them back into
  // the expression tree, removing any unneeded nodes.
  RewriteExprTree(I, Ops);
  return I;
Chris Lattner's avatar
Chris Lattner committed
bool Reassociate::runOnFunction(Function &F) {
  // Recalculate the rank map for F
  BuildRankMap(F);

Chris Lattner's avatar
Chris Lattner committed
  for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
  // We are done with the rank map.