This is an archive of the discontinued LLVM Phabricator instance.

[IR] Implement DataLayout::getPointerTypeSizeInBits using getPointerSizeInBits directly
ClosedPublic

Authored by craig.topper on Apr 7 2017, 11:47 PM.

Details

Summary

Currently we use getTypeSizeInBits which contains a switch statement to dispatch based on what the Type is. We know we always have a pointer type here, but the compiler isn't able to figure out that out to remove the switch.

This patch changes it to just call handle the pointer type directly by calling getPointerSizeInBits without going through a switch.

getPointerTypeSizeInBits is called pretty often, particularly by getOrEnforceKnownAlignment which is used by InstCombine. This should speed that up a little bit.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Apr 7 2017, 11:47 PM
arsenm accepted this revision.Apr 17 2017, 11:08 AM
arsenm added a subscriber: arsenm.

LGTM

This revision is now accepted and ready to land.Apr 17 2017, 11:08 AM
This revision was automatically updated to reflect the committed changes.