[lld] r198788 - [Mips] Factor out the code determines type of GOT entry (local/global)
Simon Atanasyan
simon at atanasyan.com
Thu Jan 9 00:00:31 PST 2014
On Thu, Jan 9, 2014 at 2:39 AM, Rui Ueyama <ruiu at google.com> wrote:
> On Wed, Jan 8, 2014 at 12:42 PM, Simon Atanasyan <simon at atanasyan.com>
> wrote:
>> --- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
>> +++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Wed Jan 8
>> 14:42:45 2014
>> @@ -122,30 +122,47 @@ private:
>> const_cast<Reference &>(ref).setTarget(getGOTEntry(ref.target()));
>> }
>>
>> + bool requireLocalGOT(const Atom *a) {
>> + Atom::Scope scope;
>> + if (isa<DefinedAtom>(a))
>> + scope = dyn_cast<DefinedAtom>(a)->scope();
>> + else if (isa<AbsoluteAtom>(a))
>> + scope = dyn_cast<AbsoluteAtom>(a)->scope();
>> + else
>> + return false;
>
>
> dyn_cast calls isa, so isa is called twice in each expression. Probably
>
> if (auto *def = dyn_cast<DefinedAtom>(a))
> scope = def->scope();
> else if (auto *abs = dyn_cast<AbsoluteAtom>(a))
> ...
>
> would be a bit better?
Good point. Thanks. Fixed at r198855.
--
Simon Atanasyan
More information about the llvm-commits
mailing list