This is an archive of the discontinued LLVM Phabricator instance.

Improve KnownBits analyses for SMIN/SMAX DAG nodes.
AbandonedPublic

Authored by aymanmus on Jan 14 2021, 8:00 AM.

Details

Summary

In computeKnownBits method for SMIN & SMAX opcodes, an early exit can miss opportunities for valuable information.
The code terminates the function in case no bits were known from the 1st operand, while sine valuable information can be extracted about the result's bits from the 2nd operand alone.

For example:

  • smax x, 0 --> MSB of x is always 0.
  • smin x, -1 --> MSB of x is always 1.

Diff Detail

Event Timeline

aymanmus created this revision.Jan 14 2021, 8:00 AM
aymanmus requested review of this revision.Jan 14 2021, 8:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 14 2021, 8:00 AM
foad added a comment.Jan 14 2021, 8:08 AM

This is very similar to D87145.

RKSimon added inline comments.Jan 14 2021, 8:12 AM
llvm/test/CodeGen/X86/avx512-trunc.ll
1018

Same problem as D87145 - this isn't testing what its supposed to be testing.....

@foad, @RKSimon, Thanks for directing me to the other patch.
I'll just close this and track D87145.

llvm/test/CodeGen/X86/avx512-trunc.ll
1018

I agree, the test doesn't make sense.

aymanmus abandoned this revision.Jan 14 2021, 8:31 AM

Duplicate - D87145

foad added inline comments.Jan 14 2021, 9:55 AM
llvm/test/CodeGen/X86/avx512-trunc.ll
1018

It does seem a little unfair to let that block these patches though. I don't know what the X86 maintainers intended to test!