[PATCH] D73317: [GISelKnownBits] Add support for PHIs

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 17:56:27 PST 2020


qcolombet created this revision.
qcolombet added reviewers: dsanders, aditya_nandakumar, aemerson, volkan, paquette.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
qcolombet marked an inline comment as done.
qcolombet added inline comments.


================
Comment at: llvm/unittests/CodeGen/GlobalISel/GISelMITest.h:111
+    liveins: $x0, $x1, $x2, $x4
+
     %0(s64) = COPY $x0
----------------
In case someone wonders, this change is required to have MIRString with basic blocks that have variables that are live out, otherwise the machine verifier will complain that some variables are not live out of the predecessors when use in a phi.
(Basically we need the tracksRegLiveness property and when we set it, we need to mark as live ins all phys regs that are used across all the GISel tests.)


Teach the GISelKnowBits analysis how to deal with PHI operations.
PHIs are essentially COPYs happening on edges, so we can just reuse the code for COPY.

This change would be NFC COPY-wise if we have left Depth untouched when calling computeKnownBitsImpl, like it was for COPYs.
This change is however required for PHIs as they may loop back to themselves and we would end up in an infinite loop.

We could make the change truly NFC for the COPYs by increasing Depth only for PHIs,  but generally speaking I am not a fan of not increasing Depth or doing specially cases for COPYs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73317

Files:
  llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
  llvm/unittests/CodeGen/GlobalISel/GISelMITest.h
  llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73317.240075.patch
Type: text/x-patch
Size: 7895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200124/4474689c/attachment.bin>


More information about the llvm-commits mailing list