[llvm] af110e1 - [X86] combineTruncate - drop load alignment after (trunc (srl (load p), amt)) -> (load p + amt/8) fold (#165436)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 28 10:28:43 PDT 2025


Author: Simon Pilgrim
Date: 2025-10-28T17:28:39Z
New Revision: af110e15c3cf2b964fb6a399163663e77c0730d1

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

LOG: [X86] combineTruncate - drop load alignment after (trunc (srl (load p), amt)) -> (load p + amt/8) fold (#165436)

The pointer adjustment no longer guarantees any alignment

Missed in #165266 and only noticed in some follow up work

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 b86020aa512ea..5785440a20e43 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -54679,7 +54679,8 @@ static SDValue combineTruncate(SDNode *N, SelectionDAG &DAG,
         SDValue NewPtr = DAG.getMemBasePlusOffset(
             Ld->getBasePtr(), PtrByteOfs, DL, SDNodeFlags::NoUnsignedWrap);
         SDValue NewLoad =
-            DAG.getLoad(VT, DL, Ld->getChain(), NewPtr, Ld->getMemOperand());
+            DAG.getLoad(VT, DL, Ld->getChain(), NewPtr, Ld->getPointerInfo(),
+                        Align(), Ld->getMemOperand()->getFlags());
         DAG.ReplaceAllUsesOfValueWith(Src.getOperand(0).getValue(1),
                                       NewLoad.getValue(1));
         return NewLoad;


        


More information about the llvm-commits mailing list