During SelectionDAG building explicitly set a node to constant zero when the
value is zero. This allows optmizations to kick in more easily. Fix some test cases so that they remain meaningful (i.e., not completely dead coded) when optimizations apply. <rdar://problem/14096009> superfluous multiply by high part of zero-extended value. llvm-svn: 184222
This commit is contained in:
@@ -718,6 +718,14 @@ SDValue RegsForValue::getCopyFromRegs(SelectionDAG &DAG,
|
||||
unsigned NumSignBits = LOI->NumSignBits;
|
||||
unsigned NumZeroBits = LOI->KnownZero.countLeadingOnes();
|
||||
|
||||
if (NumZeroBits == RegSize) {
|
||||
// The current value is a zero.
|
||||
// Explicitly express that as it would be easier for
|
||||
// optimizations to kick in.
|
||||
Parts[i] = DAG.getConstant(0, RegisterVT);
|
||||
continue;
|
||||
}
|
||||
|
||||
// FIXME: We capture more information than the dag can represent. For
|
||||
// now, just use the tightest assertzext/assertsext possible.
|
||||
bool isSExt = true;
|
||||
|
||||
Reference in New Issue
Block a user