[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp

Chris Lattner clattner at apple.com
Thu Jun 7 17:37:44 PDT 2007


> BranchFolding.cpp updated: 1.65 -> 1.66
> ---
> Log message:
>
> Throttle tail merging; handling blocks with large numbers of  
> predecessors
> is too slow.

Thanks Dale,

Please make this a hidden command line option like loop-unswitch- 
threshold.

-Chris

>
> ---
> Diffs of the changes:  (+6 -2)
>
>  BranchFolding.cpp |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
>
> Index: llvm/lib/CodeGen/BranchFolding.cpp
> diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.65 llvm/lib/CodeGen/ 
> BranchFolding.cpp:1.66
> --- llvm/lib/CodeGen/BranchFolding.cpp:1.65	Mon Jun  4 18:52:54 2007
> +++ llvm/lib/CodeGen/BranchFolding.cpp	Thu Jun  7 19:34:27 2007
> @@ -564,6 +564,9 @@
>    return MadeChange;
>  }
>
> +// Throttle for huge numbers of predecessors (compile speed problems)
> +#define THRESHOLD 100
> +
>  bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
>
>    if (!EnableTailMerge) return false;
> @@ -577,7 +580,8 @@
>        MergePotentials.push_back(std::make_pair(HashEndOfMBB(I,  
> 2U), I));
>    }
>    // See if we can do any tail merging on those.
> -  MadeChange |= TryMergeBlocks(NULL, NULL);
> +  if (MergePotentials.size() < THRESHOLD)
> +    MadeChange |= TryMergeBlocks(NULL, NULL);
>
>    // Look at blocks (IBB) with multiple predecessors (PBB).
>    // We change each predecessor to a canonical form, by
> @@ -599,7 +603,7 @@
>    // transformations.)
>
>    for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I ! 
> = E; ++I) {
> -    if (!I->succ_empty() && I->pred_size() >= 2) {
> +    if (!I->succ_empty() && I->pred_size() >= 2 && I->pred_size()  
> < THRESHOLD) {
>        MachineBasicBlock *IBB = I;
>        MachineBasicBlock *PredBB = prior(I);
>        MergePotentials.clear();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list