[llvm] r323045 - [X86][SSE] Check for out of bounds PEXTR/PINSR indices during faux shuffle combining.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 20 09:16:02 PST 2018
Author: rksimon
Date: Sat Jan 20 09:16:01 2018
New Revision: 323045
URL: http://llvm.org/viewvc/llvm-project?rev=323045&view=rev
Log:
[X86][SSE] Check for out of bounds PEXTR/PINSR indices during faux shuffle combining.
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=323045&r1=323044&r2=323045&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Jan 20 09:16:01 2018
@@ -6014,8 +6014,11 @@ static bool getFauxShuffleMask(SDValue N
case X86ISD::PINSRW: {
SDValue InVec = N.getOperand(0);
SDValue InScl = N.getOperand(1);
+ SDValue InIndex = N.getOperand(2);
+ if (!isa<ConstantSDNode>(InIndex) ||
+ cast<ConstantSDNode>(InIndex)->getAPIntValue().uge(NumElts))
+ return false;
uint64_t InIdx = N.getConstantOperandVal(2);
- assert(InIdx < NumElts && "Illegal insertion index");
// Attempt to recognise a PINSR*(VEC, 0, Idx) shuffle pattern.
if (X86::isZeroNode(InScl)) {
@@ -6033,8 +6036,12 @@ static bool getFauxShuffleMask(SDValue N
return false;
SDValue ExVec = InScl.getOperand(0);
+ SDValue ExIndex = InScl.getOperand(1);
+ if (!isa<ConstantSDNode>(ExIndex) ||
+ cast<ConstantSDNode>(ExIndex)->getAPIntValue().uge(NumElts))
+ return false;
uint64_t ExIdx = InScl.getConstantOperandVal(1);
- assert(ExIdx < NumElts && "Illegal extraction index");
+
Ops.push_back(InVec);
Ops.push_back(ExVec);
for (unsigned i = 0; i != NumElts; ++i)
More information about the llvm-commits
mailing list