[llvm] r185505 - Use SmallVectorImpl& instead of SmallVector& to avoid needlessly respecifying the small vector size.

Eric Christopher echristo at gmail.com
Tue Jul 2 21:38:12 PDT 2013


Heh. After your commits I just did the grep myself.

Crazy.

-eric

On Tue, Jul 2, 2013 at 9:33 PM, Craig Topper <craig.topper at gmail.com> wrote:
> I just spotted the one place in your commit and started grepping. Looks like
> there are a lot of cases like this out there.
>
>
> On Tue, Jul 2, 2013 at 9:30 PM, Eric Christopher <echristo at gmail.com> wrote:
>>
>> And again. Was just reorganizing and didn't think about that part. :)
>>
>> On Jul 2, 2013 9:27 PM, "Craig Topper" <craig.topper at gmail.com> wrote:
>>>
>>> Author: ctopper
>>> Date: Tue Jul  2 23:24:43 2013
>>> New Revision: 185505
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=185505&view=rev
>>> Log:
>>> Use SmallVectorImpl& instead of SmallVector& to avoid needlessly
>>> respecifying the small vector size.
>>>
>>> Modified:
>>>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=185505&r1=185504&r2=185505&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Jul  2 23:24:43
>>> 2013
>>> @@ -439,7 +439,7 @@ DIE *DwarfDebug::constructLexicalScopeDI
>>>    if (Scope->isAbstractScope())
>>>      return ScopeDIE;
>>>
>>> -  const SmallVector<InsnRange, 4> &Ranges = Scope->getRanges();
>>> +  const SmallVectorImpl<InsnRange> &Ranges = Scope->getRanges();
>>>    if (Ranges.empty())
>>>      return 0;
>>>
>>> @@ -483,7 +483,7 @@ DIE *DwarfDebug::constructLexicalScopeDI
>>>  // represent this concrete inlined copy of the function.
>>>  DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU,
>>>                                            LexicalScope *Scope) {
>>> -  const SmallVector<InsnRange, 4> &Ranges = Scope->getRanges();
>>> +  const SmallVectorImpl<InsnRange> &Ranges = Scope->getRanges();
>>>    assert(Ranges.empty() == false &&
>>>           "LexicalScope does not have instruction markers!");
>>>
>>> @@ -589,14 +589,14 @@ DIE *DwarfDebug::constructScopeDIE(Compi
>>>          }
>>>
>>>    // Collect lexical scope children first.
>>> -  const SmallVector<DbgVariable *, 8> &Variables =
>>> ScopeVariables.lookup(Scope);
>>> +  const SmallVectorImpl<DbgVariable *> &Variables
>>> =ScopeVariables.lookup(Scope);
>>>    for (unsigned i = 0, N = Variables.size(); i < N; ++i)
>>>      if (DIE *Variable =
>>>          TheCU->constructVariableDIE(Variables[i],
>>> Scope->isAbstractScope())) {
>>>        Children.push_back(Variable);
>>>        if (Variables[i]->isObjectPointer()) ObjectPointer = Variable;
>>>      }
>>> -  const SmallVector<LexicalScope *, 4> &Scopes = Scope->getChildren();
>>> +  const SmallVectorImpl<LexicalScope *> &Scopes = Scope->getChildren();
>>>    for (unsigned j = 0, M = Scopes.size(); j < M; ++j)
>>>      if (DIE *Nested = constructScopeDIE(TheCU, Scopes[j]))
>>>        Children.push_back(Nested);
>>> @@ -1412,7 +1412,7 @@ void DwarfDebug::identifyScopeMarkers()
>>>    while (!WorkList.empty()) {
>>>      LexicalScope *S = WorkList.pop_back_val();
>>>
>>> -    const SmallVector<LexicalScope *, 4> &Children = S->getChildren();
>>> +    const SmallVectorImpl<LexicalScope *> &Children = S->getChildren();
>>>      if (!Children.empty())
>>>        for (SmallVectorImpl<LexicalScope *>::const_iterator SI =
>>> Children.begin(),
>>>               SE = Children.end(); SI != SE; ++SI)
>>> @@ -1421,7 +1421,7 @@ void DwarfDebug::identifyScopeMarkers()
>>>      if (S->isAbstractScope())
>>>        continue;
>>>
>>> -    const SmallVector<InsnRange, 4> &Ranges = S->getRanges();
>>> +    const SmallVectorImpl<InsnRange> &Ranges = S->getRanges();
>>>      if (Ranges.empty())
>>>        continue;
>>>      for (SmallVectorImpl<InsnRange>::const_iterator RI = Ranges.begin(),
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>
> --
> ~Craig



More information about the llvm-commits mailing list