This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Don't check the legality of type when combine the SIGN_EXTEND_INREG
ClosedPublic

Authored by steven.zhang on Nov 14 2019, 3:30 AM.

Details

Summary

This is the DAG node for SIGN_EXTEND_INREG :

t21: v4i32 = sign_extend_inreg t18, ValueType:ch:v4i16

It has two operands. The first one is the value it want to extend, and the second one is the type to specify how to extend the value. For this example, it means that, it is signed extend the t18(v4i32) from v4i16 to v4i32. That is the semantics of c code:

vector int foo(vector int m) {
   return m << 16 >> 16;
}

And it could be any vector type that hardware support the operation, though the type 'v4i16' is NOT legal for the target. When we are trying to combine the srl + sra, what we did now is calling the TLI.isOperationLegal(), which will also check the legality of the type. That doesn't make sense.

Notice that, this patch is dependent on https://reviews.llvm.org/D69601 to expose the PowerPC missing opportunity. And it is also dependent on https://reviews.llvm.org/D70000, as we are relaxing the combine condition, which might hit the assertion for some targets if they are NOT set it as expand by default.

Diff Detail