[PATCH] D68267: [MBB LiveIn lists, MachineVerifier, SystemZ] New method isLiveOut() and mverifier improvement.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 05:57:35 PDT 2019


jonpa created this revision.
jonpa added reviewers: uweigand, MatzeB, hfinkel, arsenm.
Herald added subscribers: dmgreen, JDevlieghere, wdng.

Continuing the discussion from llvm-dev (http://lists.llvm.org/pipermail/llvm-dev/2019-September/135381.html), I am proposing a patch to address this problem.

Background: The SystemZ backend can optimize compare instructions if it can first find all the users of the CC (condition code).
This can only reasonably be done when all the CC users are in the same basic block (to avoid expensive searching), so the first step is to check if the CC register is live into any successor block (live out) or not.

This check is currently done in SystemZElimCompare.cpp, but it would be better to have a common code method for this with an explicit guarantee that this can be trusted.

This patch adds:

- New method MachineBasicBlock::isLiveOut() that checks the live-in lists of its successors, to replace SystemZElimCompare.cpp:isCCLiveOut(). The comment for it gives a guarantee that this register is not live out of the block if it returns false, while however there is no check for sub/super-registers.

- MachineVerifier::visitMachineFunctionAfter() extended to check the live-through case for live-in lists, with tests. This is (currently) only done for registers without aliases and that are neither allocatable or reserved, such as the SystemZ::CC register. My hope is that with this, live-in lists for SystemZ::CC is fully verified, as it adds the missing check for live-through. Currently the MachineVerifier only catches the case of a live-in use without an entry in the live-in list, as "using an undefined physical register".


https://reviews.llvm.org/D68267

Files:
  include/llvm/CodeGen/MachineBasicBlock.h
  lib/CodeGen/MachineBasicBlock.cpp
  lib/CodeGen/MachineVerifier.cpp
  lib/Target/SystemZ/SystemZElimCompare.cpp
  test/MachineVerifier/live-ins-01.mir
  test/MachineVerifier/live-ins-02.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68267.222595.patch
Type: text/x-patch
Size: 7002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191001/8f8e5f36/attachment.bin>


More information about the llvm-commits mailing list