forked from OSchip/llvm-project
[X86] Don't peek through bitcasts before checking ISD::isBuildVectorOfConstantSDNodes in combineTruncatedArithmetic
We don't have any combines that can look through a bitcast to truncate a build vector of constants. So the truncate will stick around and give us something like this pattern (binop (trunc X), (trunc (bitcast (build_vector)))) which has two truncates in it. Which will be reversed by hoistLogicOpWithSameOpcodeHands in the generic DAG combiner. Thus causing an infinite loop. Even if we had a combine for (truncate (bitcast (build_vector))), I think it would need to be implemented in getNode otherwise DAG combiner visit ordering would probably still visit the binop first and reverse it. Or combineTruncatedArithmetic would need to do its own constant folding. Differential Revision: https://reviews.llvm.org/D58705 llvm-svn: 355116
This commit is contained in:
parent
8d70e6425c
commit
38427c47b9
|
@ -38717,8 +38717,11 @@ static SDValue combineTruncatedArithmetic(SDNode *N, SelectionDAG &DAG,
|
|||
return true;
|
||||
|
||||
// See if this is a single use constant which can be constant folded.
|
||||
SDValue BC = peekThroughOneUseBitcasts(Op);
|
||||
return ISD::isBuildVectorOfConstantSDNodes(BC.getNode());
|
||||
// NOTE: We don't peek throught bitcasts here because there is currently
|
||||
// no support for constant folding truncate+bitcast+vector_of_constants. So
|
||||
// we'll just send up with a truncate on both operands which will
|
||||
// get turned back into (truncate (binop)) causing an infinite loop.
|
||||
return ISD::isBuildVectorOfConstantSDNodes(Op.getNode());
|
||||
};
|
||||
|
||||
auto TruncateArithmetic = [&](SDValue N0, SDValue N1) {
|
||||
|
|
Loading…
Reference in New Issue