[llvm] [EarlyIfConversion] Determine if branch is predictable using new APIs. (PR #95877)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 05:16:57 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);
----------------
wangpc-pp wrote:
Why is `RecursionDepth=2` here?
https://github.com/llvm/llvm-project/pull/95877
More information about the llvm-commits
mailing list