Page MenuHomePhabricator

DAG: computeNumSignBits for MUL
ClosedPublic

Authored by arsenm on Aug 26 2019, 11:10 AM.

Details

Summary

Copied directly from the IR version.

Most of the testcases I've added for this are somewhat problematic
because they really end up testing the yet to be implemented version
for MUL_I24/MUL_U24.

Diff Detail

Event Timeline

arsenm created this revision.Aug 26 2019, 11:10 AM
lebedev.ri accepted this revision.Aug 26 2019, 11:34 AM

LG as a copy-paste from lib/Analysis/ValueTracking.cpp ComputeNumSignBitsImpl().

lib/CodeGen/SelectionDAG/SelectionDAG.cpp
3723

1 is a magic 'i-dont-know', right? I wonder why it's not -1,
that one you certainly can't ever get normally, unlike 1 (INT_MIN)
(Well, yeah, or Optional<unsigned>)

This revision is now accepted and ready to land.Aug 26 2019, 11:34 AM
arsenm marked an inline comment as done.Aug 26 2019, 11:41 AM
arsenm added inline comments.
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
3723

There is always the sign bit itself, so any uses should naturally do the right thing from that.

bjope added a subscriber: bjope.Aug 26 2019, 12:04 PM

Not sure if we need it for this patch, but I remember that last time I did something with computeNumSignBits in SelectionDAG I was informed that it is possible to add unittests in llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp. In case you for example want to make more detailed tests.

RKSimon requested changes to this revision.Aug 26 2019, 1:56 PM
RKSimon added inline comments.
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
3719

Can't we just use the VTBits variable? Also, getValueSizeInBits only works on scalar types.

This revision now requires changes to proceed.Aug 26 2019, 1:56 PM
arsenm updated this revision to Diff 217260.Aug 26 2019, 4:05 PM

Use VTBits

lebedev.ri marked an inline comment as done.Aug 26 2019, 4:09 PM
lebedev.ri added inline comments.
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
3719

Whoops, i thought i reviewed that bit, but looks like i looked at this line in next case.

RKSimon accepted this revision.Aug 27 2019, 5:32 AM

LGTM - cheers

This revision is now accepted and ready to land.Aug 27 2019, 5:32 AM
arsenm closed this revision.Aug 27 2019, 12:04 PM

r370099