[patch] Teach GlobalDCE how to remove empty global_ctor entries

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri May 2 11:05:23 PDT 2014


>> This is a case where an integration test might be a good idea.  Do you
>> have a reasonably size test where this change causes a ctor to  be
>> deleted at -O2? We might want to test that, so that even if we go with
>> a different optimization strategy in the future we still have a test
>> of the end result (the ctor gets deleted somewhere in -O2).
>
> Yes, there's one in the bug. I can check that in on the clang side
> once this patch is in.

I was not thinking of *that* much integration, just a opt -O2 :-)

Also on testing, can you add a test of the case where only some of the
elements of llvm.global_ctors are removed? Make sure it includes a
CHECK of the new content of global_ctor.

The patch LGTM with the extra testing. Richard, do you want to get
llvm::function_ref in first or do it as followup patch?

Cheers,
Rafael



More information about the llvm-commits mailing list