Skip to content

Commit 97201e7

Browse files
committed
address comments
1 parent 9092c7e commit 97201e7

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,20 +4737,27 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) {
47374737
return SDValue();
47384738
};
47394739

4740+
SDValue N0, N1, A, FoldableOp;
4741+
47404742
// Identify and (optionally) peel an outer NOT that wraps a pure logic tree
47414743
auto tryPeelOuterNotWrappingLogic = [&](SDNode *Op) {
47424744
if (Op->getOpcode() == ISD::XOR && Op->hasOneUse() &&
47434745
ISD::isBuildVectorAllOnes(Op->getOperand(1).getNode())) {
47444746
SDValue InnerOp = Op->getOperand(0);
47454747

4746-
if (!getFoldableLogicOp(InnerOp)) {
4748+
if (!getFoldableLogicOp(InnerOp))
47474749
return SDValue();
4748-
}
47494750

4750-
SDValue InnerN0 = InnerOp.getOperand(0);
4751-
SDValue InnerN1 = InnerOp.getOperand(1);
4752-
if (getFoldableLogicOp(InnerN1) || getFoldableLogicOp(InnerN0))
4751+
N0 = InnerOp.getOperand(0);
4752+
N1 = InnerOp.getOperand(1);
4753+
if ((FoldableOp = getFoldableLogicOp(N1))) {
4754+
A = N0;
4755+
return InnerOp;
4756+
}
4757+
if ((FoldableOp = getFoldableLogicOp(N0))) {
4758+
A = N1;
47534759
return InnerOp;
4760+
}
47544761
}
47554762
return SDValue();
47564763
};
@@ -4760,18 +4767,17 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) {
47604767
if (SDValue InnerOp = tryPeelOuterNotWrappingLogic(N)) {
47614768
PeeledOuterNot = true;
47624769
N = InnerOp.getNode();
4763-
}
4764-
4765-
SDValue N0 = N->getOperand(0);
4766-
SDValue N1 = N->getOperand(1);
4770+
} else {
4771+
N0 = N->getOperand(0);
4772+
N1 = N->getOperand(1);
47674773

4768-
SDValue A, FoldableOp;
4769-
if ((FoldableOp = getFoldableLogicOp(N1))) {
4770-
A = N0;
4771-
} else if ((FoldableOp = getFoldableLogicOp(N0))) {
4772-
A = N1;
4773-
} else
4774-
return false;
4774+
if ((FoldableOp = getFoldableLogicOp(N1)))
4775+
A = N0;
4776+
else if ((FoldableOp = getFoldableLogicOp(N0)))
4777+
A = N1;
4778+
else
4779+
return false;
4780+
}
47754781

47764782
SDValue B = FoldableOp.getOperand(0);
47774783
SDValue C = FoldableOp.getOperand(1);

0 commit comments

Comments
 (0)