This is an archive of the discontinued LLVM Phabricator instance.

[X86] Merge ISD::ADD/SUB nodes into X86ISD::ADD/SUB equivalents (PR40483)
ClosedPublic

Authored by RKSimon on Feb 24 2019, 2:12 PM.

Details

Summary

Avoid ADD/SUB instruction duplication by reusing the X86ISD::ADD/SUB results.

Includes ADD commutation - I tried to include NEG+SUB SUB commutation as well but this causes regressions as we don't have good combine coverage to simplify X86ISD::SUB.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Feb 24 2019, 2:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2019, 2:12 PM
craig.topper accepted this revision.Feb 24 2019, 11:59 PM

LGTM with one minor

lib/Target/X86/X86ISelLowering.cpp
41001 ↗(On Diff #188091)

Why not just pass SDValue(N, 0) in the CombineTo call?

This revision is now accepted and ready to land.Feb 24 2019, 11:59 PM
RKSimon marked an inline comment as done.Feb 25 2019, 1:38 AM

Cheers Craig

lib/Target/X86/X86ISelLowering.cpp
41001 ↗(On Diff #188091)

Legacy from when I was trying to get the negation to work - I'll move it back.

This revision was automatically updated to reflect the committed changes.