[PATCH] Don't use getSetCCResultType for creating a vselect
Matt Arsenault
Matthew.Arsenault at amd.com
Mon Sep 9 17:17:23 PDT 2013
Hi nadav,
The vselect mask isn't a setcc.
This breaks in the case when the result of getSetCCResultType
is larger than the vector operands
e.g. %tmp = select i1 %cmp <2 x i8> %a, <2 x i8> %b
when getSetCCResultType returns <2 x i32>, the assertion
that the (MaskTy.getSizeInBits() == Op1.getValueType().getSizeInBits())
is hit.
No test since I don't think I can hit this with any of the current
targets. The R600/SI implementation would break, since it returns a
vector of i1 for this, but it doesn't reach ExpandSELECT for other
reasons.
http://llvm-reviews.chandlerc.com/D1631
Files:
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
Index: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
+++ lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
@@ -599,8 +599,11 @@
return DAG.UnrollVectorOp(Op.getNode());
// Generate a mask operand.
- EVT MaskTy = TLI.getSetCCResultType(*DAG.getContext(), VT);
- assert(MaskTy.isVector() && "Invalid CC type");
+ EVT MaskElemTy = EVT::getIntegerVT(*DAG.getContext(),
+ VT.getScalarType().getSizeInBits());
+ EVT MaskTy = EVT::getVectorVT(*DAG.getContext(),
+ MaskElemTy,
+ VT.getVectorNumElements());
assert(MaskTy.getSizeInBits() == Op1.getValueType().getSizeInBits()
&& "Invalid mask size");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1631.1.patch
Type: text/x-patch
Size: 836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130909/7acb057a/attachment.bin>
More information about the llvm-commits
mailing list