aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2013-06-18 20:14:39 +0000
committerQuentin Colombet <qcolombet@apple.com>2013-06-18 20:14:39 +0000
commita3fb49cd851cd3b593fc653dc3ba4434c2e1232f (patch)
tree0f949913fa9c0c45d128a5d477cf2bde7ca8b1b9 /lib/CodeGen
parent571dd98ea4d6bf911c3b46a20ca3b5e3b341b21f (diff)
downloadexternal_llvm-a3fb49cd851cd3b593fc653dc3ba4434c2e1232f.zip
external_llvm-a3fb49cd851cd3b593fc653dc3ba4434c2e1232f.tar.gz
external_llvm-a3fb49cd851cd3b593fc653dc3ba4434c2e1232f.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184222 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 608fc27..a454853 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/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;