[llvm] [EarlyIfConversion] Fix the logic to determine predictable branch. (PR #92405)

Mikhail Gudim via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 07:11:59 PDT 2024


================
@@ -879,23 +879,23 @@ 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;
+          return true;
----------------
mgudim wrote:

@fhahn Just curious: what is the scenario when `!MO.isUse` happens? Is it because `analyzeBranch` can return something weird ?

https://github.com/llvm/llvm-project/pull/92405


More information about the llvm-commits mailing list