[llvm] [CodeGenPrepare] Split x/select(cond,y,C) to select(cond,x/y,x/C) (PR #215967)

Le Gia Bao via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 06:52:57 PDT 2026


L3GiaBao wrote:

> Is the reason doing in CodeGenPrepare that to query isIntDivCheap? 

Yes

> Is it possible to share the code in [InstCombine](https://github.com/llvm/llvm-project/commit/05ad0b5bc504575fc5711c9090f6161597d9e790) if we can query from TTI instead?

Hmm I think your fold benefits from `X/1` being `X` whereas in this fold it costs to calculate `X/C`. so they're not really the same kind of patch. And I don't think theres a TTI equivalent of `isIntDivCheap`.

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


More information about the llvm-commits mailing list