Page MenuHomePhabricator

[TargetLower] Update shouldFormOverflowOp check if math is used.
ClosedPublic

Authored by fhahn on Feb 17 2020, 8:26 AM.

Details

Summary

On some targets, like SPARC, forming overflow ops is only profitable if
the math result is used: https://godbolt.org/z/DxSmdB
This patch adds a new MathUsed parameter to allow the targets
to make the decision and defaults to only allowing it
if the math result is used. That is the conservative choice.

This patch also updates AArch64ISelLowering and X86ISelLowering to all
forming overflow ops if the math result is not used. On those targets
using the overflow intrinsic for the overflow check only generates
better code.

Diff Detail

Event Timeline

fhahn created this revision.Feb 17 2020, 8:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2020, 8:26 AM
lebedev.ri accepted this revision.Feb 17 2020, 2:58 PM
lebedev.ri edited the summary of this revision. (Show Details)

LG to me.

This revision is now accepted and ready to land.Feb 17 2020, 2:59 PM
This revision was automatically updated to reflect the committed changes.