This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Support vectors in simplifyIntToPtrRoundTripCast.
ClosedPublic

Authored by craig.topper on Dec 13 2022, 12:00 PM.

Details

Summary

This code compares getPointerTypeSizeInBits and getTypeSizeInBits.
getPointerTypeSizeInBits contains a call to getScalarType while
getTypeSizeInBits does not. This makes the code incorrect for vectors.

For scalable vectors this caused a warning about a scalable TypeSize
being converted to unsigned.

Switch to DL.getTypeSizeInBits for the pointers too. This should
work since inttoptr/ptrtoint can't change the number of elements.
This was suggested by @nikic in D139911.

Fixes PR59480.

Diff Detail

Event Timeline

craig.topper created this revision.Dec 13 2022, 12:00 PM
craig.topper requested review of this revision.Dec 13 2022, 12:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 13 2022, 12:00 PM
craig.topper edited the summary of this revision. (Show Details)Dec 13 2022, 12:01 PM
nikic accepted this revision.Dec 13 2022, 12:01 PM

LGTM

This revision is now accepted and ready to land.Dec 13 2022, 12:01 PM
This revision was landed with ongoing or failed builds.Dec 13 2022, 12:06 PM
This revision was automatically updated to reflect the committed changes.