[PATCH] D23172: IfConversion: Add implicit uses for live subregisters

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 11:12:29 PDT 2016


MatzeB added inline comments.

================
Comment at: lib/CodeGen/IfConversion.cpp:1456-1460
@@ -1455,2 +1455,7 @@
       MIB.addReg(Reg, RegState::Implicit);
+    else {
+      for (MCSubRegIterator S(Reg, TRI); S.isValid(); ++S)
+        if (LiveBeforeMI.count(*S))
+          MIB.addReg(*S, RegState::Implicit);
+    }
   }
----------------
kparzysz wrote:
> kparzysz wrote:
> > MatzeB wrote:
> > > Would it be more reasonable to check if any subreg is alive and then only add a single implicit use for `Reg`. Otherwise I'd be concerned that we end up with a large number of implicit-use operands for deep register hierarchies.
> > I've been thinking about it.  What about this case?
> > 
> > ```
> > Live-in: %H
> > if (...) {
> >   // Define/use super-reg.
> >   %H:L = ...
> >   ... = %H:L
> > }
> > // %H is still live here
> > ... = %H
> > ```
> > 
> > After if-conversion we would end up with something like
> > ```
> > %H:L = predicated ..., %H:L<imp-use>
> > ... = predicated %H:L
> > ```
> > 
> > Wouldn't the implicit use be invalid (since %L is not defined)?
> The `%H:L` above is meant to represent a super-register consisting of two halves: %H and %L respectively.
Using partially defined registers is fine. (It would only be invalid if it would be completely undefined).


Repository:
  rL LLVM

https://reviews.llvm.org/D23172





More information about the llvm-commits mailing list