OSDN Git Service

[Hexagon] Fix a latent problem with interpreting live-in lane masks
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 14 Apr 2017 16:21:55 +0000 (16:21 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Fri, 14 Apr 2017 16:21:55 +0000 (16:21 +0000)
A non-zero lane mask on a register with no subregister means that the
whole register is live-in. It is equivalent to a full mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300335 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonBlockRanges.cpp

index 721cf04..1640b40 100644 (file)
@@ -232,14 +232,16 @@ HexagonBlockRanges::RegisterSet HexagonBlockRanges::getLiveIns(
       const TargetRegisterInfo &TRI) {
   RegisterSet LiveIns;
   RegisterSet Tmp;
+
   for (auto I : B.liveins()) {
-    if (I.LaneMask.all()) {
-      Tmp.insert({I.PhysReg,0});
+    MCSubRegIndexIterator S(I.PhysReg, &TRI);
+    if (I.LaneMask.all() || (I.LaneMask.any() && !S.isValid())) {
+      Tmp.insert({I.PhysReg, 0});
       continue;
     }
-    for (MCSubRegIndexIterator S(I.PhysReg, &TRI); S.isValid(); ++S) {
-      LaneBitmask M = TRI.getSubRegIndexLaneMask(S.getSubRegIndex());
-      if ((M & I.LaneMask).any())
+    for (; S.isValid(); ++S) {
+      unsigned SI = S.getSubRegIndex();
+      if ((I.LaneMask & TRI.getSubRegIndexLaneMask(SI)).any())
         Tmp.insert({S.getSubReg(), 0});
     }
   }