diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-05-28 05:36:49 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-05-28 05:36:49 +0000 |
| commit | 49cdc6b5648712c5dbd7f54ee07ce89941878804 (patch) | |
| tree | 04ee6ae8433f585d6e37022ef8213b63c7d435cd /llvm/lib/Analysis | |
| parent | c7e2ff298011dc889628c268e4571e84af898aac (diff) | |
| download | bcm5719-llvm-49cdc6b5648712c5dbd7f54ee07ce89941878804.tar.gz bcm5719-llvm-49cdc6b5648712c5dbd7f54ee07ce89941878804.zip | |
Minor efficiency gain: do 1 nlogn lookup instead of two
Code cleanup
llvm-svn: 13875
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/IPA/FindUsedTypes.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp index 15208f60db6..c50e3ecaaad 100644 --- a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp @@ -32,12 +32,10 @@ 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, otherwise + // return. + if (!UsedTypes.insert(Ty).second) return; // Already contain Ty. - // If ty doesn't already exist in the used types map, add it now. - // - UsedTypes.insert(Ty); - // Make sure to add any types this type references now. // for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); @@ -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 |

