Skip to content

Commit e625310

Browse files
authored
[DAGCombiner] Remove unnecessary commonAlignment from CombineExtLoad. (llvm#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.
1 parent 3537ccc commit e625310

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12971,12 +12971,12 @@ SDValue DAGCombiner::CombineExtLoad(SDNode *N) {
1297112971
SDValue BasePtr = LN0->getBasePtr();
1297212972
for (unsigned Idx = 0; Idx < NumSplits; Idx++) {
1297312973
const unsigned Offset = Idx * Stride;
12974-
const Align Align = commonAlignment(LN0->getAlign(), Offset);
1297512974

12976-
SDValue SplitLoad = DAG.getExtLoad(
12977-
ExtType, SDLoc(LN0), SplitDstVT, LN0->getChain(), BasePtr,
12978-
LN0->getPointerInfo().getWithOffset(Offset), SplitSrcVT, Align,
12979-
LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
12975+
SDValue SplitLoad =
12976+
DAG.getExtLoad(ExtType, SDLoc(LN0), SplitDstVT, LN0->getChain(),
12977+
BasePtr, LN0->getPointerInfo().getWithOffset(Offset),
12978+
SplitSrcVT, LN0->getOriginalAlign(),
12979+
LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
1298012980

1298112981
BasePtr = DAG.getMemBasePlusOffset(BasePtr, TypeSize::getFixed(Stride), DL);
1298212982

0 commit comments

Comments
 (0)