This is an archive of the discontinued LLVM Phabricator instance.

MemCpyOpt: don't create new addrspacecasts
AcceptedPublic

Authored by escha on Mar 13 2017, 11:00 AM.

Details

Summary

It's not generally safe to create new addrspace casts in the optimizer (since not all such addrspace casts are legal on any given target), so given that we don't currently have a generic way to check, bail instead of creating them.

This fixes a problem on an out of tree target where memcpyopt creates invalid addrspace casts in order to "cleverly" eliminate a memcpy.

Diff Detail

Repository
rL LLVM

Event Timeline

escha created this revision.Mar 13 2017, 11:00 AM
arsenm added inline comments.Mar 13 2017, 11:05 AM
test/Transforms/MemCpyOpt/memcpy.ll
207–213

How about more tests, where the sources are addrspacecasted to the same address space?

escha updated this revision to Diff 91760.Mar 14 2017, 12:17 PM
arsenm accepted this revision.Mar 14 2017, 3:48 PM

LGTM

This revision is now accepted and ready to land.Mar 14 2017, 3:48 PM