[llvm] [ReplaceConstant] Don't create instructions for the same constant multiple times in the same basic block (PR #169141)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 27 04:11:01 PST 2025


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

----------------
jayfoad wrote:

Just a thought: as a more targetted fix, we could just do something here like:
```
  if (isa<PHINode>(I)) {
    for (Use &U2 : I->operands()) {
      if (incoming block for U2 == incoming block for U)
        U2.set(NewInsts.back());
    }
  }
```

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


More information about the llvm-commits mailing list