[llvm] [SimpleLoopUnswitch] Allow trivial unswitch when exit LCSSA is a header PHI (PR #222962)

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 06:58:48 PDT 2026


amehsan wrote:

> IIUC, you can define a helper function like this

You need two helper functions. I missed one: 

```
static bool isLoopHeaderPHI(const Loop &L, const Value *V) {
  auto *PN = dyn_cast<PHINode>(V);
  return PN && PN->getParent() == L.getHeader();
}
```

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


More information about the llvm-commits mailing list