This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Fix constant expression initializers for global variables
ClosedPublic

Authored by asavonic on Jun 15 2022, 10:07 AM.

Details

Summary

Before this patch the code in printScalarConstant was unable to handle
nested constant expressions like (gep (addrspacecast ptr)) and crashed
with:

LLVM ERROR: Unsupported expression in static initializer:

addrspacecast ([4 x i8] addrspace(1)* @ga to [4 x i8]*)

We can use lowerConstantForGV instead which is a customized version of
lowerConstant that supports generic() and nested expressions.

Diff Detail

Event Timeline

asavonic created this revision.Jun 15 2022, 10:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2022, 10:07 AM
asavonic requested review of this revision.Jun 15 2022, 10:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2022, 10:07 AM
tra accepted this revision.Jun 16 2022, 1:06 PM
This revision is now accepted and ready to land.Jun 16 2022, 1:06 PM
This revision was landed with ongoing or failed builds.Oct 3 2022, 2:31 PM
This revision was automatically updated to reflect the committed changes.