Page MenuHomePhabricator

[RISCV] Fix RISCVTTIImpl::getIntImmCost for immediates where getMinSignedBits() > 64

Authored by asb on Jul 9 2019, 12:33 AM.



APInt::getSExtValue will assert if getMinSignedBits() > 64. This can happen, for instance, if examining an i128. Avoid this assertion by checking Imm.getMinSignedBits() <= 64 before doing getTLI()->isLegalAddImmediate(Imm.getSExtValue()). We could directly check getMinSignedBits() <= 12 but it seems better to reuse the isLegalAddImmediate helper for this.

Diff Detail


Event Timeline

asb created this revision.Jul 9 2019, 12:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2019, 12:33 AM
Herald added subscribers: Jim, benna, psnobl and 20 others. · View Herald Transcript
lenary accepted this revision.Jul 9 2019, 2:30 AM

Whoops, good catch.

This revision is now accepted and ready to land.Jul 9 2019, 2:30 AM
This revision was automatically updated to reflect the committed changes.