diff options
| author | Craig Topper <craig.topper@intel.com> | 2019-07-15 17:56:57 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2019-07-15 17:56:57 +0000 |
| commit | 81971b2b79c4ac7b01f4997176dae86befc55f37 (patch) | |
| tree | d666a2fbab6d7c8ce65e90386d0905c7f221ac70 /llvm/lib | |
| parent | 3e7c314b039d735adf760ddead7f6e32d4dc81be (diff) | |
| download | bcm5719-llvm-81971b2b79c4ac7b01f4997176dae86befc55f37.tar.gz bcm5719-llvm-81971b2b79c4ac7b01f4997176dae86befc55f37.zip | |
[X86] Return UNDEF from LowerScalarImmediateShift when the shift amount is out of range.
I think we only turn out of range shiftss to undef when
all elements are out of range or the shift amount is a splat out
of range. I'm not sure which, I didn't check.
During lowering we can split a shift where some elements
are out of range into multiple shifts. This can create a
new shift with a splat shift amount that is out of range.
This patch returns undef for this case.
Fixes PR42615.
Differential Revision: https://reviews.llvm.org/D64699
llvm-svn: 366096
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index c5bf3dcac45..47389f2df32 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -25033,8 +25033,11 @@ static SDValue LowerScalarImmediateShift(SDValue Op, SelectionDAG &DAG, APInt APIntShiftAmt; if (!isConstantSplat(Amt, APIntShiftAmt)) return SDValue(); - assert(APIntShiftAmt.ult(VT.getScalarSizeInBits()) && - "Out of range shift amount"); + + // If the shift amount is out of range, return undef. + if (APIntShiftAmt.uge(VT.getScalarSizeInBits())) + return DAG.getUNDEF(VT); + uint64_t ShiftAmt = APIntShiftAmt.getZExtValue(); if (SupportedVectorShiftWithImm(VT, Subtarget, Op.getOpcode())) |

