mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[ValueTypes] Assert if changeVectorElementType is called on a simple type with an extended element type.
Previously we would use the extended implementation, but the extended implementation requires the vector type to be extended so that we can access the LLVMContext. In theory we could detect this case and use the context from the element type instead, but since I know of no cases hitting this in practice today I've done the simplest thing. Also add asserts to several extended EVT functions that assume LLVMTy is non-null. Follow from discussion in D97036 Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D97070
This commit is contained in:
parent
bb847f1e7e
commit
e9a79b1cf0
@ -100,8 +100,11 @@ namespace llvm {
|
||||
/// Return a VT for a vector type whose attributes match ourselves
|
||||
/// with the exception of the element type that is chosen by the caller.
|
||||
EVT changeVectorElementType(EVT EltVT) const {
|
||||
if (isSimple() && EltVT.isSimple())
|
||||
if (isSimple()) {
|
||||
assert(EltVT.isSimple() &&
|
||||
"Can't change simple vector VT to have extended element VT");
|
||||
return getSimpleVT().changeVectorElementType(EltVT.getSimpleVT());
|
||||
}
|
||||
return changeExtendedVectorElementType(EltVT);
|
||||
}
|
||||
|
||||
|
@ -15,11 +15,13 @@
|
||||
using namespace llvm;
|
||||
|
||||
EVT EVT::changeExtendedTypeToInteger() const {
|
||||
assert(isExtended() && "Type is not extended!");
|
||||
LLVMContext &Context = LLVMTy->getContext();
|
||||
return getIntegerVT(Context, getSizeInBits());
|
||||
}
|
||||
|
||||
EVT EVT::changeExtendedVectorElementTypeToInteger() const {
|
||||
assert(isExtended() && "Type is not extended!");
|
||||
LLVMContext &Context = LLVMTy->getContext();
|
||||
EVT IntTy = getIntegerVT(Context, getScalarSizeInBits());
|
||||
return getVectorVT(Context, IntTy, getVectorNumElements(),
|
||||
@ -27,6 +29,7 @@ EVT EVT::changeExtendedVectorElementTypeToInteger() const {
|
||||
}
|
||||
|
||||
EVT EVT::changeExtendedVectorElementType(EVT EltVT) const {
|
||||
assert(isExtended() && "Type is not extended!");
|
||||
LLVMContext &Context = LLVMTy->getContext();
|
||||
return getVectorVT(Context, EltVT, getVectorElementCount());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user