[llvm] [SDPatternMatch] Support conditionally binding the value matching a sub-pattern (PR #182091)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 18 15:20:57 PST 2026


mshockwave wrote:

> # 🐧 Linux x64 Test Results
> * 169794 tests passed
> * 3065 tests skipped
> * 1 test failed
> 
> ## Failed Tests
> (click on a test name to see its output)
> 
> ### LLVM
> LLVM.CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll
> ```
> Exit Code: 1
> 
> Command Output (stdout):
> --
> # RUN: at line 2
> /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-simplifylib,instcombine -amdgpu-prelink /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll
> # executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-simplifylib,instcombine -amdgpu-prelink /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll
> # note: command had no output on stdout or stderr
> # executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll
> # .---command stderr------------
> # | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll:1588:15: error: CHECK-NEXT: expected string not found in input
> # | ; CHECK-NEXT: [[TMP2:%.*]] = call nnan ninf afn float @llvm.fabs.f32(float [[X]])
> # |               ^
> # | <stdin>:945:62: note: scanning from here
> # |  %1 = call nnan ninf afn float @llvm.amdgcn.rcp.f32(float %0)
> # |                                                              ^
> # | <stdin>:945:62: note: with "X" equal to "%x"
> # |  %1 = call nnan ninf afn float @llvm.amdgcn.rcp.f32(float %0)
> # |                                                              ^
> # | <stdin>:946:2: note: possible intended match here
> # |  %2 = call nnan ninf afn float @llvm.log2.f32(float %x)
> # |  ^
> # | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll:1694:15: error: CHECK-NEXT: expected string not found in input
> # | ; CHECK-NEXT: [[TMP2:%.*]] = call fast float @llvm.fabs.f32(float [[X]])
> # |               ^
> # | <stdin>:1018:53: note: scanning from here
> # |  %1 = call fast float @llvm.amdgcn.rcp.f32(float %0)
> # |                                                     ^
> # | <stdin>:1018:53: note: with "X" equal to "%x"
> # |  %1 = call fast float @llvm.amdgcn.rcp.f32(float %0)
> # |                                                     ^
> # | <stdin>:1019:2: note: possible intended match here
> # |  %2 = call fast float @llvm.log2.f32(float %x)
> # |  ^
> # | 
> # | Input file: <stdin>
> # | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll
> # | 
> # | -dump-input=help explains the following input dump.
> # | 
> # | Input was:
> # | <<<<<<
> # |              .
> # |              .
> # |              .
> # |            940: } 
> # |            941:  
> # |            942: define float @test_rootn_afn_ninf_nnan_f32__x_known_positive(float nofpclass(ninf nsub nnorm) %x, i32 %y) { 
> # |            943: entry: 
> # |            944:  %0 = sitofp i32 %y to float 
> # |            945:  %1 = call nnan ninf afn float @llvm.amdgcn.rcp.f32(float %0) 
> # | next:1588'0                                                                  X error: no match found
> # | next:1588'1                                                                    with "X" equal to "%x"
> # |            946:  %2 = call nnan ninf afn float @llvm.log2.f32(float %x) 
> # | next:1588'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # | next:1588'2      ?                                                       possible intended match
> # |            947:  %3 = fmul nnan ninf afn float %1, %2 
> # | next:1588'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # |            948:  %4 = call nnan ninf afn float @llvm.exp2.f32(float %3) 
> # | next:1588'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # |            949:  %5 = and i32 %y, 1 
> # | next:1588'0     ~~~~~~~~~~~~~~~~~~~~
> # |            950:  %.not = icmp eq i32 %5, 0 
> # | next:1588'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # |            951:  %6 = select nnan ninf afn i1 %.not, float 1.000000e+00, float %x 
> # | next:1588'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # |              .
> # |              .
> # |              .
> # |           1013:  
> # |           1014: define float @test_fast_rootn_f32_known_positive_y_known_even(float nofpclass(ninf nsub nnorm) %x, i32 %y.arg) { 
> # |           1015: entry: 
> # |           1016:  %y = shl i32 %y.arg, 1 
> # |           1017:  %0 = sitofp i32 %y to float 
> # |           1018:  %1 = call fast float @llvm.amdgcn.rcp.f32(float %0) 
> # | next:1694'0                                                         X error: no match found
> # | next:1694'1                                                           with "X" equal to "%x"
> # |           1019:  %2 = call fast float @llvm.log2.f32(float %x) 
> # | next:1694'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # | next:1694'2      ?                                              possible intended match
> # |           1020:  %3 = fmul fast float %1, %2 
> # | next:1694'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # |           1021:  %4 = call fast float @llvm.exp2.f32(float %3) 
> # | next:1694'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # |           1022:  %5 = fcmp fast oeq float %x, 0.000000e+00 
> # | next:1694'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # |           1023:  %6 = icmp slt i32 %y, 0 
> # | next:1694'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
> # |           1024:  %7 = xor i1 %5, %6 
> # | next:1694'0     ~~~~~~~~~~~~~~~~~~~~
> # |              .
> # |              .
> # |              .
> # | >>>>>>
> # `-----------------------------
> # error: command failed with exit status: 1
> 
> --
> ```
> 
> 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.

This is irrelevant and should be fixed by dee675d1d6030564f4b9ab05f323586867afe5a0

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


More information about the llvm-commits mailing list