This is an archive of the discontinued LLVM Phabricator instance.

[IR] Implement Constant::isNegativeZeroValue/isZeroValue/isAllOnesValue/isOneValue/isMinSignedValue for ConstantDataVector without going through getElementAsConstant
ClosedPublic

Authored by craig.topper on Jul 5 2017, 9:11 PM.

Details

Summary

Currently these methods call ConstantDataVector::getSplatValue which uses getElementsAsConstant to create a Constant object representing the element value. This method incurs a map lookup to see if we already have created such a Constant before and if not allocates a new Constant object.

This patch changes these methods to use getElementAsAPFloat and getElementAsInteger so we can just examine the data values directly.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Jul 5 2017, 9:11 PM

Add getElementAsAPInt.

craig.topper accepted this revision.Jul 15 2017, 2:51 PM

Accepting based on @bogner's LGTM in email reply.

This revision is now accepted and ready to land.Jul 15 2017, 2:51 PM
This revision was automatically updated to reflect the committed changes.