This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: Fix invalid bitcasts for memcpy
ClosedPublic

Authored by yaxunl on Dec 4 2017, 2:31 PM.

Details

Summary

CreateCoercedLoad/CreateCoercedStore assumes pointer argument of
memcpy is in addr space 0, which is not correct and causes invalid
bitcasts for triple amdgcn---amdgiz.

It is fixed by using alloca addr space instead.

Diff Detail

Event Timeline

yaxunl created this revision.Dec 4 2017, 2:31 PM
arsenm accepted this revision.Dec 6 2017, 8:30 AM

LGTM

This revision is now accepted and ready to land.Dec 6 2017, 8:30 AM
This revision was automatically updated to reflect the committed changes.
rjmccall added inline comments.Dec 6 2017, 9:00 PM
cfe/trunk/lib/CodeGen/CGCall.cpp
1238 ↗(On Diff #125863)

There is a CreateElementBitCast method on CGBuilderTy that preserves the source address space; that seems like the obviously correct fix here instead of assuming any specific address space on either operand.

1320 ↗(On Diff #125863)

Same.