diff options
author | Lang Hames <lhames@gmail.com> | 2011-11-08 18:56:23 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2011-11-08 18:56:23 +0000 |
commit | 5207bf2177e9ef1e68d9408ea4b44f1c8a5ef9c0 (patch) | |
tree | c94405cc8244718db4821d7662e9479180b3d0ed /lib/CodeGen | |
parent | d752e0f7e64585839cb3a458ef52456eaebbea3c (diff) | |
download | external_llvm-5207bf2177e9ef1e68d9408ea4b44f1c8a5ef9c0.zip external_llvm-5207bf2177e9ef1e68d9408ea4b44f1c8a5ef9c0.tar.gz external_llvm-5207bf2177e9ef1e68d9408ea4b44f1c8a5ef9c0.tar.bz2 |
Lower mem-ops to unaligned i32/i16 load/stores on ARM where supported.
Add support for trimming constants to GetDemandedBits. This fixes some funky
constant generation that occurs when stores are expanded for targets that don't
support unaligned stores natively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index e67016c..8b28ea9 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -4564,6 +4564,16 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) { SDValue DAGCombiner::GetDemandedBits(SDValue V, const APInt &Mask) { switch (V.getOpcode()) { default: break; + case ISD::Constant: { + const ConstantSDNode *CV = cast<ConstantSDNode>(V.getNode()); + assert(CV != 0 && "Const value should be ConstSDNode."); + const APInt &CVal = CV->getAPIntValue(); + APInt NewVal = CVal & Mask; + if (NewVal != CVal) { + return DAG.getConstant(NewVal, V.getValueType()); + } + break; + } case ISD::OR: case ISD::XOR: // If the LHS or RHS don't contribute bits to the or, drop them. |