[llvm] 15d4ed6 - [PowerPC] only check the load instruction result number 0.

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 21:49:47 PDT 2021


Author: Chen Zheng
Date: 2021-05-18T00:49:37-04:00
New Revision: 15d4ed6d8c6956efcb2d5afb89bea7f0fff6f989

URL: https://github.com/llvm/llvm-project/commit/15d4ed6d8c6956efcb2d5afb89bea7f0fff6f989
DIFF: https://github.com/llvm/llvm-project/commit/15d4ed6d8c6956efcb2d5afb89bea7f0fff6f989.diff

LOG: [PowerPC] only check the load instruction result number 0.

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D102596

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCISelLowering.cpp
    llvm/test/CodeGen/PowerPC/vsx-shuffle-le-load.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 67185bb603d70..e44c5f8754761 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -14627,12 +14627,15 @@ SDValue PPCTargetLowering::combineVReverseMemOP(ShuffleVectorSDNode *SVN,
     return SDValue();
 
   if (LSBase->getOpcode() == ISD::LOAD) {
-    // If the load has more than one user except the shufflevector instruction,
-    // it is not profitable to replace the shufflevector with a reverse load.
-    if (!LSBase->hasOneUse())
-      return SDValue();
+    // If the load return value 0 has more than one user except the
+    // shufflevector instruction, it is not profitable to replace the
+    // shufflevector with a reverse load.
+    for (SDNode::use_iterator UI = LSBase->use_begin(), UE = LSBase->use_end();
+         UI != UE; ++UI)
+      if (UI.getUse().getResNo() == 0 && UI->getOpcode() != ISD::VECTOR_SHUFFLE)
+        return SDValue();
 
-    SDLoc dl(SVN);
+    SDLoc dl(LSBase);
     SDValue LoadOps[] = {LSBase->getChain(), LSBase->getBasePtr()};
     return DAG.getMemIntrinsicNode(
         PPCISD::LOAD_VEC_BE, dl, DAG.getVTList(VT, MVT::Other), LoadOps,

diff  --git a/llvm/test/CodeGen/PowerPC/vsx-shuffle-le-load.ll b/llvm/test/CodeGen/PowerPC/vsx-shuffle-le-load.ll
index 3057fdc16fba5..15391f3a24940 100644
--- a/llvm/test/CodeGen/PowerPC/vsx-shuffle-le-load.ll
+++ b/llvm/test/CodeGen/PowerPC/vsx-shuffle-le-load.ll
@@ -5,9 +5,9 @@
 define <2 x double> @loadChainHasUser(<2 x double>* %p1, <2 x double> %v2) {
 ; CHECK-LABEL: loadChainHasUser:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    lxv 0, 0(3)
+; CHECK-NEXT:    lxvd2x 0, 0, 3
 ; CHECK-NEXT:    stxv 34, 0(3)
-; CHECK-NEXT:    xxswapd 34, 0
+; CHECK-NEXT:    xxlor 34, 0, 0
 ; CHECK-NEXT:    blr
   %v1 = load <2 x double>, <2 x double>* %p1
   store <2 x double> %v2, <2 x double>* %p1, align 16


        


More information about the llvm-commits mailing list