[PATCH] D97054: [MachineVerifier] Confirm that both ends of a tied def/use are live together
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 07:54:26 PST 2021
reames created this revision.
reames added reviewers: skatkov, mtrofin, ZhangKang, marcello.maggioni, arsenm.
Herald added subscribers: dantrushin, pengfei, hiraditya, mcrosier.
Herald added a reviewer: bollu.
reames requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
If we have a tied def, the tied use should also be live in the same live interval. The exception is that the use may be undef, in which case the def is dead, but we don't appear to enforce that tightly. For the moment, check only the non-undef case.
The need to not check physical registers here bothers me. I added this because without it, test/CodeGen/X86/segmented-stacks-dynamic.ll fails. However, I can't claim to understand why it's necessary.
>From reading the existing code, I believe this is the intended invariant. I am not overly familiar with this code (or at least I wasn't until recently), so I would appreciate a careful review.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97054
Files:
llvm/lib/CodeGen/MachineVerifier.cpp
Index: llvm/lib/CodeGen/MachineVerifier.cpp
===================================================================
--- llvm/lib/CodeGen/MachineVerifier.cpp
+++ llvm/lib/CodeGen/MachineVerifier.cpp
@@ -2737,6 +2737,17 @@
hasDef = true;
if (MOI->isEarlyClobber())
isEarlyClobber = true;
+
+ if (MOI->isTied() && Register::isVirtualRegister(Reg)) {
+ unsigned DefOpNum = std::distance(MI->operands_begin(), &*MOI);
+ unsigned UseOpNum = MI->findTiedOperandIdx(DefOpNum);
+ if (!MI->getOperand(UseOpNum).isUndef() &&
+ !LR.liveAt(VNI->def.getBaseIndex())) {
+ report("tied def w/o use in same live range", MI);
+ report_context(LR, Reg, LaneMask);
+ report_context(*VNI);
+ }
+ }
}
if (!hasDef) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97054.324982.patch
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210219/450b05ae/attachment.bin>
More information about the llvm-commits
mailing list