[llvm] r368609 - [X86] Remove unreachable code from LowerTRUNCATE. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 12:26:45 PDT 2019
Author: ctopper
Date: Mon Aug 12 12:26:45 2019
New Revision: 368609
URL: http://llvm.org/viewvc/llvm-project?rev=368609&view=rev
Log:
[X86] Remove unreachable code from LowerTRUNCATE. NFC
All three 256->128 bit cases were already handled above.
Noticed while looking at the coverage report.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=368609&r1=368608&r2=368609&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 12 12:26:45 2019
@@ -19050,6 +19050,9 @@ SDValue X86TargetLowering::LowerTRUNCATE
truncateVectorWithPACK(X86ISD::PACKSS, VT, In, DL, DAG, Subtarget))
return V;
+ // Handle truncation of V256 to V128 using shuffles.
+ assert(VT.is128BitVector() && InVT.is256BitVector() && "Unexpected types!");
+
if ((VT == MVT::v4i32) && (InVT == MVT::v4i64)) {
// On AVX2, v4i64 -> v4i32 becomes VPERMD.
if (Subtarget.hasInt256()) {
@@ -19126,22 +19129,7 @@ SDValue X86TargetLowering::LowerTRUNCATE
return DAG.getNode(X86ISD::PACKUS, DL, VT, InLo, InHi);
}
- // Handle truncation of V256 to V128 using shuffles.
- assert(VT.is128BitVector() && InVT.is256BitVector() && "Unexpected types!");
-
- assert(Subtarget.hasAVX() && "256-bit vector without AVX!");
-
- unsigned NumElems = VT.getVectorNumElements();
- MVT NVT = MVT::getVectorVT(VT.getVectorElementType(), NumElems * 2);
-
- SmallVector<int, 16> MaskVec(NumElems * 2, -1);
- // Prepare truncation shuffle mask
- for (unsigned i = 0; i != NumElems; ++i)
- MaskVec[i] = i * 2;
- In = DAG.getBitcast(NVT, In);
- SDValue V = DAG.getVectorShuffle(NVT, DL, In, In, MaskVec);
- return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, V,
- DAG.getIntPtrConstant(0, DL));
+ llvm_unreachable("All 256->128 cases should have been handled above!");
}
SDValue X86TargetLowering::LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const {
More information about the llvm-commits
mailing list