Skip to content

Commit 90c59cc

Browse files
committed
Revert "unique_ptrify LiveRange::segmentSet"
Apparently something does care about ordering of LiveIntervals... so revert all that stuff (r231175, r231176, r231177) & take some time to re-evaluate. llvm-svn: 231184
1 parent 6da3785 commit 90c59cc

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

llvm/include/llvm/CodeGen/LiveInterval.h

+11-5
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ namespace llvm {
199199
// of live ranges of physical registers in computeRegUnitRange.
200200
// After that the set is flushed to the segment vector and deleted.
201201
typedef std::set<Segment> SegmentSet;
202-
std::unique_ptr<SegmentSet> segmentSet;
202+
SegmentSet *segmentSet;
203203

204204
typedef Segments::iterator iterator;
205205
iterator begin() { return segments.begin(); }
@@ -218,13 +218,15 @@ namespace llvm {
218218
const_vni_iterator vni_end() const { return valnos.end(); }
219219

220220
/// Constructs a new LiveRange object.
221-
LiveRange(bool UseSegmentSet = false)
222-
: segmentSet(UseSegmentSet ? llvm::make_unique<SegmentSet>()
223-
: nullptr) {}
221+
LiveRange(bool UseSegmentSet = false) : segmentSet(nullptr) {
222+
if (UseSegmentSet)
223+
segmentSet = new SegmentSet();
224+
}
224225

225226
/// Constructs a new LiveRange object by copying segments and valnos from
226227
/// another LiveRange.
227-
LiveRange(const LiveRange &Other, BumpPtrAllocator &Allocator) {
228+
LiveRange(const LiveRange &Other, BumpPtrAllocator &Allocator)
229+
: segmentSet(nullptr) {
228230
assert(Other.segmentSet == nullptr &&
229231
"Copying of LiveRanges with active SegmentSets is not supported");
230232

@@ -238,6 +240,8 @@ namespace llvm {
238240
}
239241
}
240242

243+
~LiveRange() { delete segmentSet; }
244+
241245
/// advanceTo - Advance the specified iterator to point to the Segment
242246
/// containing the specified position, or end() if the position is past the
243247
/// end of the range. If no Segment contains this position, but the
@@ -741,6 +745,8 @@ namespace llvm {
741745
#endif
742746

743747
private:
748+
LiveInterval& operator=(const LiveInterval& rhs) = delete;
749+
744750
/// Appends @p Range to SubRanges list.
745751
void appendSubRange(SubRange *Range) {
746752
Range->Next = SubRanges;

llvm/include/llvm/CodeGen/LiveStackAnalysis.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "llvm/Support/Allocator.h"
2222
#include "llvm/Target/TargetRegisterInfo.h"
2323
#include <map>
24-
#include <unordered_map>
2524

2625
namespace llvm {
2726

@@ -34,7 +33,7 @@ namespace llvm {
3433

3534
/// S2IMap - Stack slot indices to live interval mapping.
3635
///
37-
typedef std::unordered_map<int, LiveInterval> SS2IntervalMap;
36+
typedef std::map<int, LiveInterval> SS2IntervalMap;
3837
SS2IntervalMap S2IMap;
3938

4039
/// S2RCMap - Stack slot indices to register class mapping.

llvm/lib/CodeGen/LiveInterval.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ void LiveRange::flushSegmentSet() {
743743
segments.empty() &&
744744
"segment set can be used only initially before switching to the array");
745745
segments.append(segmentSet->begin(), segmentSet->end());
746+
delete segmentSet;
746747
segmentSet = nullptr;
747748
verify();
748749
}

llvm/lib/CodeGen/LiveStackAnalysis.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ LiveStacks::getOrCreateInterval(int Slot, const TargetRegisterClass *RC) {
6161
assert(Slot >= 0 && "Spill slot indice must be >= 0");
6262
SS2IntervalMap::iterator I = S2IMap.find(Slot);
6363
if (I == S2IMap.end()) {
64-
I = S2IMap.emplace(std::piecewise_construct, std::forward_as_tuple(Slot),
65-
std::forward_as_tuple(
66-
TargetRegisterInfo::index2StackSlot(Slot), 0.0F))
67-
.first;
64+
I = S2IMap.insert(I, std::make_pair(Slot,
65+
LiveInterval(TargetRegisterInfo::index2StackSlot(Slot), 0.0F)));
6866
S2RCMap.insert(std::make_pair(Slot, RC));
6967
} else {
7068
// Use the largest common subclass register class.

0 commit comments

Comments
 (0)