mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-24 12:36:30 +00:00
Minor efficiency gain: do 1 nlogn lookup instead of two
Code cleanup llvm-svn: 13875
This commit is contained in:
parent
75036dce04
commit
37c8081a07
@ -32,11 +32,9 @@ void FindUsedTypes::stub() {}
|
||||
// collection of used types.
|
||||
//
|
||||
void FindUsedTypes::IncorporateType(const Type *Ty) {
|
||||
if (UsedTypes.count(Ty)) return; // Already contain Ty.
|
||||
|
||||
// If ty doesn't already exist in the used types map, add it now.
|
||||
//
|
||||
UsedTypes.insert(Ty);
|
||||
// If ty doesn't already exist in the used types map, add it now, otherwise
|
||||
// return.
|
||||
if (!UsedTypes.insert(Ty).second) return; // Already contain Ty.
|
||||
|
||||
// Make sure to add any types this type references now.
|
||||
//
|
||||
@ -79,9 +77,8 @@ bool FindUsedTypes::run(Module &m) {
|
||||
for (const_inst_iterator II = inst_begin(F), IE = inst_end(F);
|
||||
II != IE; ++II) {
|
||||
const Instruction &I = *II;
|
||||
const Type *Ty = I.getType();
|
||||
|
||||
IncorporateType(Ty); // Incorporate the type of the instruction
|
||||
IncorporateType(I.getType()); // Incorporate the type of the instruction
|
||||
for (User::const_op_iterator OI = I.op_begin(), OE = I.op_end();
|
||||
OI != OE; ++OI)
|
||||
IncorporateValue(*OI); // Insert inst operand types as well
|
||||
|
Loading…
Reference in New Issue
Block a user