[llvm] [CostModel] Estimate the codesize cost of switch (PR #163569)

Hongyu Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 09:00:37 PST 2025


XChy wrote:

> I think you're right that for codesize it probably does not make sense to query (unless maybe there are differences across backends, like some measure code size in bytes while others in instructions?)

After some investigation, I found that the AMDGCN target provides a different conditional branch cost: https://github.com/llvm/llvm-project/blob/2dc0fa1000d651c902edad7d206785de7efc75f3/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp#L823-L840

Thus, a general implementation is more precise in such a case.

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


More information about the llvm-commits mailing list