[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 12:51:42 PDT 2024
mgudim wrote:
@fhahn It looks like AArch64 sometimes only puts condition code into `Cond`, while the branch instruction is reading the `$nzcv`. For an example see `AArch64/ifcvt-select.ll` test. How is the code supposed to figure out if the branch is predictable only based on `Cond` (as returned by `analyzeBranch`)?
Would it be better to use `analyzeBranchPredicate` which should give us the pointer to the `MachineInstr` defining the condition? Then, we can check if all operands of the condition-defining instruction are loop-invariant?
Currently `analyzeBranchPredicate` for `AArch64` leaves `ConditionDef = nullptr`, so this part would need to be implemented.
@fhahn If these changes sound reasonable, I can work on it.
https://github.com/llvm/llvm-project/pull/92405
More information about the llvm-commits
mailing list