[llvm-commits] [llvm] r132988 - in /llvm/trunk: lib/CodeGen/BranchFolding.cpp lib/CodeGen/BranchFolding.h test/CodeGen/X86/tail-threshold.ll
Rafael Espindola
rafael.espindola at gmail.com
Tue Jun 14 05:48:26 PDT 2011
Author: rafael
Date: Tue Jun 14 07:48:26 2011
New Revision: 132988
URL: http://llvm.org/viewvc/llvm-project?rev=132988&view=rev
Log:
revert 132986 to see if the bots go green.
Removed:
llvm/trunk/test/CodeGen/X86/tail-threshold.ll
Modified:
llvm/trunk/lib/CodeGen/BranchFolding.cpp
llvm/trunk/lib/CodeGen/BranchFolding.h
Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=132988&r1=132987&r2=132988&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Tue Jun 14 07:48:26 2011
@@ -799,22 +799,14 @@
// First find blocks with no successors.
MergePotentials.clear();
- for (MachineFunction::iterator I = MF.begin(), E = MF.end();
- I != E && MergePotentials.size() < TailMergeThreshold; ++I) {
- if (TriedMerging.count(I))
- continue;
+ for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
if (I->succ_empty())
MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(I), I));
}
- // If this is a large problem, avoid visiting the same basic blocks
- // multiple times.
- if (MergePotentials.size() == TailMergeThreshold)
- for (unsigned i = 0, e = MergePotentials.size(); i != e; ++i)
- TriedMerging.insert(MergePotentials[i].getBlock());
-
// See if we can do any tail merging on those.
- if (MergePotentials.size() >= 2)
+ if (MergePotentials.size() < TailMergeThreshold &&
+ MergePotentials.size() >= 2)
MadeChange |= TryTailMergeBlocks(NULL, NULL);
// Look at blocks (IBB) with multiple predecessors (PBB).
@@ -838,17 +830,15 @@
for (MachineFunction::iterator I = llvm::next(MF.begin()), E = MF.end();
I != E; ++I) {
- if (I->pred_size() >= 2) {
+ if (I->pred_size() >= 2 && I->pred_size() < TailMergeThreshold) {
SmallPtrSet<MachineBasicBlock *, 8> UniquePreds;
MachineBasicBlock *IBB = I;
MachineBasicBlock *PredBB = prior(I);
MergePotentials.clear();
for (MachineBasicBlock::pred_iterator P = I->pred_begin(),
E2 = I->pred_end();
- P != E2 && MergePotentials.size() < TailMergeThreshold; ++P) {
+ P != E2; ++P) {
MachineBasicBlock *PBB = *P;
- if (TriedMerging.count(PBB))
- continue;
// Skip blocks that loop to themselves, can't tail merge these.
if (PBB == IBB)
continue;
@@ -901,12 +891,6 @@
MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(PBB), *P));
}
}
- // If this is a large problem, avoid visiting the same basic blocks
- // multiple times.
- if (MergePotentials.size() == TailMergeThreshold)
- for (unsigned i = 0, e = MergePotentials.size(); i != e; ++i)
- TriedMerging.insert(MergePotentials[i].getBlock());
-
if (MergePotentials.size() >= 2)
MadeChange |= TryTailMergeBlocks(IBB, PredBB);
// Reinsert an unconditional branch if needed.
Modified: llvm/trunk/lib/CodeGen/BranchFolding.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.h?rev=132988&r1=132987&r2=132988&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.h (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.h Tue Jun 14 07:48:26 2011
@@ -10,7 +10,6 @@
#ifndef LLVM_CODEGEN_BRANCHFOLDING_HPP
#define LLVM_CODEGEN_BRANCHFOLDING_HPP
-#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include <vector>
@@ -48,7 +47,6 @@
};
typedef std::vector<MergePotentialsElt>::iterator MPIterator;
std::vector<MergePotentialsElt> MergePotentials;
- SmallPtrSet<const MachineBasicBlock*, 2> TriedMerging;
class SameTailElt {
MPIterator MPIter;
Removed: llvm/trunk/test/CodeGen/X86/tail-threshold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tail-threshold.ll?rev=132987&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/tail-threshold.ll (original)
+++ llvm/trunk/test/CodeGen/X86/tail-threshold.ll (removed)
@@ -1,41 +0,0 @@
-; RUN: llc %s -stats -tail-merge-threshold 2 -o /dev/null |& FileCheck %s
-
-; Test that we still do some merging if a block has more than
-; tail-merge-threshold predecessors.
-
-; CHECK: 2 branchfolding - Number of block tails merged
-
-declare void @bar()
-
-define void @foo(i32 %xxx) {
-entry:
- switch i32 %xxx, label %bb4 [
- i32 0, label %bb0
- i32 1, label %bb1
- i32 2, label %bb2
- i32 3, label %bb3
- ]
-
-bb0:
- call void @bar()
- br label %bb5
-
-bb1:
- call void @bar()
- br label %bb5
-
-bb2:
- call void @bar()
- br label %bb5
-
-bb3:
- call void @bar()
- br label %bb5
-
-bb4:
- call void @bar()
- br label %bb5
-
-bb5:
- ret void
-}
More information about the llvm-commits
mailing list