1 //===- MergeFunctions.cpp - Merge identical functions ---------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass looks for equivalent functions that are mergable and folds them.
12 // A hash is computed from the function, based on its type and number of
15 // Once all hashes are computed, we perform an expensive equality comparison
16 // on each function pair. This takes n^2/2 comparisons per bucket, so it's
17 // important that the hash function be high quality. The equality comparison
18 // iterates through each instruction in each basic block.
20 // When a match is found the functions are folded. If both functions are
21 // overridable, we move the functionality into a new internal function and
22 // leave two overridable thunks to it.
24 //===----------------------------------------------------------------------===//
28 // * virtual functions.
30 // Many functions have their address taken by the virtual function table for
31 // the object they belong to. However, as long as it's only used for a lookup
32 // and call, this is irrelevant, and we'd like to fold such implementations.
34 // * use SCC to cut down on pair-wise comparisons and solve larger cycles.
36 // The current implementation loops over a pair-wise comparison of all
37 // functions in the program where the two functions in the pair are treated as
38 // assumed to be equal until proven otherwise. We could both use fewer
39 // comparisons and optimize more complex cases if we used strongly connected
40 // components of the call graph.
42 // * be smarter about bitcast.
44 // In order to fold functions, we will sometimes add either bitcast instructions
45 // or bitcast constant expressions. Unfortunately, this can confound further
46 // analysis since the two functions differ where one has a bitcast and the
47 // other doesn't. We should learn to peer through bitcasts without imposing bad
48 // performance properties.
50 // * don't emit aliases for Mach-O.
52 // Mach-O doesn't support aliases which means that we must avoid introducing
53 // them in the bitcode on architectures which don't support them, such as
54 // Mac OSX. There's a few approaches to this problem;
55 // a) teach codegen to lower global aliases to thunks on platforms which don't
57 // b) always emit thunks, and create a separate thunk-to-alias pass which
58 // runs on ELF systems. This has the added benefit of transforming other
59 // thunks such as those produced by a C++ frontend into aliases when legal
62 //===----------------------------------------------------------------------===//
64 #define DEBUG_TYPE "mergefunc"
65 #include "llvm/Transforms/IPO.h"
66 #include "llvm/ADT/DenseMap.h"
67 #include "llvm/ADT/FoldingSet.h"
68 #include "llvm/ADT/SmallSet.h"
69 #include "llvm/ADT/Statistic.h"
70 #include "llvm/Constants.h"
71 #include "llvm/InlineAsm.h"
72 #include "llvm/Instructions.h"
73 #include "llvm/LLVMContext.h"
74 #include "llvm/Module.h"
75 #include "llvm/Pass.h"
76 #include "llvm/Support/CallSite.h"
77 #include "llvm/Support/Debug.h"
78 #include "llvm/Support/ErrorHandling.h"
79 #include "llvm/Support/raw_ostream.h"
80 #include "llvm/Target/TargetData.h"
85 STATISTIC(NumFunctionsMerged, "Number of functions merged");
88 class MergeFunctions : public ModulePass {
90 static char ID; // Pass identification, replacement for typeid
91 MergeFunctions() : ModulePass(&ID) {}
93 bool runOnModule(Module &M);
96 bool isEquivalentGEP(const GetElementPtrInst *GEP1,
97 const GetElementPtrInst *GEP2);
99 bool equals(const BasicBlock *BB1, const BasicBlock *BB2);
100 bool equals(const Function *F, const Function *G);
102 bool compare(const Value *V1, const Value *V2);
104 const Function *LHS, *RHS;
105 typedef DenseMap<const Value *, unsigned long> IDMap;
107 DenseMap<const Function *, IDMap> Domains;
108 DenseMap<const Function *, unsigned long> DomainCount;
113 char MergeFunctions::ID = 0;
114 INITIALIZE_PASS(MergeFunctions, "mergefunc", "Merge Functions", false, false);
116 ModulePass *llvm::createMergeFunctionsPass() {
117 return new MergeFunctions();
120 // ===----------------------------------------------------------------------===
121 // Comparison of functions
122 // ===----------------------------------------------------------------------===
124 static unsigned long hash(const Function *F) {
125 const FunctionType *FTy = F->getFunctionType();
128 ID.AddInteger(F->size());
129 ID.AddInteger(F->getCallingConv());
130 ID.AddBoolean(F->hasGC());
131 ID.AddBoolean(FTy->isVarArg());
132 ID.AddInteger(FTy->getReturnType()->getTypeID());
133 for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
134 ID.AddInteger(FTy->getParamType(i)->getTypeID());
135 return ID.ComputeHash();
138 /// isEquivalentType - any two pointers are equivalent. Otherwise, standard
139 /// type equivalence rules apply.
140 static bool isEquivalentType(const Type *Ty1, const Type *Ty2) {
143 if (Ty1->getTypeID() != Ty2->getTypeID())
146 switch(Ty1->getTypeID()) {
148 llvm_unreachable("Unknown type!");
149 // Fall through in Release mode.
150 case Type::IntegerTyID:
151 case Type::OpaqueTyID:
152 // Ty1 == Ty2 would have returned true earlier.
156 case Type::FloatTyID:
157 case Type::DoubleTyID:
158 case Type::X86_FP80TyID:
159 case Type::FP128TyID:
160 case Type::PPC_FP128TyID:
161 case Type::LabelTyID:
162 case Type::MetadataTyID:
165 case Type::PointerTyID: {
166 const PointerType *PTy1 = cast<PointerType>(Ty1);
167 const PointerType *PTy2 = cast<PointerType>(Ty2);
168 return PTy1->getAddressSpace() == PTy2->getAddressSpace();
171 case Type::StructTyID: {
172 const StructType *STy1 = cast<StructType>(Ty1);
173 const StructType *STy2 = cast<StructType>(Ty2);
174 if (STy1->getNumElements() != STy2->getNumElements())
177 if (STy1->isPacked() != STy2->isPacked())
180 for (unsigned i = 0, e = STy1->getNumElements(); i != e; ++i) {
181 if (!isEquivalentType(STy1->getElementType(i), STy2->getElementType(i)))
187 case Type::UnionTyID: {
188 const UnionType *UTy1 = cast<UnionType>(Ty1);
189 const UnionType *UTy2 = cast<UnionType>(Ty2);
191 // TODO: we could be fancy with union(A, union(A, B)) === union(A, B), etc.
192 if (UTy1->getNumElements() != UTy2->getNumElements())
195 for (unsigned i = 0, e = UTy1->getNumElements(); i != e; ++i) {
196 if (!isEquivalentType(UTy1->getElementType(i), UTy2->getElementType(i)))
202 case Type::FunctionTyID: {
203 const FunctionType *FTy1 = cast<FunctionType>(Ty1);
204 const FunctionType *FTy2 = cast<FunctionType>(Ty2);
205 if (FTy1->getNumParams() != FTy2->getNumParams() ||
206 FTy1->isVarArg() != FTy2->isVarArg())
209 if (!isEquivalentType(FTy1->getReturnType(), FTy2->getReturnType()))
212 for (unsigned i = 0, e = FTy1->getNumParams(); i != e; ++i) {
213 if (!isEquivalentType(FTy1->getParamType(i), FTy2->getParamType(i)))
219 case Type::ArrayTyID: {
220 const ArrayType *ATy1 = cast<ArrayType>(Ty1);
221 const ArrayType *ATy2 = cast<ArrayType>(Ty2);
222 return ATy1->getNumElements() == ATy2->getNumElements() &&
223 isEquivalentType(ATy1->getElementType(), ATy2->getElementType());
225 case Type::VectorTyID: {
226 const VectorType *VTy1 = cast<VectorType>(Ty1);
227 const VectorType *VTy2 = cast<VectorType>(Ty2);
228 return VTy1->getNumElements() == VTy2->getNumElements() &&
229 isEquivalentType(VTy1->getElementType(), VTy2->getElementType());
234 /// isEquivalentOperation - determine whether the two operations are the same
235 /// except that pointer-to-A and pointer-to-B are equivalent. This should be
236 /// kept in sync with Instruction::isSameOperationAs.
238 isEquivalentOperation(const Instruction *I1, const Instruction *I2) {
239 if (I1->getOpcode() != I2->getOpcode() ||
240 I1->getNumOperands() != I2->getNumOperands() ||
241 !isEquivalentType(I1->getType(), I2->getType()) ||
242 !I1->hasSameSubclassOptionalData(I2))
245 // We have two instructions of identical opcode and #operands. Check to see
246 // if all operands are the same type
247 for (unsigned i = 0, e = I1->getNumOperands(); i != e; ++i)
248 if (!isEquivalentType(I1->getOperand(i)->getType(),
249 I2->getOperand(i)->getType()))
252 // Check special state that is a part of some instructions.
253 if (const LoadInst *LI = dyn_cast<LoadInst>(I1))
254 return LI->isVolatile() == cast<LoadInst>(I2)->isVolatile() &&
255 LI->getAlignment() == cast<LoadInst>(I2)->getAlignment();
256 if (const StoreInst *SI = dyn_cast<StoreInst>(I1))
257 return SI->isVolatile() == cast<StoreInst>(I2)->isVolatile() &&
258 SI->getAlignment() == cast<StoreInst>(I2)->getAlignment();
259 if (const CmpInst *CI = dyn_cast<CmpInst>(I1))
260 return CI->getPredicate() == cast<CmpInst>(I2)->getPredicate();
261 if (const CallInst *CI = dyn_cast<CallInst>(I1))
262 return CI->isTailCall() == cast<CallInst>(I2)->isTailCall() &&
263 CI->getCallingConv() == cast<CallInst>(I2)->getCallingConv() &&
264 CI->getAttributes().getRawPointer() ==
265 cast<CallInst>(I2)->getAttributes().getRawPointer();
266 if (const InvokeInst *CI = dyn_cast<InvokeInst>(I1))
267 return CI->getCallingConv() == cast<InvokeInst>(I2)->getCallingConv() &&
268 CI->getAttributes().getRawPointer() ==
269 cast<InvokeInst>(I2)->getAttributes().getRawPointer();
270 if (const InsertValueInst *IVI = dyn_cast<InsertValueInst>(I1)) {
271 if (IVI->getNumIndices() != cast<InsertValueInst>(I2)->getNumIndices())
273 for (unsigned i = 0, e = IVI->getNumIndices(); i != e; ++i)
274 if (IVI->idx_begin()[i] != cast<InsertValueInst>(I2)->idx_begin()[i])
278 if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(I1)) {
279 if (EVI->getNumIndices() != cast<ExtractValueInst>(I2)->getNumIndices())
281 for (unsigned i = 0, e = EVI->getNumIndices(); i != e; ++i)
282 if (EVI->idx_begin()[i] != cast<ExtractValueInst>(I2)->idx_begin()[i])
290 bool MergeFunctions::isEquivalentGEP(const GetElementPtrInst *GEP1,
291 const GetElementPtrInst *GEP2) {
292 if (TD && GEP1->hasAllConstantIndices() && GEP2->hasAllConstantIndices()) {
293 SmallVector<Value *, 8> Indices1, Indices2;
294 for (GetElementPtrInst::const_op_iterator I = GEP1->idx_begin(),
295 E = GEP1->idx_end(); I != E; ++I) {
296 Indices1.push_back(*I);
298 for (GetElementPtrInst::const_op_iterator I = GEP2->idx_begin(),
299 E = GEP2->idx_end(); I != E; ++I) {
300 Indices2.push_back(*I);
302 uint64_t Offset1 = TD->getIndexedOffset(GEP1->getPointerOperandType(),
303 Indices1.data(), Indices1.size());
304 uint64_t Offset2 = TD->getIndexedOffset(GEP2->getPointerOperandType(),
305 Indices2.data(), Indices2.size());
306 return Offset1 == Offset2;
309 // Equivalent types aren't enough.
310 if (GEP1->getPointerOperand()->getType() !=
311 GEP2->getPointerOperand()->getType())
314 if (GEP1->getNumOperands() != GEP2->getNumOperands())
317 for (unsigned i = 0, e = GEP1->getNumOperands(); i != e; ++i) {
318 if (!compare(GEP1->getOperand(i), GEP2->getOperand(i)))
325 bool MergeFunctions::compare(const Value *V1, const Value *V2) {
326 if (V1 == LHS || V1 == RHS)
327 if (V2 == LHS || V2 == RHS)
330 // TODO: constant expressions in terms of LHS and RHS
331 if (isa<Constant>(V1))
334 if (isa<InlineAsm>(V1) && isa<InlineAsm>(V2)) {
335 const InlineAsm *IA1 = cast<InlineAsm>(V1);
336 const InlineAsm *IA2 = cast<InlineAsm>(V2);
337 return IA1->getAsmString() == IA2->getAsmString() &&
338 IA1->getConstraintString() == IA2->getConstraintString();
341 // We enumerate constants globally and arguments, basic blocks or
342 // instructions within the function they belong to.
343 const Function *Domain1 = NULL;
344 if (const Argument *A = dyn_cast<Argument>(V1)) {
345 Domain1 = A->getParent();
346 } else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V1)) {
347 Domain1 = BB->getParent();
348 } else if (const Instruction *I = dyn_cast<Instruction>(V1)) {
349 Domain1 = I->getParent()->getParent();
352 const Function *Domain2 = NULL;
353 if (const Argument *A = dyn_cast<Argument>(V2)) {
354 Domain2 = A->getParent();
355 } else if (const BasicBlock *BB = dyn_cast<BasicBlock>(V2)) {
356 Domain2 = BB->getParent();
357 } else if (const Instruction *I = dyn_cast<Instruction>(V2)) {
358 Domain2 = I->getParent()->getParent();
361 if (Domain1 != Domain2)
362 if (Domain1 != LHS && Domain1 != RHS)
363 if (Domain2 != LHS && Domain2 != RHS)
366 IDMap &Map1 = Domains[Domain1];
367 unsigned long &ID1 = Map1[V1];
369 ID1 = ++DomainCount[Domain1];
371 IDMap &Map2 = Domains[Domain2];
372 unsigned long &ID2 = Map2[V2];
374 ID2 = ++DomainCount[Domain2];
379 bool MergeFunctions::equals(const BasicBlock *BB1, const BasicBlock *BB2) {
380 BasicBlock::const_iterator FI = BB1->begin(), FE = BB1->end();
381 BasicBlock::const_iterator GI = BB2->begin(), GE = BB2->end();
384 if (!compare(FI, GI))
387 if (isa<GetElementPtrInst>(FI) && isa<GetElementPtrInst>(GI)) {
388 const GetElementPtrInst *GEP1 = cast<GetElementPtrInst>(FI);
389 const GetElementPtrInst *GEP2 = cast<GetElementPtrInst>(GI);
391 if (!compare(GEP1->getPointerOperand(), GEP2->getPointerOperand()))
394 if (!isEquivalentGEP(GEP1, GEP2))
397 if (!isEquivalentOperation(FI, GI))
400 for (unsigned i = 0, e = FI->getNumOperands(); i != e; ++i) {
401 Value *OpF = FI->getOperand(i);
402 Value *OpG = GI->getOperand(i);
404 if (!compare(OpF, OpG))
407 if (OpF->getValueID() != OpG->getValueID() ||
408 !isEquivalentType(OpF->getType(), OpG->getType()))
414 } while (FI != FE && GI != GE);
416 return FI == FE && GI == GE;
419 bool MergeFunctions::equals(const Function *F, const Function *G) {
420 // We need to recheck everything, but check the things that weren't included
421 // in the hash first.
423 if (F->getAttributes() != G->getAttributes())
426 if (F->hasGC() != G->hasGC())
429 if (F->hasGC() && F->getGC() != G->getGC())
432 if (F->hasSection() != G->hasSection())
435 if (F->hasSection() && F->getSection() != G->getSection())
438 if (F->isVarArg() != G->isVarArg())
441 // TODO: if it's internal and only used in direct calls, we could handle this
443 if (F->getCallingConv() != G->getCallingConv())
446 if (!isEquivalentType(F->getFunctionType(), G->getFunctionType()))
449 assert(F->arg_size() == G->arg_size() &&
450 "Identical functions have a different number of args.");
455 // Visit the arguments so that they get enumerated in the order they're
457 for (Function::const_arg_iterator fi = F->arg_begin(), gi = G->arg_begin(),
458 fe = F->arg_end(); fi != fe; ++fi, ++gi) {
459 if (!compare(fi, gi))
460 llvm_unreachable("Arguments repeat");
463 SmallVector<const BasicBlock *, 8> FBBs, GBBs;
464 SmallSet<const BasicBlock *, 128> VisitedBBs; // in terms of F.
465 FBBs.push_back(&F->getEntryBlock());
466 GBBs.push_back(&G->getEntryBlock());
467 VisitedBBs.insert(FBBs[0]);
468 while (!FBBs.empty()) {
469 const BasicBlock *FBB = FBBs.pop_back_val();
470 const BasicBlock *GBB = GBBs.pop_back_val();
471 if (!compare(FBB, GBB) || !equals(FBB, GBB)) {
476 const TerminatorInst *FTI = FBB->getTerminator();
477 const TerminatorInst *GTI = GBB->getTerminator();
478 assert(FTI->getNumSuccessors() == GTI->getNumSuccessors());
479 for (unsigned i = 0, e = FTI->getNumSuccessors(); i != e; ++i) {
480 if (!VisitedBBs.insert(FTI->getSuccessor(i)))
482 FBBs.push_back(FTI->getSuccessor(i));
483 GBBs.push_back(GTI->getSuccessor(i));
492 // ===----------------------------------------------------------------------===
493 // Folding of functions
494 // ===----------------------------------------------------------------------===
497 // * F is external strong, G is external strong:
498 // turn G into a thunk to F (1)
499 // * F is external strong, G is external weak:
500 // turn G into a thunk to F (1)
501 // * F is external weak, G is external weak:
503 // * F is external strong, G is internal:
504 // address of G taken:
505 // turn G into a thunk to F (1)
506 // address of G not taken:
507 // make G an alias to F (2)
508 // * F is internal, G is external weak
509 // address of F is taken:
510 // turn G into a thunk to F (1)
511 // address of F is not taken:
512 // make G an alias of F (2)
513 // * F is internal, G is internal:
514 // address of F and G are taken:
515 // turn G into a thunk to F (1)
516 // address of G is not taken:
517 // make G an alias to F (2)
519 // alias requires linkage == (external,local,weak) fallback to creating a thunk
520 // external means 'externally visible' linkage != (internal,private)
521 // internal means linkage == (internal,private)
522 // weak means linkage mayBeOverridable
523 // being external implies that the address is taken
525 // 1. turn G into a thunk to F
526 // 2. make G an alias to F
528 enum LinkageCategory {
534 static LinkageCategory categorize(const Function *F) {
535 switch (F->getLinkage()) {
536 case GlobalValue::InternalLinkage:
537 case GlobalValue::PrivateLinkage:
538 case GlobalValue::LinkerPrivateLinkage:
541 case GlobalValue::WeakAnyLinkage:
542 case GlobalValue::WeakODRLinkage:
543 case GlobalValue::ExternalWeakLinkage:
544 case GlobalValue::LinkerPrivateWeakLinkage:
547 case GlobalValue::ExternalLinkage:
548 case GlobalValue::AvailableExternallyLinkage:
549 case GlobalValue::LinkOnceAnyLinkage:
550 case GlobalValue::LinkOnceODRLinkage:
551 case GlobalValue::AppendingLinkage:
552 case GlobalValue::DLLImportLinkage:
553 case GlobalValue::DLLExportLinkage:
554 case GlobalValue::CommonLinkage:
555 return ExternalStrong;
558 llvm_unreachable("Unknown LinkageType.");
562 static void ThunkGToF(Function *F, Function *G) {
563 if (!G->mayBeOverridden()) {
564 // Redirect direct callers of G to F.
565 Constant *BitcastF = ConstantExpr::getBitCast(F, G->getType());
566 for (Value::use_iterator UI = G->use_begin(), UE = G->use_end();
568 Value::use_iterator TheIter = UI;
570 CallSite CS(*TheIter);
571 if (CS && CS.isCallee(TheIter))
572 TheIter.getUse().set(BitcastF);
576 Function *NewG = Function::Create(G->getFunctionType(), G->getLinkage(), "",
578 BasicBlock *BB = BasicBlock::Create(F->getContext(), "", NewG);
580 SmallVector<Value *, 16> Args;
582 const FunctionType *FFTy = F->getFunctionType();
583 for (Function::arg_iterator AI = NewG->arg_begin(), AE = NewG->arg_end();
585 if (FFTy->getParamType(i) == AI->getType()) {
588 Args.push_back(new BitCastInst(AI, FFTy->getParamType(i), "", BB));
593 CallInst *CI = CallInst::Create(F, Args.begin(), Args.end(), "", BB);
595 CI->setCallingConv(F->getCallingConv());
596 if (NewG->getReturnType()->isVoidTy()) {
597 ReturnInst::Create(F->getContext(), BB);
598 } else if (CI->getType() != NewG->getReturnType()) {
599 Value *BCI = new BitCastInst(CI, NewG->getReturnType(), "", BB);
600 ReturnInst::Create(F->getContext(), BCI, BB);
602 ReturnInst::Create(F->getContext(), CI, BB);
605 NewG->copyAttributesFrom(G);
607 G->replaceAllUsesWith(NewG);
608 G->eraseFromParent();
611 static void AliasGToF(Function *F, Function *G) {
612 // Darwin will trigger llvm_unreachable if asked to codegen an alias.
613 return ThunkGToF(F, G);
616 if (!G->hasExternalLinkage() && !G->hasLocalLinkage() && !G->hasWeakLinkage())
617 return ThunkGToF(F, G);
619 GlobalAlias *GA = new GlobalAlias(
620 G->getType(), G->getLinkage(), "",
621 ConstantExpr::getBitCast(F, G->getType()), G->getParent());
622 F->setAlignment(std::max(F->getAlignment(), G->getAlignment()));
624 GA->setVisibility(G->getVisibility());
625 G->replaceAllUsesWith(GA);
626 G->eraseFromParent();
630 static bool fold(std::vector<Function *> &FnVec, unsigned i, unsigned j) {
631 Function *F = FnVec[i];
632 Function *G = FnVec[j];
634 LinkageCategory catF = categorize(F);
635 LinkageCategory catG = categorize(G);
637 if (catF == ExternalWeak || (catF == Internal && catG == ExternalStrong)) {
638 std::swap(FnVec[i], FnVec[j]);
640 std::swap(catF, catG);
651 if (G->hasAddressTaken())
660 assert(catG == ExternalWeak);
662 // Make them both thunks to the same internal function.
663 F->setAlignment(std::max(F->getAlignment(), G->getAlignment()));
664 Function *H = Function::Create(F->getFunctionType(), F->getLinkage(), "",
666 H->copyAttributesFrom(F);
668 F->replaceAllUsesWith(H);
673 F->setLinkage(GlobalValue::InternalLinkage);
682 if (F->hasAddressTaken())
688 bool addrTakenF = F->hasAddressTaken();
689 bool addrTakenG = G->hasAddressTaken();
690 if (!addrTakenF && addrTakenG) {
691 std::swap(FnVec[i], FnVec[j]);
693 std::swap(addrTakenF, addrTakenG);
696 if (addrTakenF && addrTakenG) {
706 ++NumFunctionsMerged;
710 // ===----------------------------------------------------------------------===
712 // ===----------------------------------------------------------------------===
714 bool MergeFunctions::runOnModule(Module &M) {
715 bool Changed = false;
717 std::map<unsigned long, std::vector<Function *> > FnMap;
719 for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
720 if (F->isDeclaration())
723 FnMap[hash(F)].push_back(F);
726 TD = getAnalysisIfAvailable<TargetData>();
730 LocalChanged = false;
731 DEBUG(dbgs() << "size: " << FnMap.size() << "\n");
732 for (std::map<unsigned long, std::vector<Function *> >::iterator
733 I = FnMap.begin(), E = FnMap.end(); I != E; ++I) {
734 std::vector<Function *> &FnVec = I->second;
735 DEBUG(dbgs() << "hash (" << I->first << "): " << FnVec.size() << "\n");
737 for (int i = 0, e = FnVec.size(); i != e; ++i) {
738 for (int j = i + 1; j != e; ++j) {
739 bool isEqual = equals(FnVec[i], FnVec[j]);
741 DEBUG(dbgs() << " " << FnVec[i]->getName()
742 << (isEqual ? " == " : " != ")
743 << FnVec[j]->getName() << "\n");
746 if (fold(FnVec, i, j)) {
748 FnVec.erase(FnVec.begin() + j);
756 Changed |= LocalChanged;
757 } while (LocalChanged);