This is an archive of the discontinued LLVM Phabricator instance.

[InferAddressSpaces] Check if AS are the same in isNoopPtrIntCastPair
ClosedPublic

Authored by wenju on Apr 12 2022, 12:18 AM.

Details

Summary

isNoopAddrSpaceCast is expecting SrcAS is different from DestAS.
If the two AS are the same, consider ptrtoint/inttoptr as noop cast.

Diff Detail

Event Timeline

wenju created this revision.Apr 12 2022, 12:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2022, 12:18 AM
wenju requested review of this revision.Apr 12 2022, 12:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2022, 12:18 AM
arsenm added inline comments.Apr 12 2022, 6:07 AM
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
148–151

If the only point of this flag is this one test, it's probably not worth it.

813–814

This override won't override the target callback

llvm/test/Transforms/InferAddressSpaces/OpenCL/noop-ptrint-pair.ll
2

"OpenCL" test subdirectory doesn't make sense. The subdirectories are for setting the target build requirements for the tests

wenju added inline comments.Apr 12 2022, 9:10 PM
llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
148–151

the issue is still reproducible using -assume-default-is-flat-addrspace flag, so I'll update

813–814

I see, thanks

llvm/test/Transforms/InferAddressSpaces/OpenCL/noop-ptrint-pair.ll
2

shall I put it in parent folder or X86 subfolder?

wenju updated this revision to Diff 423008.Apr 14 2022, 8:46 PM

remove OverrideFlatAS, move test into X86 folder

arsenm accepted this revision.Apr 18 2022, 7:41 AM
This revision is now accepted and ready to land.Apr 18 2022, 7:41 AM
wenju added a comment.Apr 18 2022, 6:38 PM

@arsenm could you please submit for me? I don't have the permission. Thank you.

This revision was landed with ongoing or failed builds.Apr 27 2022, 8:11 PM
This revision was automatically updated to reflect the committed changes.