[X86][Codegen] X86DAGToDAGISel::matchBitExtract(): consistently capture lambdas by value

llvm-svn: 364420
This commit is contained in:
Roman Lebedev 2019-06-26 12:19:52 +00:00
parent 64d5bf1738
commit f9bd80f36c

View File

@ -3159,7 +3159,7 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
};
// a) x & ((1 << nbits) + (-1))
auto matchPatternA = [&checkOneUse, peekThroughOneUseTruncation,
auto matchPatternA = [checkOneUse, peekThroughOneUseTruncation,
&NBits](SDValue Mask) -> bool {
// Match `add`. Must only have one use!
if (Mask->getOpcode() != ISD::ADD || !checkOneUse(Mask))
@ -3185,7 +3185,7 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
};
// b) x & ~(-1 << nbits)
auto matchPatternB = [&checkOneUse, isAllOnes, &peekThroughOneUseTruncation,
auto matchPatternB = [checkOneUse, isAllOnes, peekThroughOneUseTruncation,
&NBits](SDValue Mask) -> bool {
// Match `~()`. Must only have one use!
if (Mask.getOpcode() != ISD::XOR || !checkOneUse(Mask))
@ -3225,7 +3225,7 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
};
// c) x & (-1 >> (32 - y))
auto matchPatternC = [&checkOneUse, &peekThroughOneUseTruncation,
auto matchPatternC = [checkOneUse, peekThroughOneUseTruncation,
matchShiftAmt](SDValue Mask) -> bool {
// The mask itself may be truncated.
Mask = peekThroughOneUseTruncation(Mask);
@ -3246,7 +3246,7 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
SDValue X;
// d) x << (32 - y) >> (32 - y)
auto matchPatternD = [&checkOneUse, &checkTwoUse, matchShiftAmt,
auto matchPatternD = [checkOneUse, checkTwoUse, matchShiftAmt,
&X](SDNode *Node) -> bool {
if (Node->getOpcode() != ISD::SRL)
return false;
@ -3266,9 +3266,8 @@ bool X86DAGToDAGISel::matchBitExtract(SDNode *Node) {
return true;
};
auto matchLowBitMask = [&matchPatternA, &matchPatternB,
&matchPatternC](SDValue Mask) -> bool {
// FIXME: pattern c.
auto matchLowBitMask = [matchPatternA, matchPatternB,
matchPatternC](SDValue Mask) -> bool {
return matchPatternA(Mask) || matchPatternB(Mask) || matchPatternC(Mask);
};