[PATCH] D42375: Add --print-icf flag

Owen Reynolds via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 10:45:57 PST 2018


Hi Rafael,

I'd like some clarification. Currently either "log()" or "message()" will
be called with the same calculated message, so moving this to inside
"print()" would not change things.  I changed the format of the "log()"
output to be consistent with "message()",  are you suggesting that the
"log()" message should retain the old format?

Thanks,

Owen

On Tue, Jan 23, 2018 at 6:15 PM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Owen Reynolds via Phabricator <reviews at reviews.llvm.org> writes:
>
>
> > +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
> > +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux
> %p/inputs/print-icf.s -o %t1
> > +# RUN: ld.lld %t %t1 -o %t2 --icf=all --print-icf-sections | FileCheck
> %s
> > +# RUN: ld.lld %t %t1 -o %t2 --icf=all --no-print-icf-sections
> --print-icf-sections | FileCheck %s
> > +# RUN: ld.lld %t %t1 -o %t2 --icf=all --print-icf-sections
> --no-print-icf-sections | not FileCheck %s
>
> Running "not FileCheck" seems pretty brittle. You should probably use
> FileCheck --check-prefix=SOMETHING and add SOMETHING-NOT:...
>
> > -    log("selected " + Sections[Begin]->Name);
> > +    std::string SectionMessage = "selected section '" +
> > +                                 Sections[Begin]->Name.str() + "' from
> file '" +
> > +                                 Sections[Begin]->File->getName().str()
> + "'";
> > +    print(SectionMessage);
>
> This computes the message even when not printing anything. Please pass
> section to print and only compute the message if we are going to print
> it.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180123/e610fc86/attachment-0001.html>


More information about the llvm-commits mailing list