[llvm] [AMDGPU] Add getCmpSelInstrCost override to re-enable SimplifyCFG speculation for vector types (PR #208043)
Frederik Harwath via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 01:50:26 PDT 2026
================
@@ -0,0 +1,185 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL %s
+; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck -check-prefixes=ALL-SIZE %s
+
+define void @select_i32(i1 %cond, i32 %a, i32 %b) {
----------------
frederik-h wrote:
Do you mean that each test should combine a compare and a select or that there should be additional compare tests? There does not need to be a preexisting compare instruction, see how getInstructionCost calls it on selects and compares individually, see https://github.com/llvm/llvm-project/blob/b5d93cd7773b203e3523f36cf1b63c16f23c921b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h#L1585 or how SimplifyCFG uses it https://github.com/llvm/llvm-project/blob/ba1c26cf9f4826c9e82d43859c91fab9facf689f/llvm/lib/Transforms/Utils/SimplifyCFG.cpp#L3141. See also the doucmentation of the function in https://github.com/llvm/llvm-project/blob/b5d93cd7773b203e3523f36cf1b63c16f23c921b/llvm/include/llvm/Analysis/TargetTransformInfo.h#L1629.
But I think we should add tests for compare instructions as well.
https://github.com/llvm/llvm-project/pull/208043
More information about the llvm-commits
mailing list