This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Handle big-endian target BITCAST in computeKnownBits()
ClosedPublic

Authored by jonpa on Mar 8 2018, 5:00 AM.

Details

Summary

The BITCAST handling in computeKnownBits() previously only worked for little endian.

This patch reverses the iteration over elements for a big-endian target which allows this to work in this case also.

SystemZ test case.

Diff Detail

Event Timeline

jonpa created this revision.Mar 8 2018, 5:00 AM
RKSimon added a subscriber: RKSimon.
RKSimon added inline comments.
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
2381

Will this be correct? Does it need to be reversed for BE?

SubDemandedElts.shl(ISLE ? i : (SubScale - 1 - i))
jonpa added inline comments.Mar 13 2018, 9:05 AM
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
2381

PING!

(Personally I think this is correct - it seems to me to otherwise simply again disregard endianness. First the input is analyzed, then the bitcast is performed in the same way as if writing to memory and then loading back. Only in this second step should any reversal take place, or?)

ping. Eli, could you take a look at this, please?

efriedma accepted this revision.Mar 16 2018, 12:27 PM

LGTM

lib/CodeGen/SelectionDAG/SelectionDAG.cpp
2381

It doesn't matter what order you analyze the sub-elements, as long as you map them correctly to the original element.

This revision is now accepted and ready to land.Mar 16 2018, 12:27 PM
jonpa closed this revision.Mar 17 2018, 1:43 AM

Thank you. r327764.