Skip to content

Commit fd49786

Browse files
committed
Address CR comment, pt.2
Remove the `mayAlias` check, and only check if there are any instructions between the loads we want to optimize that could be a load fold barrier instead.
1 parent 3a6998a commit fd49786

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7419,21 +7419,6 @@ static bool getMiscPatterns(MachineInstr &Root,
74197419
return false;
74207420
}
74217421

7422-
/// Check if a given MachineInstr `MIa` may alias with any of the instructions
7423-
/// in `MemInstrs`.
7424-
static bool mayAlias(const MachineInstr &MIa,
7425-
SmallVectorImpl<const MachineInstr *> &MemInstrs,
7426-
AliasAnalysis *AA) {
7427-
for (const MachineInstr *MIb : MemInstrs) {
7428-
if (MIa.mayAlias(AA, *MIb, /*UseTBAA*/ false)) {
7429-
MIb->dump();
7430-
return true;
7431-
}
7432-
}
7433-
7434-
return false;
7435-
}
7436-
74377422
/// Check if the given instruction forms a gather load pattern that can be
74387423
/// optimized for better Memory-Level Parallelism (MLP). This function
74397424
/// identifies chains of NEON lane load instructions that load data from
@@ -7477,7 +7462,7 @@ static bool getGatherLanePattern(MachineInstr &Root,
74777462
auto *CurrInstr = MRI.getUniqueVRegDef(Root.getOperand(1).getReg());
74787463
auto Range = llvm::seq<unsigned>(1, NumLanes - 1);
74797464
SmallSet<unsigned, 16> RemainingLanes(Range.begin(), Range.end());
7480-
SmallVector<const MachineInstr *, 16> LoadInstrs = {};
7465+
SmallVector<const MachineInstr *, 16> LoadInstrs;
74817466
while (!RemainingLanes.empty() && CurrInstr &&
74827467
CurrInstr->getOpcode() == LoadLaneOpCode &&
74837468
MRI.hasOneNonDBGUse(CurrInstr->getOperand(0).getReg()) &&
@@ -7527,8 +7512,7 @@ static bool getGatherLanePattern(MachineInstr &Root,
75277512

75287513
// Check for potential aliasing with any of the load instructions to
75297514
// optimize.
7530-
if ((CurrInstr.mayLoadOrStore() || CurrInstr.isCall()) &&
7531-
mayAlias(CurrInstr, LoadInstrs, nullptr))
7515+
if (CurrInstr.isLoadFoldBarrier())
75327516
return false;
75337517
}
75347518

0 commit comments

Comments
 (0)