[PATCH] D26880: [ThinLTO] Fix crash: transitively referenced global shouldn't be promoted

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 19 07:31:12 PST 2016


tejohnson added a comment.

Interesting, this is pretty much the opposite of a patch I sent yesterday (https://reviews.llvm.org/D26866) to fix a Chromium build issue (PR31052).

By removing this code, we can have more failures of the type described in that bug, because the backend will decide not to promote constant unnamed_addr constants (doPromoteLocalToGlobal).

I see two fixes to both of these issues (PR31052 and the issue you are trying to fix here):

1. Disable the constant unnamed_addr promotion optimization in doPromoteLocalToGlobal
2. Change the importing logic to prevent import of anything that will cause a non-renamable value to be exported via recursive analysis of exported globals (recursively invoke canBeExternallyReferenced when looking at global variable summaries)

The disadvantage of #1, while simpler, is that we would prevent optimizations. I.e. the situation in PR26866 is from constant propagation once we have imported since the parameters of the imported function were constants used to access the imported global constant array.


https://reviews.llvm.org/D26880





More information about the llvm-commits mailing list