[llvm] 55e2df7 - [LiveIntervals] Add range accessors for value numbers [nfc]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon May 16 08:23:26 PDT 2022
Author: Philip Reames
Date: 2022-05-16T08:23:12-07:00
New Revision: 55e2df7285c0c60da44a2dccbbb1da7d1c0da2ce
URL: https://github.com/llvm/llvm-project/commit/55e2df7285c0c60da44a2dccbbb1da7d1c0da2ce
DIFF: https://github.com/llvm/llvm-project/commit/55e2df7285c0c60da44a2dccbbb1da7d1c0da2ce.diff
LOG: [LiveIntervals] Add range accessors for value numbers [nfc]
Added:
Modified:
llvm/include/llvm/CodeGen/LiveInterval.h
llvm/lib/CodeGen/InlineSpiller.cpp
llvm/lib/CodeGen/LiveIntervals.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h
index 5a3c488aa338..92e35c9a4ab9 100644
--- a/llvm/include/llvm/CodeGen/LiveInterval.h
+++ b/llvm/include/llvm/CodeGen/LiveInterval.h
@@ -227,6 +227,14 @@ namespace llvm {
const_vni_iterator vni_begin() const { return valnos.begin(); }
const_vni_iterator vni_end() const { return valnos.end(); }
+ iterator_range<vni_iterator> vnis() {
+ return make_range(vni_begin(), vni_end());
+ }
+
+ iterator_range<const_vni_iterator> vnis() const {
+ return make_range(vni_begin(), vni_end());
+ }
+
/// Constructs a new LiveRange object.
LiveRange(bool UseSegmentSet = false)
: segmentSet(UseSegmentSet ? std::make_unique<SegmentSet>()
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index 43b30fdd8909..4cf7c20fe2bd 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -685,7 +685,7 @@ void InlineSpiller::reMaterializeAll() {
// Remove any values that were completely rematted.
for (Register Reg : RegsToSpill) {
LiveInterval &LI = LIS.getInterval(Reg);
- for (VNInfo *VNI : llvm::make_range(LI.vni_begin(), LI.vni_end())) {
+ for (VNInfo *VNI : LI.vnis()) {
if (VNI->isUnused() || VNI->isPHIDef() || UsedValues.count(VNI))
continue;
MachineInstr *MI = LIS.getInstructionFromIndex(VNI->def);
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp
index b8fca8a92d0e..7d825a8bf853 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.cpp
@@ -498,7 +498,7 @@ bool LiveIntervals::shrinkToUses(LiveInterval *li,
// Create new live ranges with only minimal live segments per def.
LiveRange NewLR;
- createSegmentsForValues(NewLR, make_range(li->vni_begin(), li->vni_end()));
+ createSegmentsForValues(NewLR, li->vnis());
extendSegmentsToUses(NewLR, WorkList, Reg, LaneBitmask::getNone());
// Move the trimmed segments back.
@@ -602,7 +602,7 @@ void LiveIntervals::shrinkToUses(LiveInterval::SubRange &SR, Register Reg) {
// Create a new live ranges with only minimal live segments per def.
LiveRange NewLR;
- createSegmentsForValues(NewLR, make_range(SR.vni_begin(), SR.vni_end()));
+ createSegmentsForValues(NewLR, SR.vnis());
extendSegmentsToUses(NewLR, WorkList, Reg, SR.LaneMask);
// Move the trimmed ranges back.
More information about the llvm-commits
mailing list