Page MenuHomePhabricator

[AMDGPU] Fix assertion due to initializer list

Authored by yaxunl on Oct 17 2019, 11:52 AM.



Sometimes a global var is replaced by a different llvm value. clang use GetAddrOfGlobalVar to get the original llvm global variable.
For most targets, GetAddrOfGlobalVar returns either the llvm global variable or a bitcast of the llvm global variable.
However, for AMDGPU target, GetAddrOfGlobalVar returns the addrspace cast or addrspace cast plus bitcast of the llvm global variable.
To get the llvm global variable, these casts need to be stripped, otherwise there is assertion.

This patch fixes that.

Diff Detail

Event Timeline

yaxunl created this revision.Oct 17 2019, 11:52 AM
rjmccall accepted this revision.Oct 19 2019, 7:02 PM

Minor change, but otherwise LGTM.

3898 ↗(On Diff #225486)

You can just make this whole thing Entry = Entry->stripPointerCasts().

This revision is now accepted and ready to land.Oct 19 2019, 7:02 PM
yaxunl marked 2 inline comments as done.Oct 20 2019, 6:32 AM
yaxunl added inline comments.
3898 ↗(On Diff #225486)

will do when committing

This revision was automatically updated to reflect the committed changes.
yaxunl marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2019, 8:04 AM