[llvm] [EarlyIfConversion] Determine if branch is predictable using new APIs. (PR #95877)

Mikhail Gudim via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 13:05:07 PDT 2024


mgudim wrote:

@fhahn 

Right, I see. It's actually mentioned in the comment:

```
 E.g. this considers a load
  // 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.
```
What about if we change API of `isLoopInvariant` to return an enum `{STRICTLY_LOOP_INVARIANT, LOAD_MAY_ALIAS, STRICTLY_NOT_LOOP_INVARIANT}` value which could indicate either that the instruction is loop invariant (in strict sense), or if not specify a reason. 

Another option would be to pass `IgnoreAliasing` flag to `isLoopInvariant`. Which do you think is better? Or maybe something else?

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


More information about the llvm-commits mailing list