Skip to content

Commit 86ce491

Browse files
authored
[DAGCombiner] Remove unneeded commonAlignment from reduceLoadWidth. (llvm#81707)
We already have the PtrOff factored into MachinePointerInfo. Any calls to getAlign on the new load with do commonAlignment with the MachinePointerInfo offset and the base alignment.
1 parent e625310 commit 86ce491

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14382,7 +14382,6 @@ SDValue DAGCombiner::reduceLoadWidth(SDNode *N) {
1438214382
DAG.getDataLayout().isBigEndian() ? AdjustBigEndianShift(ShAmt) : ShAmt;
1438314383

1438414384
uint64_t PtrOff = PtrAdjustmentInBits / 8;
14385-
Align NewAlign = commonAlignment(LN0->getAlign(), PtrOff);
1438614385
SDLoc DL(LN0);
1438714386
// The original load itself didn't wrap, so an offset within it doesn't.
1438814387
SDNodeFlags Flags;
@@ -14394,13 +14393,14 @@ SDValue DAGCombiner::reduceLoadWidth(SDNode *N) {
1439414393
SDValue Load;
1439514394
if (ExtType == ISD::NON_EXTLOAD)
1439614395
Load = DAG.getLoad(VT, DL, LN0->getChain(), NewPtr,
14397-
LN0->getPointerInfo().getWithOffset(PtrOff), NewAlign,
14396+
LN0->getPointerInfo().getWithOffset(PtrOff),
14397+
LN0->getOriginalAlign(),
1439814398
LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
1439914399
else
1440014400
Load = DAG.getExtLoad(ExtType, DL, VT, LN0->getChain(), NewPtr,
1440114401
LN0->getPointerInfo().getWithOffset(PtrOff), ExtVT,
14402-
NewAlign, LN0->getMemOperand()->getFlags(),
14403-
LN0->getAAInfo());
14402+
LN0->getOriginalAlign(),
14403+
LN0->getMemOperand()->getFlags(), LN0->getAAInfo());
1440414404

1440514405
// Replace the old load's chain with the new load's chain.
1440614406
WorklistRemover DeadNodes(*this);

llvm/test/CodeGen/X86/fold-sext-trunc.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ define void @int322(i32 %foo) !dbg !5 {
1818
entry:
1919
%val = load i64, ptr @g_10, !dbg !16
2020
%0 = load i32, ptr getelementptr inbounds (%struct.S1, ptr @g_10, i32 0, i32 1), align 4, !dbg !17
21-
; MIR: renamable {{\$r[a-z]+}} = MOVSX64rm32 {{.*}}, @g_10 + 4,{{.*}} debug-location !17 :: (dereferenceable load (s32) from @g_10 + 4)
21+
; MIR: renamable {{\$r[a-z]+}} = MOVSX64rm32 {{.*}}, @g_10 + 4,{{.*}} debug-location !17 :: (dereferenceable load (s32) from @g_10 + 4, basealign 8)
2222
%1 = sext i32 %0 to i64, !dbg !18
2323
%tmp4.i = lshr i64 %val, 32, !dbg !19
2424
%tmp5.i = trunc i64 %tmp4.i to i32, !dbg !20

llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_isel.ll.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ define i64 @i16_test(i16 %i) nounwind readnone {
5353
; CHECK-NEXT: t14: ch,glue = CopyToReg t0, Register:i32 $rv, t33
5454
; CHECK-NEXT: t1: i32 = ADD_I_LO TargetFrameIndex:i32<-1>, TargetConstant:i32<0>
5555
; CHECK-NEXT: t21: i32 = OR_I_LO t1, TargetConstant:i32<2>
56-
; CHECK-NEXT: t23: i32,ch = LDHz_RI<Mem:(load (s16) from %fixed-stack.0 + 2)> t21, TargetConstant:i32<0>, TargetConstant:i32<0>, t0
56+
; CHECK-NEXT: t23: i32,ch = LDHz_RI<Mem:(load (s16) from %fixed-stack.0 + 2, basealign 4)> t21, TargetConstant:i32<0>, TargetConstant:i32<0>, t0
5757
; CHECK-NEXT: t22: i32,ch = LDHz_RI<Mem:(dereferenceable load (s16) from %ir.loc)> TargetFrameIndex:i32<0>, TargetConstant:i32<0>, TargetConstant:i32<0>, t0
5858
; CHECK-NEXT: t24: i32 = ADD_R t23, t22, TargetConstant:i32<0>
5959
; CHECK-NEXT: t27: i32 = AND_I_HI t24, TargetConstant:i32<0>
@@ -76,7 +76,7 @@ define i64 @i8_test(i8 %i) nounwind readnone {
7676
; CHECK-NEXT: t14: ch,glue = CopyToReg t0, Register:i32 $rv, t33
7777
; CHECK-NEXT: t1: i32 = ADD_I_LO TargetFrameIndex:i32<-1>, TargetConstant:i32<0>
7878
; CHECK-NEXT: t21: i32 = OR_I_LO t1, TargetConstant:i32<3>
79-
; CHECK-NEXT: t23: i32,ch = LDBz_RI<Mem:(load (s8) from %fixed-stack.0 + 3)> t21, TargetConstant:i32<0>, TargetConstant:i32<0>, t0
79+
; CHECK-NEXT: t23: i32,ch = LDBz_RI<Mem:(load (s8) from %fixed-stack.0 + 3, basealign 4)> t21, TargetConstant:i32<0>, TargetConstant:i32<0>, t0
8080
; CHECK-NEXT: t22: i32,ch = LDBz_RI<Mem:(dereferenceable load (s8) from %ir.loc)> TargetFrameIndex:i32<0>, TargetConstant:i32<0>, TargetConstant:i32<0>, t0
8181
; CHECK-NEXT: t24: i32 = ADD_R t23, t22, TargetConstant:i32<0>
8282
; CHECK-NEXT: t26: i32 = SLI TargetConstant:i32<255>

0 commit comments

Comments
 (0)