This is an archive of the discontinued LLVM Phabricator instance.

[X86] Remove unnecessary COPY from EmitLoweredCascadedSelect.
ClosedPublic

Authored by craig.topper on Jun 18 2022, 12:09 PM.

Details

Summary

I believe we already checked that the destination of the first
CMOV is only used by the second CMOV so I don't think there is any
reason we need the PHI to write the register that was used by the
first CMOV. We can directly use the second CMOV destination and
avoid the copy.

This may be a left over from when the cascaded select handling
was part of the main algorithm before it was refactored in D35685.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 18 2022, 12:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2022, 12:09 PM
craig.topper requested review of this revision.Jun 18 2022, 12:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2022, 12:09 PM
craig.topper edited the summary of this revision. (Show Details)Jun 18 2022, 12:09 PM
pengfei accepted this revision.Jun 27 2022, 5:33 PM

LGTM.
Just curious: why no test affected. Is the COPY eliminated laterly?

llvm/lib/Target/X86/X86ISelLowering.cpp
34573

Use Op2Reg?

This revision is now accepted and ready to land.Jun 27 2022, 5:33 PM

LGTM.
Just curious: why no test affected. Is the COPY eliminated laterly?

I guess so. The coalescer would probably remove it if it not removed by CSE or peephole pass. I didn't look too closely. I was looking at it because of D127871 which is adding a similar function for RISC-V.

This revision was landed with ongoing or failed builds.Jun 28 2022, 9:34 AM
This revision was automatically updated to reflect the committed changes.