[PATCH] D81671: [SystemZ] Bugfix in storeLoadCanUseBlockBinary()

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 01:02:54 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd3f7448e3ca5: [SystemZ] Bugfix in storeLoadCanUseBlockBinary(). (authored by jonpa).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81671/new/

https://reviews.llvm.org/D81671

Files:
  llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
  llvm/test/CodeGen/SystemZ/and-08.ll


Index: llvm/test/CodeGen/SystemZ/and-08.ll
===================================================================
--- llvm/test/CodeGen/SystemZ/and-08.ll
+++ llvm/test/CodeGen/SystemZ/and-08.ll
@@ -371,6 +371,21 @@
   ret void
 }
 
+; Test a case where one of the loads are optimized by the DAGCombiner to a
+; zero-extending load of half the original size.
+define void @f27(i16* noalias %ptr1, i16* noalias %ptr2) {
+; CHECK-LABEL: f27:
+; CHECK-NOT: nc
+; CHECK: br %r14
+entry:
+  %0 = load i16, i16 *%ptr1, align 2
+  %1 = lshr i16 %0, 8
+  %2 = load i16, i16 *%ptr2, align 2
+  %and7 = and i16 %1, %2
+  store i16 %and7, i16 *%ptr1, align 2
+  ret void
+}
+
 !0 = !{ !"root" }
 !1 = !{ !"set1", !0 }
 !2 = !{ !"set2", !0 }
Index: llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
===================================================================
--- llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
+++ llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
@@ -1456,7 +1456,8 @@
   auto *StoreA = cast<StoreSDNode>(N);
   auto *LoadA = cast<LoadSDNode>(StoreA->getValue().getOperand(1 - I));
   auto *LoadB = cast<LoadSDNode>(StoreA->getValue().getOperand(I));
-  return !LoadA->isVolatile() && canUseBlockOperation(StoreA, LoadB);
+  return !LoadA->isVolatile() && LoadA->getMemoryVT() == LoadB->getMemoryVT() &&
+         canUseBlockOperation(StoreA, LoadB);
 }
 
 void SystemZDAGToDAGISel::Select(SDNode *Node) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81671.271293.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200617/62af8cdc/attachment.bin>


More information about the llvm-commits mailing list