[PATCH] D50648: [SystemZ] Enable trackSubRegLiveness
Krzysztof Parzyszek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 13 10:30:26 PDT 2018
kparzysz created this revision.
kparzysz added a reviewer: jonpa.
Herald added subscribers: tpr, qcolombet, MatzeB.
Fix a couple of bugs demonstrated in llvm.org/PR38544.
Repository:
rL LLVM
https://reviews.llvm.org/D50648
Files:
lib/CodeGen/RegisterCoalescer.cpp
lib/CodeGen/VirtRegMap.cpp
lib/Target/SystemZ/SystemZSubtarget.h
Index: lib/Target/SystemZ/SystemZSubtarget.h
===================================================================
--- lib/Target/SystemZ/SystemZSubtarget.h
+++ lib/Target/SystemZ/SystemZSubtarget.h
@@ -102,6 +102,8 @@
// Always enable the early if-conversion pass.
bool enableEarlyIfConversion() const override { return true; }
+ bool enableSubRegLiveness() const override { return true; }
+
// Automatically generated by tblgen.
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
Index: lib/CodeGen/VirtRegMap.cpp
===================================================================
--- lib/CodeGen/VirtRegMap.cpp
+++ lib/CodeGen/VirtRegMap.cpp
@@ -525,7 +525,7 @@
// Preserve semantics of sub-register operands.
unsigned SubReg = MO.getSubReg();
if (SubReg != 0) {
- if (NoSubRegLiveness) {
+ if (NoSubRegLiveness || !MRI->shouldTrackSubRegLiveness(VirtReg)) {
// A virtual register kill refers to the whole register, so we may
// have to add implicit killed operands for the super-register. A
// partial redef always kills and redefines the super-register.
Index: lib/CodeGen/RegisterCoalescer.cpp
===================================================================
--- lib/CodeGen/RegisterCoalescer.cpp
+++ lib/CodeGen/RegisterCoalescer.cpp
@@ -686,13 +686,16 @@
/// Copy segments with value number @p SrcValNo from liverange @p Src to live
/// range @Dst and use value number @p DstValNo there.
-static void addSegmentsWithValNo(LiveRange &Dst, VNInfo *DstValNo,
+static bool addSegmentsWithValNo(LiveRange &Dst, VNInfo *DstValNo,
const LiveRange &Src, const VNInfo *SrcValNo) {
+ bool Added = false;
for (const LiveRange::Segment &S : Src.segments) {
if (S.valno != SrcValNo)
continue;
+ Added = true;
Dst.addSegment(LiveRange::Segment(S.start, S.end, DstValNo));
}
+ return Added;
}
bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
@@ -889,7 +892,8 @@
? SR.getNextValue(CopyIdx, Allocator)
: SR.getVNInfoAt(CopyIdx);
assert(BSubValNo != nullptr);
- addSegmentsWithValNo(SR, BSubValNo, SA, ASubValNo);
+ if (addSegmentsWithValNo(SR, BSubValNo, SA, ASubValNo))
+ BSubValNo->def = ASubValNo->def;
});
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50648.160390.patch
Type: text/x-patch
Size: 2380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180813/0969389f/attachment.bin>
More information about the llvm-commits
mailing list