Page MenuHomePhabricator

Revert "[GISel]: Fix incorrect IRTranslation while translating null pointer types"
ClosedPublic

Authored by arsenm on Feb 17 2020, 12:05 PM.

Details

Summary

This reverts commit b3297ef05179e1fee616b97b1c65b58e4c7fef17.

This change is incorrect. The current semantic of null in the IR is a
pointer with the bitvalue 0. It is not a cast from an integer 0, so
this should preserve the pointer type.

Diff Detail

Event Timeline

arsenm created this revision.Feb 17 2020, 12:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2020, 12:05 PM

Which part of the langref are you referring to?

Anyway, we discussed this internally and this seems slightly better than using inttoptr.

llvm/test/CodeGen/AArch64/GlobalISel/swifterror.ll
62 ↗(On Diff #245023)

Could you fix up the selection for arm64 here so we can maintain the existing codegen?

In AArch64InstructionSelector::earlySelect we handle zero values for G_CONSTANT, and we should extend that to handle p0 types to generate the xzr/wzr register forms.

arsenm added a comment.Mar 3 2020, 3:06 PM

Which part of the langref are you referring to?

http://llvm.org/docs/LangRef.html#simple-constants, Null pointer constants. This falls short in actually saying this means a bit-value 0 pointer in all address spaces, but all of the code treats it this way.

Anyway, we discussed this internally and this seems slightly better than using inttoptr.

Could you fix up the ARM64 selection code as I mentioned earlier so we don't generate different instructions?

arsenm updated this revision to Diff 253725.Mar 30 2020, 3:43 PM

Fix AArch64 selection

aemerson accepted this revision.Mar 30 2020, 4:10 PM

LGTM.

This revision is now accepted and ready to land.Mar 30 2020, 4:10 PM