[llvm] [clang] [ValueTracking] Add dominating condition support in computeKnownBits() (PR #73662)

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 14:24:47 PST 2023


bjope wrote:

> > Here is another thing that I noticed after this patch: https://godbolt.org/z/1P7bnKGjh
> > So early instcombine is eliminating an `and` operation (in the foo example), resulting in simplifycfg not being able to collapse the control flow any longer.
> 
> I don't think it's a profitable transformation in simplifycfg with larger amount of instructions. In x86, backend generates much larger code for the example with collapsed cfg: https://godbolt.org/z/YP9GjjP8c.

Optimization pipeline is doing simplifications and canonicalizations. If you for example use `-target amdcgn`, then I think you will see that the codegen is impacted negatively when not simplifying the control flow. So it depends on the backend if one form is profitable or not.
I don't know really which form that should be considered best (simplest and easiest for most backends to deal with) here. Just saying that it changed. And that could indeed be one reason for regressions (as for our backend).

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


More information about the cfe-commits mailing list