This is an archive of the discontinued LLVM Phabricator instance.

GlobalOpt should maintain externally_initialized when splitting aggregates
ClosedPublic

Authored by olista01 on Oct 2 2015, 5:14 AM.

Details

Summary

When GlobalOpt splits an internal, global variable with an aggregate type, it should propagate the externally_initialized flag to the newly created globals.

This makes the pass safe for our downstream use of this flag, while still allowing some useful optimisations (such as removing dead parts of the split aggregate) to be performed. However, I'm not familiar enough with the other uses of this flag (Objective-C selectors and the CUDA device qualifier) to know if splitting an internal, externally_initialized global is valid for them. I'm guessing that it is safe for internal globals, but could anyone confirm this?

I've got a related patch up for review at D13343, the test in this patch depends on that change.

Diff Detail

Repository
rL LLVM

Event Timeline

olista01 updated this revision to Diff 36345.Oct 2 2015, 5:14 AM
olista01 retitled this revision from to GlobalOpt should maintain externally_initialized when splitting aggregates.
olista01 updated this object.
olista01 set the repository for this revision to rL LLVM.
olista01 added a subscriber: llvm-commits.

Ping? (and adding some reviewers that may be able to answer the question about CUDA and Objective-C)

You LGTM’d a related patch (D13343), I had assumed that you did not review this one because of the CUDA and Objective-C questions (in the phabricator summary).

Oliver

From: James Molloy [mailto:james@jamesmolloy.co.uk]
Sent: 09 November 2015 16:27
To: reviews+D13382+public+b1749bb76d44e9b5@reviews.llvm.org; Oliver Stannard; tra@google.com; richard@metafoo.co.uk
Cc: llvm-commits@lists.llvm.org
Subject: Re: [PATCH] D13382: GlobalOpt should maintain externally_initialized when splitting aggregates

Hi Oliver,

I did LGTM this on the 19th October. Did you want more reviews?

James

Ah, sorry, my mistake. I see it in the mail thread, but not in Phab.

I don’t think there’s any need for further review.

From: James Molloy [mailto:james@jamesmolloy.co.uk]
Sent: 09 November 2015 16:36
To: Oliver Stannard; reviews+D13382+public+b1749bb76d44e9b5@reviews.llvm.org; tra@google.com; richard@metafoo.co.uk
Cc: llvm-commits@lists.llvm.org
Subject: Re: [PATCH] D13382: GlobalOpt should maintain externally_initialized when splitting aggregates

I did LGTM this one specifically - I see it in the same mail thread.

I felt the behaviour was obvious and shouldn't depend on ObjC selector support - it looks correct according to LangRef.

However if you want someone else to chip in I'm not going to stand in your way :)

James

This revision was automatically updated to reflect the committed changes.