[llvm] e625310 - [DAGCombiner] Remove unnecessary commonAlignment from CombineExtLoad. (#81705)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 23:26:12 PST 2024


Author: Craig Topper
Date: 2024-02-13T23:26:08-08:00
New Revision: e6253102a7c63d73594699d93b1b412f0795ec11

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

LOG: [DAGCombiner] Remove unnecessary commonAlignment from CombineExtLoad. (#81705)

The getAlign function for a load returns the commonAlignment of the
"base align" and the offset stored in the MachinePointerInfo.

We're splitting a load here, so we should take the base alignment from
the original load without any offset that may already exist in the
original load. The new load can then maintain its own alignment using
just the base alignment and its own offset.

Noticed by inspection.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 52011e593f2e0a..f35466fb607360 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -12971,12 +12971,12 @@ SDValue DAGCombiner::CombineExtLoad(SDNode *N) {
   SDValue BasePtr = LN0->getBasePtr();
   for (unsigned Idx = 0; Idx < NumSplits; Idx++) {
     const unsigned Offset = Idx * Stride;
-    const Align Align = commonAlignment(LN0->getAlign(), Offset);
 
-    SDValue SplitLoad = DAG.getExtLoad(
-        ExtType, SDLoc(LN0), SplitDstVT, LN0->getChain(), BasePtr,
-        LN0->getPointerInfo().getWithOffset(Offset), SplitSrcVT, Align,
-        LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
+    SDValue SplitLoad =
+        DAG.getExtLoad(ExtType, SDLoc(LN0), SplitDstVT, LN0->getChain(),
+                       BasePtr, LN0->getPointerInfo().getWithOffset(Offset),
+                       SplitSrcVT, LN0->getOriginalAlign(),
+                       LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
 
     BasePtr = DAG.getMemBasePlusOffset(BasePtr, TypeSize::getFixed(Stride), DL);
 


        


More information about the llvm-commits mailing list