[llvm] r249560 - [ARM] Prevent PerformVDIVCombine from combining a vcvt/vdiv with 8 lanes.
Chad Rosier via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 09:15:41 PDT 2015
Author: mcrosier
Date: Wed Oct 7 11:15:40 2015
New Revision: 249560
URL: http://llvm.org/viewvc/llvm-project?rev=249560&view=rev
Log:
[ARM] Prevent PerformVDIVCombine from combining a vcvt/vdiv with 8 lanes.
This would result in a crash since the vcvt used does not support v8i32 types.
Modified:
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
llvm/trunk/test/CodeGen/ARM/vdiv_combine.ll
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=249560&r1=249559&r2=249560&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Oct 7 11:15:40 2015
@@ -9908,10 +9908,12 @@ static SDValue PerformVDIVCombine(SDNode
uint32_t FloatBits = FloatTy.getSizeInBits();
MVT IntTy = Op.getOperand(0).getSimpleValueType().getVectorElementType();
uint32_t IntBits = IntTy.getSizeInBits();
- if (FloatBits != 32 || IntBits > 32) {
+ unsigned NumLanes = Op.getValueType().getVectorNumElements();
+ if (FloatBits != 32 || IntBits > 32 || NumLanes > 4) {
// These instructions only exist converting from i32 to f32. We can handle
// smaller integers by generating an extra extend, but larger ones would
- // be lossy.
+ // be lossy. We also can't handle more then 4 lanes, since these intructions
+ // only support v2i32/v4i32 types.
return SDValue();
}
@@ -9922,7 +9924,6 @@ static SDValue PerformVDIVCombine(SDNode
SDLoc dl(N);
SDValue ConvInput = Op.getOperand(0);
- unsigned NumLanes = Op.getValueType().getVectorNumElements();
if (IntBits < FloatBits)
ConvInput = DAG.getNode(isSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND,
dl, NumLanes == 2 ? MVT::v2i32 : MVT::v4i32,
Modified: llvm/trunk/test/CodeGen/ARM/vdiv_combine.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/vdiv_combine.ll?rev=249560&r1=249559&r2=249560&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/vdiv_combine.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/vdiv_combine.ll Wed Oct 7 11:15:40 2015
@@ -136,3 +136,11 @@ define <2 x double> @fix_i64_to_double(<
ret <2 x double> %shift
}
+; Don't combine with 8 lanes. Just make sure things don't crash.
+; CHECK-LABEL: test7
+define <8 x float> @test7(<8 x i32> %in) nounwind {
+entry:
+ %vcvt.i = sitofp <8 x i32> %in to <8 x float>
+ %div.i = fdiv <8 x float> %vcvt.i, <float 8.0, float 8.0, float 8.0, float 8.0, float 8.0, float 8.0, float 8.0, float 8.0>
+ ret <8 x float> %div.i
+}
More information about the llvm-commits
mailing list