[llvm] [InstCombine] Fold copysign of selects from sign comparison to sign operand (PR #196367)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 9 03:53:18 PDT 2026
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results
* 134482 tests passed
* 3259 tests skipped
* 1 test failed
## Failed Tests
(click on a test name to see its output)
### LLVM
<details>
<summary>LLVM.CodeGen/AMDGPU/simplify-libcalls.ll</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\opt.exe -S -O1 -mtriple=amdgcn-- -amdgpu-simplify-libcall < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\simplify-libcalls.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe -enable-var-scope -check-prefix=GCN -check-prefix=GCN-POSTLINK C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\simplify-libcalls.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' -S -O1 -mtriple=amdgcn-- -amdgpu-simplify-libcall
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' -enable-var-scope -check-prefix=GCN -check-prefix=GCN-POSTLINK 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\simplify-libcalls.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\simplify-libcalls.ll:384:8: error: GCN: expected string not found in input
# | ; GCN: %[[r0:.*]] = tail call fast float @llvm.copysign.f32(float %__exp2, float %tmp)
# | ^
# | <stdin>:338:100: note: scanning from here
# | %__exp2 = tail call fast nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp2.f32(float %__ylogx)
# | ^
# | <stdin>:342:9: note: possible intended match here
# | %__pow_sign1 = tail call fast float @llvm.copysign.f32(float %__exp2, float %1)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\simplify-libcalls.ll:441:8: error: GCN: expected string not found in input
# | ; GCN: %__pow_sign1 = tail call fast half @llvm.copysign.f16(half %__exp2, half %x)
# | ^
# | <stdin>:386:98: note: scanning from here
# | %__exp2 = tail call fast nofpclass(nan ninf nzero nsub nnorm) half @llvm.exp2.f16(half %__ylogx)
# | ^
# | <stdin>:390:2: note: possible intended match here
# | %__pow_sign1 = tail call fast half @llvm.copysign.f16(half %__exp2, half %2)
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\simplify-libcalls.ll:452:8: error: GCN: expected string not found in input
# | ; GCN: %__pow_sign1 = tail call fast <2 x half> @llvm.copysign.v2f16(<2 x half> %__exp2, <2 x half> %x)
# | ^
# | <stdin>:399:112: note: scanning from here
# | %__exp2 = tail call fast nofpclass(nan ninf nzero nsub nnorm) <2 x half> @llvm.exp2.v2f16(<2 x half> %__ylogx)
# | ^
# | <stdin>:403:2: note: possible intended match here
# | %__pow_sign1 = tail call fast <2 x half> @llvm.copysign.v2f16(<2 x half> %__exp2, <2 x half> %2)
# | ^
# |
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\AMDGPU\simplify-libcalls.ll
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | .
# | .
# | .
# | 333: entry:
# | 334: %tmp = load float, ptr addrspace(1) %a, align 4
# | 335: %__fabs = tail call fast float @llvm.fabs.f32(float %tmp)
# | 336: %__log2 = tail call fast float @llvm.log2.f32(float %__fabs)
# | 337: %__ylogx = fmul fast float %__log2, 1.013000e+03
# | 338: %__exp2 = tail call fast nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp2.f32(float %__ylogx)
# | check:384'0 X error: no match found
# | 339: %0 = bitcast float %tmp to i32
# | check:384'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 340: %__pow_sign = and i32 %0, -2147483648
# | check:384'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 341: %1 = bitcast i32 %__pow_sign to float
# | check:384'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 342: %__pow_sign1 = tail call fast float @llvm.copysign.f32(float %__exp2, float %1)
# | check:384'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:384'1 ? possible intended match
# | 343: store float %__pow_sign1, ptr addrspace(1) %a, align 4
# | check:384'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 344: ret void
# | check:384'0 ~~~~~~~~~~
# | 345: }
# | check:384'0 ~~
# | 346:
# | check:384'0 ~
# | 347: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
# | check:384'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | .
# | .
# | .
# | 381: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
# | 382: define half @test_pow_fast_f16__y_13(half %x) local_unnamed_addr #2 {
# | 383: %__fabs = tail call fast half @llvm.fabs.f16(half %x)
# | 384: %__log2 = tail call fast half @llvm.log2.f16(half %__fabs)
# | 385: %__ylogx = fmul fast half %__log2, 1.300000e+01
# | 386: %__exp2 = tail call fast nofpclass(nan ninf nzero nsub nnorm) half @llvm.exp2.f16(half %__ylogx)
# | check:441'0 X error: no match found
# | 387: %1 = bitcast half %x to i16
# | check:441'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 388: %__pow_sign = and i16 %1, -32768
# | check:441'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 389: %2 = bitcast i16 %__pow_sign to half
# | check:441'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 390: %__pow_sign1 = tail call fast half @llvm.copysign.f16(half %__exp2, half %2)
# | check:441'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:441'1 ? possible intended match
# | 391: ret half %__pow_sign1
# | check:441'0 ~~~~~~~~~~~~~~~~~~~~~~~
# | 392: }
# | check:441'0 ~~
# | 393:
# | check:441'0 ~
# | 394: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
# | check:441'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 395: define <2 x half> @test_pow_fast_v2f16__y_13(<2 x half> %x) local_unnamed_addr #2 {
# | check:441'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 396: %__fabs = tail call fast <2 x half> @llvm.fabs.v2f16(<2 x half> %x)
# | 397: %__log2 = tail call fast <2 x half> @llvm.log2.v2f16(<2 x half> %__fabs)
# | 398: %__ylogx = fmul fast <2 x half> %__log2, splat (half 1.300000e+01)
# | 399: %__exp2 = tail call fast nofpclass(nan ninf nzero nsub nnorm) <2 x half> @llvm.exp2.v2f16(<2 x half> %__ylogx)
# | check:452'0 X error: no match found
# | 400: %1 = bitcast <2 x half> %x to <2 x i16>
# | check:452'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 401: %__pow_sign = and <2 x i16> %1, splat (i16 -32768)
# | check:452'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 402: %2 = bitcast <2 x i16> %__pow_sign to <2 x half>
# | check:452'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 403: %__pow_sign1 = tail call fast <2 x half> @llvm.copysign.v2f16(<2 x half> %__exp2, <2 x half> %2)
# | check:452'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:452'1 ? possible intended match
# | 404: ret <2 x half> %__pow_sign1
# | check:452'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 405: }
# | check:452'0 ~~
# | 406:
# | check:452'0 ~
# | 407: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
# | check:452'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 408: define amdgpu_kernel void @test_rootn_1(ptr addrspace(1) captures(none) initializes((0, 4)) %a) local_unnamed_addr #1 {
# | check:452'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | .
# | .
# | .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.
https://github.com/llvm/llvm-project/pull/196367
More information about the llvm-commits
mailing list