mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-13 21:10:39 +00:00
Do not use getGlobalContext()... ever.
This code was creating a new type in the global context, regardless of which context the user is sitting in, what can possibly go wrong? From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266275
This commit is contained in:
parent
489a8fbeea
commit
6bf091d940
@ -1001,14 +1001,14 @@ int X86TTIImpl::getMaskedMemoryOpCost(unsigned Opcode, Type *SrcTy,
|
|||||||
|
|
||||||
unsigned NumElem = SrcVTy->getVectorNumElements();
|
unsigned NumElem = SrcVTy->getVectorNumElements();
|
||||||
VectorType *MaskTy =
|
VectorType *MaskTy =
|
||||||
VectorType::get(Type::getInt8Ty(getGlobalContext()), NumElem);
|
VectorType::get(Type::getInt8Ty(SrcVTy->getContext()), NumElem);
|
||||||
if ((Opcode == Instruction::Load && !isLegalMaskedLoad(SrcVTy)) ||
|
if ((Opcode == Instruction::Load && !isLegalMaskedLoad(SrcVTy)) ||
|
||||||
(Opcode == Instruction::Store && !isLegalMaskedStore(SrcVTy)) ||
|
(Opcode == Instruction::Store && !isLegalMaskedStore(SrcVTy)) ||
|
||||||
!isPowerOf2_32(NumElem)) {
|
!isPowerOf2_32(NumElem)) {
|
||||||
// Scalarization
|
// Scalarization
|
||||||
int MaskSplitCost = getScalarizationOverhead(MaskTy, false, true);
|
int MaskSplitCost = getScalarizationOverhead(MaskTy, false, true);
|
||||||
int ScalarCompareCost = getCmpSelInstrCost(
|
int ScalarCompareCost = getCmpSelInstrCost(
|
||||||
Instruction::ICmp, Type::getInt8Ty(getGlobalContext()), nullptr);
|
Instruction::ICmp, Type::getInt8Ty(SrcVTy->getContext()), nullptr);
|
||||||
int BranchCost = getCFInstrCost(Instruction::Br);
|
int BranchCost = getCFInstrCost(Instruction::Br);
|
||||||
int MaskCmpCost = NumElem * (BranchCost + ScalarCompareCost);
|
int MaskCmpCost = NumElem * (BranchCost + ScalarCompareCost);
|
||||||
|
|
||||||
@ -1339,7 +1339,7 @@ int X86TTIImpl::getGSVectorCost(unsigned Opcode, Type *SrcVTy, Value *Ptr,
|
|||||||
unsigned IndexSize = (VF >= 16) ? getIndexSizeInBits(Ptr, DL) :
|
unsigned IndexSize = (VF >= 16) ? getIndexSizeInBits(Ptr, DL) :
|
||||||
DL.getPointerSizeInBits();
|
DL.getPointerSizeInBits();
|
||||||
|
|
||||||
Type *IndexVTy = VectorType::get(IntegerType::get(getGlobalContext(),
|
Type *IndexVTy = VectorType::get(IntegerType::get(SrcVTy->getContext(),
|
||||||
IndexSize), VF);
|
IndexSize), VF);
|
||||||
std::pair<int, MVT> IdxsLT = TLI->getTypeLegalizationCost(DL, IndexVTy);
|
std::pair<int, MVT> IdxsLT = TLI->getTypeLegalizationCost(DL, IndexVTy);
|
||||||
std::pair<int, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, SrcVTy);
|
std::pair<int, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, SrcVTy);
|
||||||
@ -1374,10 +1374,10 @@ int X86TTIImpl::getGSScalarCost(unsigned Opcode, Type *SrcVTy,
|
|||||||
int MaskUnpackCost = 0;
|
int MaskUnpackCost = 0;
|
||||||
if (VariableMask) {
|
if (VariableMask) {
|
||||||
VectorType *MaskTy =
|
VectorType *MaskTy =
|
||||||
VectorType::get(Type::getInt1Ty(getGlobalContext()), VF);
|
VectorType::get(Type::getInt1Ty(SrcVTy->getContext()), VF);
|
||||||
MaskUnpackCost = getScalarizationOverhead(MaskTy, false, true);
|
MaskUnpackCost = getScalarizationOverhead(MaskTy, false, true);
|
||||||
int ScalarCompareCost =
|
int ScalarCompareCost =
|
||||||
getCmpSelInstrCost(Instruction::ICmp, Type::getInt1Ty(getGlobalContext()),
|
getCmpSelInstrCost(Instruction::ICmp, Type::getInt1Ty(SrcVTy->getContext()),
|
||||||
nullptr);
|
nullptr);
|
||||||
int BranchCost = getCFInstrCost(Instruction::Br);
|
int BranchCost = getCFInstrCost(Instruction::Br);
|
||||||
MaskUnpackCost += VF * (BranchCost + ScalarCompareCost);
|
MaskUnpackCost += VF * (BranchCost + ScalarCompareCost);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user