[llvm] r277993 - [X86][SSE] Assert if the shuffle mask indices are not -1 or within a valid input range
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 04:07:34 PDT 2016
Author: rksimon
Date: Mon Aug 8 06:07:34 2016
New Revision: 277993
URL: http://llvm.org/viewvc/llvm-project?rev=277993&view=rev
Log:
[X86][SSE] Assert if the shuffle mask indices are not -1 or within a valid input range
As discussed in post-review rL277959
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=277993&r1=277992&r2=277993&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Aug 8 06:07:34 2016
@@ -12287,14 +12287,11 @@ static SDValue lowerVectorShuffle(SDValu
return DAG.getVectorShuffle(VT, DL, V1, V2, NewMask);
}
- // Ensure that undefined mask elements only use SM_SentinelUndef.
- if (llvm::any_of(Mask, [](int M) { return M < SM_SentinelUndef; })) {
- SmallVector<int, 8> NewMask(Mask.begin(), Mask.end());
- for (int &M : NewMask)
- if (M < SM_SentinelUndef)
- M = SM_SentinelUndef;
- return DAG.getVectorShuffle(VT, DL, V1, V2, NewMask);
- }
+ // Check for illegal shuffle mask element index values.
+ int MaskUpperLimit = Mask.size() * (V2IsUndef ? 1 : 2); (void)MaskUpperLimit;
+ assert(llvm::all_of(Mask,
+ [&](int M) { return -1 <= M && M < MaskUpperLimit; }) &&
+ "Out of bounds shuffle index");
// We actually see shuffles that are entirely re-arrangements of a set of
// zero inputs. This mostly happens while decomposing complex shuffles into
More information about the llvm-commits
mailing list