This is an archive of the discontinued LLVM Phabricator instance.

[X86] Narrow i64 compares with constant to i32 when the upper 32-bits are known zero.
ClosedPublic

Authored by craig.topper on Oct 27 2019, 11:39 PM.

Details

Summary

This catches some cases. There are probably ways to improve this.
I tried just doing it as a combine on the setcc, but that broke
some cases.

I renamed the isX86CCUnsigned to isX86CCSigned and flipped its
polarity to make it consistent with the similar functions for
ISD::SETCC. This avoids calling EQ/NE as being signed or unsigned.

Fixes PR43823.

Diff Detail

Event Timeline

craig.topper created this revision.Oct 27 2019, 11:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2019, 11:39 PM
RKSimon added inline comments.Oct 28 2019, 2:56 AM
llvm/lib/Target/X86/X86ISelLowering.cpp
20187

Do the equivalent for signed with ComputeNumSignBits?

craig.topper marked an inline comment as done.Oct 28 2019, 10:41 PM
craig.topper added inline comments.
llvm/lib/Target/X86/X86ISelLowering.cpp
20187

I tried, but it affected no lit tests.

RKSimon accepted this revision.Oct 29 2019, 5:05 AM

LGTM

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

Fair enough - add a FIXME if you think its worth it.

This revision is now accepted and ready to land.Oct 29 2019, 5:05 AM
This revision was automatically updated to reflect the committed changes.