diff options
author | Nirav Dave <niravd@google.com> | 2017-12-01 14:49:26 +0000 |
---|---|---|
committer | Nirav Dave <niravd@google.com> | 2017-12-01 14:49:26 +0000 |
commit | eb2b24fded7e44d3fcff9f397b52ba29691dbab1 (patch) | |
tree | db43de2d444e7770688553f56365e67906c69b79 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 9c8f2caa013b4781f4bd58a12909ff818a489ec9 (diff) | |
download | bcm5719-llvm-eb2b24fded7e44d3fcff9f397b52ba29691dbab1.tar.gz bcm5719-llvm-eb2b24fded7e44d3fcff9f397b52ba29691dbab1.zip |
[ARM][DAG] Reenable post-legalize store merge
Summary: Reenable post-legalize stores with constant merging computation and cofrresponding test case.
Reviewers: eastig, efriedma
Subscribers: aemerson, javed.absar, kristof.beyls, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D40701
llvm-svn: 319547
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 4d7af07fb93..f04010abb46 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -12636,9 +12636,10 @@ bool DAGCombiner::MergeStoresOfConstantsOrVecElts( ElementSizeBits), SDLoc(CFP), IntMemVT); else if (auto *C = dyn_cast<ConstantSDNode>(Val)) - Val = DAG.getConstant( - C->getAPIntValue().zextOrTrunc(ElementSizeBits), - SDLoc(C), IntMemVT); + Val = DAG.getConstant(C->getAPIntValue() + .zextOrTrunc(Val.getValueSizeInBits()) + .zextOrTrunc(ElementSizeBits), + SDLoc(C), IntMemVT); } // Make sure correctly size type is the correct type. Val = DAG.getBitcast(MemVT, Val); @@ -12701,9 +12702,14 @@ bool DAGCombiner::MergeStoresOfConstantsOrVecElts( SDValue Val = St->getValue(); StoreInt <<= ElementSizeBits; if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Val)) { - StoreInt |= C->getAPIntValue().zextOrTrunc(SizeInBits); + StoreInt |= C->getAPIntValue() + .zextOrTrunc(ElementSizeBits) + .zextOrTrunc(SizeInBits); } else if (ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(Val)) { - StoreInt |= C->getValueAPF().bitcastToAPInt().zextOrTrunc(SizeInBits); + StoreInt |= C->getValueAPF() + .bitcastToAPInt() + .zextOrTrunc(ElementSizeBits) + .zextOrTrunc(SizeInBits); } else { llvm_unreachable("Invalid constant element type"); } |