https://github.com/arsenm commented: essentially LGTM, except the hasOneUse duplication makes less sense than moving the whole pattern check before the predicate test switch with the isKnownNeverInf checks https://github.com/llvm/llvm-project/pull/85506