Skip to content

Commit

Permalink
[DAGCombiner] Replace call getSExtOrTrunc with a truncate. NFC
Browse files Browse the repository at this point in the history
The extend case should never occur. The sign extend would be an
arbitrary choice, remove it to avoid confusion.
  • Loading branch information
topperc committed Apr 6, 2022
1 parent 1342b86 commit 5b5f594
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Expand Up @@ -19474,8 +19474,9 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
// EXTRACT_VECTOR_ELT may widen the extracted vector.
SDValue InOp = VecOp.getOperand(0);
if (InOp.getValueType() != ScalarVT) {
assert(InOp.getValueType().isInteger() && ScalarVT.isInteger());
return DAG.getSExtOrTrunc(InOp, DL, ScalarVT);
assert(InOp.getValueType().isInteger() && ScalarVT.isInteger() &&
InOp.getValueType().bitsGT(ScalarVT));
return DAG.getNode(ISD::TRUNCATE, DL, ScalarVT, InOp);
}
return InOp;
}
Expand Down

0 comments on commit 5b5f594

Please sign in to comment.