Skip to content

Commit

Permalink
[RISCV] Strengthen INSERT_SUBVECTOR check in combineBinOpToReduce.
Browse files Browse the repository at this point in the history
It's not enough for the vector we're inserting into to be undef.
We also need to be inserting into the lowest subvector.

Spotted by inspection while trying to figure out why this doesn't
work for vp.reduce.fadd.
  • Loading branch information
topperc committed Apr 25, 2023
1 parent c95533a commit a1e8971
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9126,7 +9126,8 @@ static SDValue combineBinOpToReduce(SDNode *N, SelectionDAG &DAG,
SDValue ScalarV = Reduce.getOperand(2);
EVT ScalarVT = ScalarV.getValueType();
if (ScalarV.getOpcode() == ISD::INSERT_SUBVECTOR &&
ScalarV.getOperand(0)->isUndef())
ScalarV.getOperand(0)->isUndef() &&
isNullConstant(ScalarV.getOperand(2)))
ScalarV = ScalarV.getOperand(1);

// Make sure that ScalarV is a splat with VL=1.
Expand Down

0 comments on commit a1e8971

Please sign in to comment.