Hi Krzysztof,
I have working to anble the RDF in our arch. and i meet some issue in rdf::Liveness::computePhiInfo().
It often fail in calling the PhysicalRegisterInfo::mapTo() to get the sub-register.
I debug into the function and found it failed end reported the llvm_unreachable(“Invalid arguments: unrelated registers?”) . because the function PhysicalRegisterInfo::mapTo() get the same vector element register sunch as ‘‘v4r0 and v4r1’’. they are not subsequnce of each other.
i have wondered do it need to support this situation and return a register like:
v4r0:[0 1 1 1], r1 r2 r3 is active in its lanemask.
the patch below to work around this issue:
--- a/llvm/lib/CodeGen/RDFRegisters.cpp
+++ b/llvm/lib/CodeGen/RDFRegisters.cpp
@@ -239,7 +239,12 @@ RegisterRef PhysicalRegisterInfo::mapTo(RegisterRef RR, unsigned R) const {
LaneBitmask M = TRI.reverseComposeSubRegIndexLaneMask(Idx, RR.Mask);
return RegisterRef(R, M & RCM);
}
- llvm_unreachable("Invalid arguments: unrelated registers?");
+
+ RegisterRef RetR =
+ RegisterAggr(*this).insert(RR).intersectWith(RegisterRef(R));
+ if (!RetR)
+ llvm_unreachable("Invalid arguments: unrelated registers?");
+ return RetR;
}
i think we just need to return the intersection of the sub-register.
Thanks in advance.
CC: @kparzysz-quic