[llvm] [ConstantHoisting] Add a TTI hook to prevent hoisting. (PR #69004)

David Green via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 15:58:27 PDT 2023


davemgreen wrote:

I've always considered the cost returned from getIntImmCostInst as the `cost(inst + imm)` - `cost(inst)`. So if we are producing a cheaper instruction, the cost of the imm can be cheap. That already happens in a few places, like saturating patterns under Arm and a few of the other patterns in other backends. Comparing a div vs multiple mul/adds is going to be a bit complex, but the immediate is also going to be completely different at any rate.

I'm not wanting to block this. If others disagree then feel free to go ahead, but this seems like the new interface might not really be needed.

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


More information about the llvm-commits mailing list