[CodeGen][NFC] Compute MaximumLegalStoreInBits just once (#189355)
Instead of iterating over all value types per basic block, pre-compute the TLI-specific value once when constructing the TLI.
This commit is contained in:
parent
0151d56324
commit
bbef10d9f1
@ -2084,6 +2084,12 @@ public:
|
||||
/// Retuen the minimum of largest number of comparisons in BitTest.
|
||||
unsigned getMinimumBitTestCmps() const;
|
||||
|
||||
/// Return maximum known-legal store size, which can be guaranteed for
|
||||
/// scalable vectors.
|
||||
unsigned getMaximumLegalStoreInBits() const {
|
||||
return MaximumLegalStoreInBits;
|
||||
}
|
||||
|
||||
/// If a physical register, this specifies the register that
|
||||
/// llvm.savestack/llvm.restorestack should save and restore.
|
||||
Register getStackPointerRegisterToSaveRestore() const {
|
||||
@ -3767,6 +3773,10 @@ private:
|
||||
/// The minimum of largest number of comparisons to use bit test for switch.
|
||||
unsigned MinimumBitTestCmps;
|
||||
|
||||
/// Maximum known-legal store size, which can be guaranteed for scalable
|
||||
/// vectors.
|
||||
unsigned MaximumLegalStoreInBits;
|
||||
|
||||
/// This indicates if the target supports unaligned atomic operations.
|
||||
bool SupportsUnalignedAtomics;
|
||||
|
||||
|
||||
@ -260,15 +260,6 @@ namespace {
|
||||
ForCodeSize = DAG.shouldOptForSize();
|
||||
DisableGenericCombines =
|
||||
DisableCombines || (STI && STI->disableGenericCombines(OptLevel));
|
||||
|
||||
MaximumLegalStoreInBits = 0;
|
||||
// We use the minimum store size here, since that's all we can guarantee
|
||||
// for the scalable vector types.
|
||||
for (MVT VT : MVT::all_valuetypes())
|
||||
if (EVT(VT).isSimple() && VT != MVT::Other &&
|
||||
TLI.isTypeLegal(EVT(VT)) &&
|
||||
VT.getSizeInBits().getKnownMinValue() >= MaximumLegalStoreInBits)
|
||||
MaximumLegalStoreInBits = VT.getSizeInBits().getKnownMinValue();
|
||||
}
|
||||
|
||||
void ConsiderForPruning(SDNode *N) {
|
||||
@ -344,8 +335,6 @@ namespace {
|
||||
void CommitTargetLoweringOpt(const TargetLowering::TargetLoweringOpt &TLO);
|
||||
|
||||
private:
|
||||
unsigned MaximumLegalStoreInBits;
|
||||
|
||||
/// Check the specified integer node value to see if it can be simplified or
|
||||
/// if things it uses can be simplified by bit propagation.
|
||||
/// If so, return true.
|
||||
@ -22719,7 +22708,7 @@ bool DAGCombiner::tryStoreMergeOfConstants(
|
||||
unsigned IsFast = 0;
|
||||
|
||||
// Break early when size is too large to be legal.
|
||||
if (StoreTy.getSizeInBits() > MaximumLegalStoreInBits)
|
||||
if (StoreTy.getSizeInBits() > TLI.getMaximumLegalStoreInBits())
|
||||
break;
|
||||
|
||||
if (TLI.isTypeLegal(StoreTy) &&
|
||||
@ -22827,7 +22816,7 @@ bool DAGCombiner::tryStoreMergeOfExtracts(
|
||||
unsigned IsFast = 0;
|
||||
|
||||
// Break early when size is too large to be legal.
|
||||
if (Ty.getSizeInBits() > MaximumLegalStoreInBits)
|
||||
if (Ty.getSizeInBits() > TLI.getMaximumLegalStoreInBits())
|
||||
break;
|
||||
|
||||
if (TLI.isTypeLegal(Ty) &&
|
||||
@ -22974,7 +22963,7 @@ bool DAGCombiner::tryStoreMergeOfLoads(SmallVectorImpl<MemOpLink> &StoreNodes,
|
||||
EVT StoreTy = EVT::getVectorVT(Context, MemVT.getScalarType(), Elts);
|
||||
|
||||
// Break early when size is too large to be legal.
|
||||
if (StoreTy.getSizeInBits() > MaximumLegalStoreInBits)
|
||||
if (StoreTy.getSizeInBits() > TLI.getMaximumLegalStoreInBits())
|
||||
break;
|
||||
|
||||
unsigned IsFastSt = 0;
|
||||
@ -23194,7 +23183,8 @@ bool DAGCombiner::mergeConsecutiveStores(StoreSDNode *St) {
|
||||
EVT MemVT = St->getMemoryVT();
|
||||
if (MemVT.isScalableVT())
|
||||
return false;
|
||||
if (!MemVT.isSimple() || MemVT.getSizeInBits() * 2 > MaximumLegalStoreInBits)
|
||||
if (!MemVT.isSimple() ||
|
||||
MemVT.getSizeInBits() * 2 > TLI.getMaximumLegalStoreInBits())
|
||||
return false;
|
||||
|
||||
// This function cannot currently deal with non-byte-sized memory sizes.
|
||||
|
||||
@ -1939,6 +1939,13 @@ void TargetLoweringBase::computeRegisterProperties(
|
||||
RepRegClassForVT[i] = RRC;
|
||||
RepRegClassCostForVT[i] = Cost;
|
||||
}
|
||||
|
||||
// Compute minimum known-legal store size.
|
||||
MaximumLegalStoreInBits = 0;
|
||||
for (MVT VT : MVT::all_valuetypes())
|
||||
if (VT != MVT::Other && isTypeLegal(VT) &&
|
||||
VT.getSizeInBits().getKnownMinValue() >= MaximumLegalStoreInBits)
|
||||
MaximumLegalStoreInBits = VT.getSizeInBits().getKnownMinValue();
|
||||
}
|
||||
|
||||
EVT TargetLoweringBase::getSetCCResultType(const DataLayout &DL, LLVMContext &,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user