mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-01 16:31:13 +00:00
fix X86/uint_to_fp-2.ll, only fold loads when they have a
single use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5857e0add8
commit
cec479de4e
@ -618,25 +618,46 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
// the old nodes.
|
// the old nodes.
|
||||||
unsigned NumChains = MatcherTable[MatcherIndex++];
|
unsigned NumChains = MatcherTable[MatcherIndex++];
|
||||||
assert(NumChains != 0 && "Can't TF zero chains");
|
assert(NumChains != 0 && "Can't TF zero chains");
|
||||||
|
|
||||||
|
assert(ChainNodesMatched.empty() &&
|
||||||
|
"Should only have one EmitMergeInputChains per match");
|
||||||
|
|
||||||
|
// Handle the first chain.
|
||||||
|
unsigned RecNo = MatcherTable[MatcherIndex++];
|
||||||
|
assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
|
||||||
|
ChainNodesMatched.push_back(RecordedNodes[RecNo].getNode());
|
||||||
|
|
||||||
|
// If the chained node is not the root, we can't fold it if it has
|
||||||
|
// multiple uses.
|
||||||
|
// FIXME: What if other value results of the node have uses not matched by
|
||||||
|
// this pattern?
|
||||||
|
if (ChainNodesMatched.back() != NodeToMatch &&
|
||||||
|
!RecordedNodes[RecNo].hasOneUse()) {
|
||||||
|
ChainNodesMatched.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// The common case here is that we have exactly one chain, which is really
|
// The common case here is that we have exactly one chain, which is really
|
||||||
// cheap to handle, just do it.
|
// cheap to handle, just do it.
|
||||||
if (NumChains == 1) {
|
if (NumChains == 1) {
|
||||||
unsigned RecNo = MatcherTable[MatcherIndex++];
|
|
||||||
assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
|
|
||||||
ChainNodesMatched.push_back(RecordedNodes[RecNo].getNode());
|
|
||||||
InputChain = RecordedNodes[RecNo].getOperand(0);
|
InputChain = RecordedNodes[RecNo].getOperand(0);
|
||||||
assert(InputChain.getValueType() == MVT::Other && "Not a chain");
|
assert(InputChain.getValueType() == MVT::Other && "Not a chain");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read all of the chained nodes.
|
// Read all of the chained nodes.
|
||||||
assert(ChainNodesMatched.empty() &&
|
for (unsigned i = 1; i != NumChains; ++i) {
|
||||||
"Should only have one EmitMergeInputChains per match");
|
RecNo = MatcherTable[MatcherIndex++];
|
||||||
for (unsigned i = 0; i != NumChains; ++i) {
|
|
||||||
unsigned RecNo = MatcherTable[MatcherIndex++];
|
|
||||||
assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
|
assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
|
||||||
ChainNodesMatched.push_back(RecordedNodes[RecNo].getNode());
|
ChainNodesMatched.push_back(RecordedNodes[RecNo].getNode());
|
||||||
|
|
||||||
|
// FIXME: What if other value results of the node have uses not matched by
|
||||||
|
// this pattern?
|
||||||
|
if (ChainNodesMatched.back() != NodeToMatch &&
|
||||||
|
!RecordedNodes[RecNo].hasOneUse()) {
|
||||||
|
ChainNodesMatched.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk all the chained nodes, adding the input chains if they are not in
|
// Walk all the chained nodes, adding the input chains if they are not in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user