llvm.org GIT mirror llvm / 3c87285
Delete a store whose input is a load from the same pointer: x = load p store x -> p git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45398 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
1 changed file(s) with 12 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
42224222 if (CombineToPreIndexedLoadStore(N) || CombineToPostIndexedLoadStore(N))
42234223 return SDOperand(N, 0);
42244224
4225 // FIXME: is there such a think as a truncating indexed store?
4225 // FIXME: is there such a thing as a truncating indexed store?
42264226 if (ST->isTruncatingStore() && ST->getAddressingMode() == ISD::UNINDEXED &&
42274227 MVT::isInteger(Value.getValueType())) {
42284228 // See if we can simplify the input to this truncstore with knowledge that
42404240 // SimplifyDemandedBits, which only works if the value has a single use.
42414241 if (SimplifyDemandedBits(Value, MVT::getIntVTBitMask(ST->getStoredVT())))
42424242 return SDOperand(N, 0);
4243 }
4244
4245 // If this is a load followed by a store to the same location, then the store
4246 // is dead/noop.
4247 if (LoadSDNode *Ld = dyn_cast(Value)) {
4248 if (Chain.Val == Ld && Ld->getBasePtr() == Ptr &&
4249 ST->getAddressingMode() == ISD::UNINDEXED &&
4250 ST->getStoredVT() == Ld->getLoadedVT()) {
4251 // The store is dead, remove it.
4252 return Chain;
4253 }
42434254 }
42444255
42454256 return SDOperand();