Constify some basic blocks, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161668 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2012-08-10 15:55:25 +00:00
parent f6c24eef62
commit f433e800a7

View File

@ -512,7 +512,7 @@ namespace {
/// have that value number. Use findLeader to query it. /// have that value number. Use findLeader to query it.
struct LeaderTableEntry { struct LeaderTableEntry {
Value *Val; Value *Val;
BasicBlock *BB; const BasicBlock *BB;
LeaderTableEntry *Next; LeaderTableEntry *Next;
}; };
DenseMap<uint32_t, LeaderTableEntry> LeaderTable; DenseMap<uint32_t, LeaderTableEntry> LeaderTable;
@ -542,7 +542,7 @@ namespace {
private: private:
/// addToLeaderTable - Push a new Value to the LeaderTable onto the list for /// addToLeaderTable - Push a new Value to the LeaderTable onto the list for
/// its value number. /// its value number.
void addToLeaderTable(uint32_t N, Value *V, BasicBlock *BB) { void addToLeaderTable(uint32_t N, Value *V, const BasicBlock *BB) {
LeaderTableEntry &Curr = LeaderTable[N]; LeaderTableEntry &Curr = LeaderTable[N];
if (!Curr.Val) { if (!Curr.Val) {
Curr.Val = V; Curr.Val = V;
@ -608,13 +608,13 @@ namespace {
void dump(DenseMap<uint32_t, Value*> &d); void dump(DenseMap<uint32_t, Value*> &d);
bool iterateOnFunction(Function &F); bool iterateOnFunction(Function &F);
bool performPRE(Function &F); bool performPRE(Function &F);
Value *findLeader(BasicBlock *BB, uint32_t num); Value *findLeader(const BasicBlock *BB, uint32_t num);
void cleanupGlobalSets(); void cleanupGlobalSets();
void verifyRemoved(const Instruction *I) const; void verifyRemoved(const Instruction *I) const;
bool splitCriticalEdges(); bool splitCriticalEdges();
unsigned replaceAllDominatedUsesWith(Value *From, Value *To, unsigned replaceAllDominatedUsesWith(Value *From, Value *To,
BasicBlock *Root); const BasicBlock *Root);
bool propagateEquality(Value *LHS, Value *RHS, BasicBlock *Root); bool propagateEquality(Value *LHS, Value *RHS, const BasicBlock *Root);
}; };
char GVN::ID = 0; char GVN::ID = 0;
@ -1977,7 +1977,7 @@ bool GVN::processLoad(LoadInst *L) {
// and then scan the list to find one whose block dominates the block in // and then scan the list to find one whose block dominates the block in
// question. This is fast because dominator tree queries consist of only // question. This is fast because dominator tree queries consist of only
// a few comparisons of DFS numbers. // a few comparisons of DFS numbers.
Value *GVN::findLeader(BasicBlock *BB, uint32_t num) { Value *GVN::findLeader(const BasicBlock *BB, uint32_t num) {
LeaderTableEntry Vals = LeaderTable[num]; LeaderTableEntry Vals = LeaderTable[num];
if (!Vals.Val) return 0; if (!Vals.Val) return 0;
@ -2004,7 +2004,7 @@ Value *GVN::findLeader(BasicBlock *BB, uint32_t num) {
/// use is dominated by the given basic block. Returns the number of uses that /// use is dominated by the given basic block. Returns the number of uses that
/// were replaced. /// were replaced.
unsigned GVN::replaceAllDominatedUsesWith(Value *From, Value *To, unsigned GVN::replaceAllDominatedUsesWith(Value *From, Value *To,
BasicBlock *Root) { const BasicBlock *Root) {
unsigned Count = 0; unsigned Count = 0;
for (Value::use_iterator UI = From->use_begin(), UE = From->use_end(); for (Value::use_iterator UI = From->use_begin(), UE = From->use_end();
UI != UE; ) { UI != UE; ) {
@ -2030,7 +2030,7 @@ unsigned GVN::replaceAllDominatedUsesWith(Value *From, Value *To,
/// propagateEquality - The given values are known to be equal in every block /// propagateEquality - The given values are known to be equal in every block
/// dominated by 'Root'. Exploit this, for example by replacing 'LHS' with /// dominated by 'Root'. Exploit this, for example by replacing 'LHS' with
/// 'RHS' everywhere in the scope. Returns whether a change was made. /// 'RHS' everywhere in the scope. Returns whether a change was made.
bool GVN::propagateEquality(Value *LHS, Value *RHS, BasicBlock *Root) { bool GVN::propagateEquality(Value *LHS, Value *RHS, const BasicBlock *Root) {
SmallVector<std::pair<Value*, Value*>, 4> Worklist; SmallVector<std::pair<Value*, Value*>, 4> Worklist;
Worklist.push_back(std::make_pair(LHS, RHS)); Worklist.push_back(std::make_pair(LHS, RHS));
bool Changed = false; bool Changed = false;