[llvm] [EarlyIfConversion] Determine if branch is predictable using new APIs. (PR #95877)
Mikhail Gudim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 12:58:58 PDT 2024
================
@@ -327,12 +328,27 @@ void AArch64InstrInfo::insertIndirectBranch(MachineBasicBlock &MBB,
.addImm(16);
}
-// Branch analysis.
+bool AArch64InstrInfo::isCondBranchPredictable(
+ const MachineInstr &CondBr, const MachineLoopInfo &MLI) const {
+ MachineLoop *Loop = MLI.getLoopFor(CondBr.getParent());
+ if (!Loop)
+ return false;
+ return Loop->isLoopInvariant(CondBr, /*ExcludeReg=*/0, /*RecursionDepth=*/2);
----------------
mgudim wrote:
This way we reproduce the same logic that worked for AArch64 in EarlyIfConversion.
https://github.com/llvm/llvm-project/pull/95877
More information about the llvm-commits
mailing list