This is an archive of the discontinued LLVM Phabricator instance.

Add necessary support for storing code-model to module IR.
ClosedPublic

Authored by cmtice on Sep 20 2018, 2:19 PM.

Details

Summary

Currently the code-model does not get saved in the module IR, so if a code model is specified when compiling with LTO, it gets lost and is not propagated properly to LTO. This patch does what is necessary in the front end to pass the code-model to the module, so that the back end can store it in the Module (see https://reviews.llvm.org/D52322 for the back-end patch).

Depends on https://reviews.llvm.org/D52322

Fixes PR33306.

Diff Detail

Repository
rL LLVM

Event Timeline

cmtice created this revision.Sep 20 2018, 2:19 PM

Note that if you add a line like:

"Depends on D52322" in the summary that Phabricator will automatically link the two in the right way.

lib/CodeGen/CodeGenModule.cpp
569 ↗(On Diff #166360)

Can you simplify by using a single constant for both of these (since handling the same)?

lib/CodeGen/CodeGenModule.h
38 ↗(On Diff #166360)

Since nothing changed in this header, should this new include be moved to CodeGenModule.cpp?

test/CodeGen/codemodels.c
2 ↗(On Diff #166360)

Might as well check "tiny" and "default" as well for completeness.

cmtice marked an inline comment as done.Sep 21 2018, 9:33 AM
cmtice added inline comments.
lib/CodeGen/CodeGenModule.cpp
569 ↗(On Diff #166360)

I just realized .Case("default") is not a valid case, so I will remove that and there will only be 1 constant.

test/CodeGen/codemodels.c
2 ↗(On Diff #166360)

I will add a check for "tiny". "default" turns out not to be a valid option.

cmtice updated this revision to Diff 166492.Sep 21 2018, 9:37 AM
cmtice edited the summary of this revision. (Show Details)

Move include statement from CodeGenModule.h to CodeGenModule.cpp
Remove incorrect "default" case statement.
Add test for "tiny" code model.

This revision is now accepted and ready to land.Sep 21 2018, 10:44 AM
This revision was automatically updated to reflect the committed changes.