[llvm] [EarlyIfConversion] Fix the logic to determine predictable branch. (PR #92405)
Mikhail Gudim via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 07:35:57 PDT 2024
https://github.com/mgudim created https://github.com/llvm/llvm-project/pull/92405
Branch is considered predictable when ALL of the operands used to evaluate condition are loop-invariant.
>From 2641ed09f4a48c141865ca4186a951ea03b73827 Mon Sep 17 00:00:00 2001
From: Mikhail Gudim <mgudim at gmail.com>
Date: Thu, 16 May 2024 10:31:38 -0400
Subject: [PATCH] [EarlyIfConversion] Fix the logic to determine predictable
branch.
Branch is considered predictable when ALL of the operands used to evaluate
condition are loop-invariant.
---
llvm/lib/CodeGen/EarlyIfConversion.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/EarlyIfConversion.cpp b/llvm/lib/CodeGen/EarlyIfConversion.cpp
index 2a7bee1618deb..2f8729fcbb945 100644
--- a/llvm/lib/CodeGen/EarlyIfConversion.cpp
+++ b/llvm/lib/CodeGen/EarlyIfConversion.cpp
@@ -879,7 +879,7 @@ bool EarlyIfConverter::shouldConvertIf() {
// from a loop-invariant address predictable; we were unable to prove that it
// doesn't alias any of the memory-writes in the loop, but it is likely to
// read to same value multiple times.
- if (CurrentLoop && any_of(IfConv.Cond, [&](MachineOperand &MO) {
+ if (CurrentLoop && all_of(IfConv.Cond, [&](MachineOperand &MO) {
if (!MO.isReg() || !MO.isUse())
return false;
Register Reg = MO.getReg();
More information about the llvm-commits
mailing list