Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 7b70f01

Browse files
committed
Merging r309323:
------------------------------------------------------------------------ r309323 | ab | 2017-07-27 14:27:25 -0700 (Thu, 27 Jul 2017) | 12 lines [AArch64] Fix legality info passed to demanded bits for TBI opt. The (seldom-used) TBI-aware optimization had a typo lying dormant since it was first introduced, in r252573: when asking for demanded bits, it told TLI that it was running after legalize, where the opposite was true. This is an important piece of information, that the demanded bits analysis uses to make assumptions about the node. r301019 added such an assumption, which was broken by the TBI combine. Instead, pass the correct flags to TLO. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@309586 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e49f893 commit 7b70f01

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9586,8 +9586,8 @@ static bool performTBISimplification(SDValue Addr,
95869586
SelectionDAG &DAG) {
95879587
APInt DemandedMask = APInt::getLowBitsSet(64, 56);
95889588
KnownBits Known;
9589-
TargetLowering::TargetLoweringOpt TLO(DAG, DCI.isBeforeLegalize(),
9590-
DCI.isBeforeLegalizeOps());
9589+
TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
9590+
!DCI.isBeforeLegalizeOps());
95919591
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
95929592
if (TLI.SimplifyDemandedBits(Addr, DemandedMask, Known, TLO)) {
95939593
DCI.CommitTargetLoweringOpt(TLO);

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)