[llvm] fb877c1 - [X86] combineLoad - don't bother truncating the alternative target constant data. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 17 03:31:32 PST 2023


Author: Simon Pilgrim
Date: 2023-12-17T11:31:21Z
New Revision: fb877c19c048040702bb99423b0f11539192e89c

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

LOG: [X86] combineLoad - don't bother truncating the alternative target constant data. NFC.

We only iterate over the original target constant/undef width, so keep the alternative data in its original form.

This should help if we try to merge constant data in the future.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 99c492087a4585..13f69883ad6d52 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -49946,12 +49946,10 @@ static SDValue combineLoad(SDNode *N, SelectionDAG &DAG,
         }
         auto MatchingBits = [](const APInt &Undefs, const APInt &UserUndefs,
                                ArrayRef<APInt> Bits, ArrayRef<APInt> UserBits) {
-          if (!UserUndefs.isSubsetOf(Undefs))
-            return false;
           for (unsigned I = 0, E = Undefs.getBitWidth(); I != E; ++I) {
             if (Undefs[I])
               continue;
-            if (Bits[I] != UserBits[I])
+            if (UserUndefs[I] || Bits[I] != UserBits[I])
               return false;
           }
           return true;
@@ -49970,8 +49968,6 @@ static SDValue combineLoad(SDNode *N, SelectionDAG &DAG,
             if (getTargetConstantBitsFromNode(SDValue(N, 0), 8, Undefs, Bits) &&
                 getTargetConstantBitsFromNode(SDValue(User, 0), 8, UserUndefs,
                                               UserBits)) {
-              UserUndefs = UserUndefs.trunc(Undefs.getBitWidth());
-              UserBits.truncate(Bits.size());
               if (MatchingBits(Undefs, UserUndefs, Bits, UserBits)) {
                 SDValue Extract = extractSubVector(
                     SDValue(User, 0), 0, DAG, SDLoc(N), RegVT.getSizeInBits());


        


More information about the llvm-commits mailing list