diff options
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | 16 |
2 files changed, 13 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index 5e27a1c7147..c68f363ac60 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -732,11 +732,11 @@ public: struct StatepointLoweringInfo { /// Bases[i] is the base pointer for Ptrs[i]. Together they denote the set /// of gc pointers this STATEPOINT has to relocate. - ArrayRef<const Value *> Bases; - ArrayRef<const Value *> Ptrs; + SmallVector<const Value *, 16> Bases; + SmallVector<const Value *, 16> Ptrs; /// The set of gc.relocate calls associated with this gc.statepoint. - ArrayRef<const GCRelocateInst *> GCRelocates; + SmallVector<const GCRelocateInst *, 16> GCRelocates; /// The full list of gc arguments to the gc.statepoint being lowered. ArrayRef<const Use> GCArgs; diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp index ad339064b14..eccebf2b656 100644 --- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp @@ -334,12 +334,6 @@ static void getIncomingStatepointGCValues( Ptrs.push_back(Relocate->getDerivedPtr()); } - // Remove any redundant llvm::Values which map to the same SDValue as another - // input. Also has the effect of removing duplicates in the original - // llvm::Value input list as well. This is a useful optimization for - // reducing the size of the StackMap section. It has no other impact. - removeDuplicatesGCPtrs(Bases, Ptrs, Relocs, Builder); - assert(Bases.size() == Ptrs.size() && Ptrs.size() == Relocs.size()); } @@ -566,11 +560,21 @@ SDValue SelectionDAGBuilder::LowerAsSTATEPOINT( StatepointLowering.startNewStatepoint(*this); #ifndef NDEBUG + // We schedule gc relocates before removeDuplicatesGCPtrs since we _will_ + // encounter the duplicate gc relocates we elide in removeDuplicatesGCPtrs. for (auto *Reloc : SI.GCRelocates) if (Reloc->getParent() == SI.StatepointInstr->getParent()) StatepointLowering.scheduleRelocCall(*Reloc); #endif + // Remove any redundant llvm::Values which map to the same SDValue as another + // input. Also has the effect of removing duplicates in the original + // llvm::Value input list as well. This is a useful optimization for + // reducing the size of the StackMap section. It has no other impact. + removeDuplicatesGCPtrs(SI.Bases, SI.Ptrs, SI.GCRelocates, *this); + assert(SI.Bases.size() == SI.Ptrs.size() && + SI.Ptrs.size() == SI.GCRelocates.size()); + // Lower statepoint vmstate and gcstate arguments SmallVector<SDValue, 10> LoweredMetaArgs; lowerStatepointMetaArgs(LoweredMetaArgs, SI, *this); |