[llvm] [GVN] Replace icmp samesign with icmp flipped signedness (PR #227855)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 05:37:32 PDT 2026


https://github.com/antoniofrighetto approved this pull request.

LGTM. Would be maybe nice as a follow-up to refactor a bit the code here so as to have something like:
```cpp
Value *Repl = Num < NextNum ? findLeader(I->getParent(), Num) : nullptr;
if (!Repl) {
  if (auto *Cmp = dyn_cast<CmpInst>(I); Cmp && replaceWithEquivalentCmp(Cmp))
    return true;
  // Failure, just remember this instance for future use.
  LeaderTable.insert(Num, I, I->getParent());
  return false;
}
```

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


More information about the llvm-commits mailing list