[llvm] [InstCombine] Improve coverage of `foldSelectValueEquivalence` for non-constants (PR #94719)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 10:04:47 PDT 2024


goldsteinn wrote:

> I don't think this is worth the complication. The only part of this I would consider is the `NewOp == V` case, though I'm having some trouble convincing myself that this really can't lead to a combine loop.

Is the second half so complicated? I guess I can yet again split it too a knew PR so we can test it.

Regarding `NewOp == V` been running `csmith` over night ~10^5 cases so far.
But I can add some gurantees to the code.

Think the following constraints make it pretty trivially impossible.
1) TrueVal/OldOp 1-Use.
2) NewOp not an instruction


Although the more I think about, the more I think it can't lead to inf loop.
I think for an inf loop, we would need a cycle in the IR, the SSA / dominating uses
pretty much prohibits that.

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


More information about the llvm-commits mailing list