This is an archive of the discontinued LLVM Phabricator instance.

[X86] Combine ADC(ADD(X,Y),0,Carry) -> ADC(X,Y,Carry)
ClosedPublic

Authored by chfast on Feb 23 2022, 2:02 PM.

Diff Detail

Event Timeline

chfast created this revision.Feb 23 2022, 2:02 PM
chfast requested review of this revision.Feb 23 2022, 2:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2022, 2:02 PM
chfast added inline comments.Feb 23 2022, 2:05 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
52114

Is it guaranteed the constant is in RHS?

52115

I copied !N->hasAnyUseOfValue(1) from the combineSBB() but I don't understand why this is needed. There is no negative test for it.

craig.topper added inline comments.Feb 23 2022, 2:15 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
52115

That checks that the EFLAG result is unused. Doing this combine can change the value of the C flag produced by the ADC so we need to make sure no one is looking at it.

RKSimon accepted this revision.Feb 24 2022, 2:33 AM

LGTM - cheers

This revision is now accepted and ready to land.Feb 24 2022, 2:33 AM
This revision was landed with ongoing or failed builds.Feb 25 2022, 5:31 AM
This revision was automatically updated to reflect the committed changes.
xbolva00 added inline comments.
llvm/lib/Target/X86/X86ISelLowering.cpp
52156

OneUseCheck of Add?

@RKSimon

Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2022, 5:30 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
RKSimon added inline comments.Apr 7 2022, 5:35 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
52156

why?