This is an archive of the discontinued LLVM Phabricator instance.

InferAddressSpaces: Avoid assertion failure with replacing identical cloned constexpr
ClosedPublic

Authored by niravd on Jun 7 2017, 8:36 AM.

Details

Summary

Have cloneConstantExprWithNewAddressSpaces return nullptr when
returning initial ConstantExpr.

Diff Detail

Repository
rL LLVM

Event Timeline

niravd created this revision.Jun 7 2017, 8:36 AM
arsenm edited edge metadata.Jun 7 2017, 9:10 AM

I'm not sure I see why this would crash?

test/Transforms/InferAddressSpaces/NVPTX/clone_constexpr.ll
3–4 ↗(On Diff #101745)

Should remove these since they are redundant with the opt argument

23 ↗(On Diff #101745)

Name values

41–43 ↗(On Diff #101745)

You should be able to remove all the metadata in the test

41–53 ↗(On Diff #101745)

You should be able to remove all the metadata in the test

niravd marked 4 inline comments as done.Jun 7 2017, 10:25 AM

I'm not sure I see why this would crash?

I should have written it as assert. When the replacement is done, it assume that the new value is an address space cast and asserts in llvm::ConstantExpr::getAddrSpaceCast.

niravd retitled this revision from InferAddressSpaces: Avoid crash with replacing identical cloned constexpr to InferAddressSpaces: Avoid assertion failure with replacing identical cloned constexpr.Jun 7 2017, 10:26 AM
niravd updated this revision to Diff 101769.Jun 7 2017, 10:26 AM

Address comments

arsenm accepted this revision.Jun 7 2017, 1:30 PM

I'm not sure I see why this would crash?

I should have written it as assert. When the replacement is done, it assume that the new value is an address space cast and asserts in llvm::ConstantExpr::getAddrSpaceCast.

LGTM. Can you add a comment to this effect somewhere though

This revision is now accepted and ready to land.Jun 7 2017, 1:30 PM
This revision was automatically updated to reflect the committed changes.