Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 15,431 Lines • ▼ Show 20 Lines | if (ST->isUnindexed() && !ST->isVolatile() && ST1->isUnindexed() && | ||||
// If this is a store who's preceeding store to a subset of the current | // If this is a store who's preceeding store to a subset of the current | ||||
// location and no one other node is chained to that store we can | // location and no one other node is chained to that store we can | ||||
// effectively drop the store. Do not remove stores to undef as they may | // effectively drop the store. Do not remove stores to undef as they may | ||||
// be used as data sinks. | // be used as data sinks. | ||||
if (STBase.contains(STByteSize, ChainBase, ChainByteSize, DAG)) { | if (STBase.contains(STByteSize, ChainBase, ChainByteSize, DAG)) { | ||||
CombineTo(ST1, ST1->getChain()); | CombineTo(ST1, ST1->getChain()); | ||||
return SDValue(); | return SDValue(); | ||||
} | } | ||||
// If ST stores to a subset of preceeding store's write set, we may be | |||||
courbet: nit: `preceding` (here and elsewhere) | |||||
// able to fold ST's value into the preceeding stored value. As we know | |||||
// the other uses of ST1's chain are unconcerned with ST, this folding | |||||
// will not affect those nodes. | |||||
int64_t Offset; | |||||
Implementing this FIXME is just a matter of changing the Offset * 8 calculation below, right? And, updating test cases, of course. If so, I think it's easy enough to be worth implementing just for completeness. rnk: Implementing this FIXME is just a matter of changing the `Offset * 8` calculation below, right? | |||||
if (ChainBase.contains(ChainByteSize, STBase, STByteSize, DAG, | |||||
Offset)) { | |||||
SDValue ChainValue = ST1->getValue(); | |||||
if (auto *C1 = dyn_cast<ConstantSDNode>(ChainValue)) { | |||||
if (auto *C = dyn_cast<ConstantSDNode>(Value)) { | |||||
APInt Val = C1->getAPIntValue(); | |||||
APInt InsertVal = C->getAPIntValue().zextOrTrunc(STByteSize * 8); | |||||
if (DAG.getDataLayout().isBigEndian()) | |||||
Offset = ChainByteSize - 1 - Offset; | |||||
Not Done ReplyInline Actionsclang-format ? courbet: clang-format ? | |||||
Val.insertBits(InsertVal, Offset * 8); | |||||
SDValue NewSDVal = | |||||
DAG.getConstant(Val, SDLoc(C), ChainValue.getValueType(), | |||||
C1->isTargetOpcode(), C1->isOpaque()); | |||||
SDNode *NewST1 = DAG.UpdateNodeOperands( | |||||
ST1, ST1->getChain(), NewSDVal, ST1->getOperand(2), | |||||
ST1->getOperand(3)); | |||||
return CombineTo(ST, SDValue(NewST1, 0)); | |||||
} | |||||
} | |||||
} // End ST subset of ST1 case. | |||||
} | } | ||||
} | } | ||||
} | } | ||||
// If this is an FP_ROUND or TRUNC followed by a store, fold this into a | // If this is an FP_ROUND or TRUNC followed by a store, fold this into a | ||||
// truncating store. We can do this even if this is already a truncstore. | // truncating store. We can do this even if this is already a truncstore. | ||||
if ((Value.getOpcode() == ISD::FP_ROUND || Value.getOpcode() == ISD::TRUNCATE) | if ((Value.getOpcode() == ISD::FP_ROUND || Value.getOpcode() == ISD::TRUNCATE) | ||||
&& Value.getNode()->hasOneUse() && ST->isUnindexed() && | && Value.getNode()->hasOneUse() && ST->isUnindexed() && | ||||
▲ Show 20 Lines • Show All 4,119 Lines • Show Last 20 Lines |
nit: preceding (here and elsewhere)