[llvm] [ValueTracking] Look through intermediate PHIs for conditional recurrences (PR #215913)

Ömer Sinan Ağacan via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 06:18:45 PDT 2026


================

----------------
osa1 wrote:

Why is the outer PHI called "identity"? Is this a known term for this pattern?

I think it'll be easier to read if you use the variables you used in code for the matched parts of the IR. E.g.

```
// %iv      = phi [<Start>, %entry ], [%merge,   %backedge]
// %merge   = phi [%iv,     %block1], [%iv.next, %block2  ] ; in any order
// %iv.next = <BO> %iv, <Step>                              ; in any order
```

After that I think it barely needs any explanation, but keep the rest of the comment if you prefer.

(`Start` and `Step` is what you call `L` and `R`, they were renamed recently so you'll get those names if you update your branch.)

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


More information about the llvm-commits mailing list