Skip to content

Commit b4d1dc9

Browse files
author
apple-llvm-mt
committed
Merge llvm: [AArch64] Fix legality info passed to demanded bits for TBI opt.
apple-llvm-split-dir: llvm/
2 parents 14787ae + 395a64f commit b4d1dc9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9381,8 +9381,8 @@ static bool performTBISimplification(SDValue Addr,
93819381
SelectionDAG &DAG) {
93829382
APInt DemandedMask = APInt::getLowBitsSet(64, 56);
93839383
APInt KnownZero, KnownOne;
9384-
TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(),
9385-
DCI.isBeforeLegalizeOps());
9384+
TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
9385+
!DCI.isBeforeLegalizeOps());
93869386
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
93879387
if (TLI.SimplifyDemandedBits(Addr, DemandedMask, KnownZero, KnownOne, TLO)) {
93889388
DCI.CommitTargetLoweringOpt(TLO);

llvm/test/CodeGen/AArch64/tbi.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,14 @@ define i32 @ld_and32_narrower(i64 %p) {
100100
%load = load i32, i32* %cast
101101
ret i32 %load
102102
}
103+
104+
; BOTH-LABEL:ld_and8:
105+
; BOTH: and x
106+
define i32 @ld_and8(i64 %base, i8 %off) {
107+
%off_masked = and i8 %off, 63
108+
%off_64 = zext i8 %off_masked to i64
109+
%p = add i64 %base, %off_64
110+
%cast = inttoptr i64 %p to i32*
111+
%load = load i32, i32* %cast
112+
ret i32 %load
113+
}

0 commit comments

Comments
 (0)