[PATCH] D20175: [AArch64] Improve getUsefulBitsForUse for narrow stores.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 13:15:11 PDT 2016


mcrosier added inline comments.

================
Comment at: lib/Target/AArch64/AArch64ISelDAGToDAG.cpp:1852
@@ -1851,1 +1851,3 @@
     return getUsefulBitsFromBFM(SDValue(UserNode, 0), Orig, UsefulBits, Depth);
+
+  case AArch64::STRBui:
----------------
I'll have to see if there are other opcodes.  I don't think we have pre/post or versions at this point.

================
Comment at: lib/Target/AArch64/AArch64ISelDAGToDAG.cpp:1855
@@ +1854,3 @@
+  case AArch64::STRBBui:
+    if (UserNode->getOperand(0) != Orig)
+      return;
----------------
I tried to come up with a test case, but I don't think this problem can be exposed.

  define void @test(i64 %ptr32, i8* %ptr8, i64 %x)  {
  entry:
    %and = and i64 %ptr32, -8
    %shr = lshr i64 %x, 8
    %and1 = and i64 %shr, 7
    %or = or i64 %and, %and1
    %trunc = trunc i64 %or to i8
    %conv = inttoptr i8 %trunc to i8*
    store i8 1, i8* %conv
    ret void
  }

Basically, in the cases I tried it looks like there will be a zero-extend between the 'strb/strh' and the 'or' preventing such a case from happening.  Regardless, I think the check is correct (but not testable AFAICT).


http://reviews.llvm.org/D20175





More information about the llvm-commits mailing list