Skip to content
  • Nico Weber's avatar
    Teach GlobalDCE how to remove empty global_ctor entries. · 4b2acde2
    Nico Weber authored
    This moves most of GlobalOpt's constructor optimization
    code out of GlobalOpt into Transforms/Utils/CDtorUtils.{h,cpp}. The
    public interface is a single function OptimizeGlobalCtorsList() that
    takes a predicate returning which constructors to remove.
    
    GlobalOpt calls this with a function that statically evaluates all
    constructors, just like it did before. This part of the change is
    behavior-preserving.
    
    Also add a call to this from GlobalDCE with a filter that removes global
    constructors that contain a "ret" instruction and nothing else – this
    fixes PR19590.
    
    llvm-svn: 207856
    4b2acde2
Loading