[PATCH] D24104: Make GlobalsAA ignore dead constant expressions.

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 10:21:16 PDT 2016

On 8/31/2016 4:19 PM, Daniel Berlin wrote:
> In theory yes, in practice, it probably shouldn't.
> In particular, i would never expect *this* pass to modify the IR.
> Is there some reason things don't get cleaned up that means this pass 
> has to clean them up?

This isn't really modifying the IR: dead Constants aren't actually part 
of the IR in the sense that they're not relevant to the semantics of IR, 
and they're implicitly discarded if you dump the IR to a file.

Existing passes don't clean up dead Constants simply because it isn't 
convenient; the standard accessors for modifying and erasing 
instructions don't clean them up because it would lead to 
use-after-free, and passes generally don't clean them up because it 
would be mostly useless boilerplate.

I can come up with some other solution if you want to insist on the 
invariant that GlobalsAA isn't allowed to modify any data structure 
associated with the module, but I don't really see a need.


Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

More information about the llvm-commits mailing list