@@ -190,12 +190,13 @@ static Constant *rebuildSplatableConstant(const Constant *C,
190
190
Type *SclTy = OriginalType->getScalarType ();
191
191
unsigned NumSclBits = SclTy->getPrimitiveSizeInBits ();
192
192
NumSclBits = std::min<unsigned >(NumSclBits, SplatBitWidth);
193
+ LLVMContext &Ctx = OriginalType->getContext ();
193
194
194
195
if (NumSclBits == 8 ) {
195
196
SmallVector<uint8_t > RawBits;
196
197
for (unsigned I = 0 ; I != SplatBitWidth; I += 8 )
197
198
RawBits.push_back (Splat->extractBits (8 , I).getZExtValue ());
198
- return ConstantDataVector::get (OriginalType-> getContext () , RawBits);
199
+ return ConstantDataVector::get (Ctx , RawBits);
199
200
}
200
201
201
202
if (NumSclBits == 16 ) {
@@ -204,25 +205,25 @@ static Constant *rebuildSplatableConstant(const Constant *C,
204
205
RawBits.push_back (Splat->extractBits (16 , I).getZExtValue ());
205
206
if (SclTy->is16bitFPTy ())
206
207
return ConstantDataVector::getFP (SclTy, RawBits);
207
- return ConstantDataVector::get (OriginalType-> getContext () , RawBits);
208
+ return ConstantDataVector::get (Ctx , RawBits);
208
209
}
209
210
210
211
if (NumSclBits == 32 ) {
211
212
SmallVector<uint32_t > RawBits;
212
213
for (unsigned I = 0 ; I != SplatBitWidth; I += 32 )
213
214
RawBits.push_back (Splat->extractBits (32 , I).getZExtValue ());
214
- if (SclTy->isFloatTy ())
215
- return ConstantDataVector::getFP (SclTy , RawBits);
216
- return ConstantDataVector::get (OriginalType-> getContext () , RawBits);
215
+ if (SclTy->isFloatingPointTy ())
216
+ return ConstantDataVector::getFP (Type::getFloatTy (Ctx) , RawBits);
217
+ return ConstantDataVector::get (Ctx , RawBits);
217
218
}
218
219
219
220
// Fallback to i64 / double.
220
221
SmallVector<uint64_t > RawBits;
221
222
for (unsigned I = 0 ; I != SplatBitWidth; I += 64 )
222
223
RawBits.push_back (Splat->extractBits (64 , I).getZExtValue ());
223
- if (SclTy->isDoubleTy ())
224
- return ConstantDataVector::getFP (SclTy , RawBits);
225
- return ConstantDataVector::get (OriginalType-> getContext () , RawBits);
224
+ if (SclTy->isFloatingPointTy ())
225
+ return ConstantDataVector::getFP (Type::getDoubleTy (Ctx) , RawBits);
226
+ return ConstantDataVector::get (Ctx , RawBits);
226
227
}
227
228
228
229
bool X86FixupVectorConstantsPass::processInstruction (MachineFunction &MF,
0 commit comments