diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2013-06-18 20:14:39 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2013-06-18 20:14:39 +0000 |
| commit | b51a68681a005a0f209094438d08d92affda6679 (patch) | |
| tree | 12bbc824bc7c69738bc0c57870d32f3c3f5b3bca /llvm/lib/CodeGen | |
| parent | 54c83695f7aa22e29eb5f74b34f4dc943490de28 (diff) | |
| download | bcm5719-llvm-b51a68681a005a0f209094438d08d92affda6679.tar.gz bcm5719-llvm-b51a68681a005a0f209094438d08d92affda6679.zip | |
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
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 608fc275b5a..a45485382ad 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -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; |

