diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-11-17 18:30:09 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-11-17 18:30:09 +0000 |
commit | aa60ddac394e8d79ecd9700e32b595c115585007 (patch) | |
tree | a7414886541f0e50696ebdbd975ca91a2e586a79 | |
parent | 076e085698c484354c9e131f1bd8fd001581397b (diff) | |
download | external_llvm-aa60ddac394e8d79ecd9700e32b595c115585007.zip external_llvm-aa60ddac394e8d79ecd9700e32b595c115585007.tar.gz external_llvm-aa60ddac394e8d79ecd9700e32b595c115585007.tar.bz2 |
Remove a special case for tail merging that seems to be both broken and
unnecessary. It is broken because the "isIdenticalTo" check should be
negated. If that is fixed, this code causes the CodeGen/X86/tail-opts.ll
test to fail, in the dont_merge_oddly function. And, I confirmed that the
regression is real -- the generated code is worse. As far as I can tell,
that tail-opts.ll test is checking for what this code is supposed to handle
and we're doing the right thing anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89121 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/BranchFolding.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp index 8a6b0de..d344af0 100644 --- a/lib/CodeGen/BranchFolding.cpp +++ b/lib/CodeGen/BranchFolding.cpp @@ -670,39 +670,6 @@ bool BranchFolder::TryTailMergeBlocks(MachineBasicBlock *SuccBB, // this many instructions in common. unsigned minCommonTailLength = TailMergeSize; - // If there's a successor block, there are some cases which don't require - // new branching and as such are very likely to be profitable. - if (SuccBB) { - if (SuccBB->pred_size() == MergePotentials.size() && - !MergePotentials[0].getBlock()->empty()) { - // If all the predecessors have at least one tail instruction in common, - // merging is very likely to be a win since it won't require an increase - // in static branches, and it will decrease the static instruction count. - bool AllPredsMatch = true; - MachineBasicBlock::iterator FirstNonTerm; - unsigned MinNumTerms = CountTerminators(MergePotentials[0].getBlock(), - FirstNonTerm); - if (FirstNonTerm != MergePotentials[0].getBlock()->end()) { - for (unsigned i = 1, e = MergePotentials.size(); i != e; ++i) { - MachineBasicBlock::iterator OtherFirstNonTerm; - unsigned NumTerms = CountTerminators(MergePotentials[0].getBlock(), - OtherFirstNonTerm); - if (NumTerms < MinNumTerms) - MinNumTerms = NumTerms; - if (OtherFirstNonTerm == MergePotentials[i].getBlock()->end() || - OtherFirstNonTerm->isIdenticalTo(FirstNonTerm)) { - AllPredsMatch = false; - break; - } - } - - // If they all have an instruction in common, do any amount of merging. - if (AllPredsMatch) - minCommonTailLength = MinNumTerms + 1; - } - } - } - DEBUG(errs() << "\nTryTailMergeBlocks: "; for (unsigned i = 0, e = MergePotentials.size(); i != e; ++i) errs() << "BB#" << MergePotentials[i].getBlock()->getNumber() |