Skip to content

Commit e450787

Browse files
committed
fix: review
1 parent c2889e8 commit e450787

File tree

4 files changed

+304
-2206
lines changed

4 files changed

+304
-2206
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13165,24 +13165,24 @@ static SDValue combineVSelectWithAllOnesOrZeros(SDValue Cond, SDValue TVal,
1316513165

1316613166
// select Cond, -1, x → or Cond, x
1316713167
if (IsTAllOne) {
13168-
SDValue X = DAG.getBitcast(CondVT, FVal);
13169-
SDValue Or = DAG.getNode(ISD::OR, DL, CondVT, Cond, DAG.getFreeze(X));
13168+
SDValue X = DAG.getBitcast(CondVT, DAG.getFreeze(FVal));
13169+
SDValue Or = DAG.getNode(ISD::OR, DL, CondVT, Cond, X);
1317013170
return DAG.getBitcast(VT, Or);
1317113171
}
1317213172

1317313173
// select Cond, x, 0 → and Cond, x
1317413174
if (IsFAllZero) {
13175-
SDValue X = DAG.getBitcast(CondVT, TVal);
13176-
SDValue And = DAG.getNode(ISD::AND, DL, CondVT, Cond, DAG.getFreeze(X));
13175+
SDValue X = DAG.getBitcast(CondVT, DAG.getFreeze(TVal));
13176+
SDValue And = DAG.getNode(ISD::AND, DL, CondVT, Cond, X);
1317713177
return DAG.getBitcast(VT, And);
1317813178
}
1317913179

1318013180
// select Cond, 0, x -> and not(Cond), x
1318113181
if (IsTAllZero &&
1318213182
(isBitwiseNot(peekThroughBitcasts(Cond)) || TLI.hasAndNot(Cond))) {
13183-
SDValue X = DAG.getBitcast(CondVT, FVal);
13184-
SDValue And = DAG.getNode(ISD::AND, DL, CondVT,
13185-
DAG.getNOT(DL, Cond, CondVT), DAG.getFreeze(X));
13183+
SDValue X = DAG.getBitcast(CondVT, DAG.getFreeze(FVal));
13184+
SDValue And =
13185+
DAG.getNode(ISD::AND, DL, CondVT, DAG.getNOT(DL, Cond, CondVT), X);
1318613186
return DAG.getBitcast(VT, And);
1318713187
}
1318813188

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9132,11 +9132,17 @@ LowerBUILD_VECTORAsVariablePermute(SDValue V, const SDLoc &DL,
91329132
SelectionDAG &DAG,
91339133
const X86Subtarget &Subtarget) {
91349134
SDValue SrcVec, IndicesVec;
9135+
9136+
auto PeekThroughFreeze = [](SDValue N) {
9137+
if (N->getOpcode() == ISD::FREEZE && N.hasOneUse())
9138+
return N->getOperand(0);
9139+
return N;
9140+
};
91359141
// Check for a match of the permute source vector and permute index elements.
91369142
// This is done by checking that the i-th build_vector operand is of the form:
91379143
// (extract_elt SrcVec, (extract_elt IndicesVec, i)).
91389144
for (unsigned Idx = 0, E = V.getNumOperands(); Idx != E; ++Idx) {
9139-
SDValue Op = V.getOperand(Idx);
9145+
SDValue Op = PeekThroughFreeze(V.getOperand(Idx));
91409146
if (Op.getOpcode() != ISD::EXTRACT_VECTOR_ELT)
91419147
return SDValue();
91429148

0 commit comments

Comments
 (0)