[PATCH] Remove dangling BlockAddresses in GlobalDCE

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Aug 20 22:26:48 PDT 2014


On 20 August 2014 17:07, Bruno Cardoso Lopes <bruno.cardoso at gmail.com> wrote:
> Without this patch, GlobalDCE won't properly clean up blockaddress references, leaving BBs ref counts without proper update. One way to test that such ref counts are updated is to expose the module to further optimizations that actually use this refcount; simplifycfg in this example.
> Other passes need to be executed before GlobalDCE to trigger the removal of @foo.addrs.

But they don't need to execute on every test run. Your testcase reduces to just

@bar = internal unnamed_addr constant i8* blockaddress(@foo, %L1)
define void @foo() {
entry:
  br label %L1
L1:
  ret void
}

Right now running "opt -globaldce -simplifycfg" will remove @bar, but
not L1. With your patch L1 is also removed.

Cheers,
Rafael




More information about the llvm-commits mailing list