[llvm] InstCombine: Teach SimplifyDemandedFPClass to infer nnan and ninf on fmul (PR #175854)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 13 14:28:24 PST 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 129460 tests passed
* 2863 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.Transforms/InstCombine/simplify-demanded-fpclass.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\opt.exe -S -passes=instcombine < C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' -S -passes=instcombine
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll:1080:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[I2:%.*]] = fmul float [[I1]], [[Y]]
# |               ^
# | <stdin>:522:48: note: scanning from here
# |  %i1 = tail call float @llvm.log2.f32(float %i)
# |                                                ^
# | <stdin>:522:48: note: with "I1" equal to "%i1"
# |  %i1 = tail call float @llvm.log2.f32(float %i)
# |                                                ^
# | <stdin>:522:48: note: with "Y" equal to "%y"
# |  %i1 = tail call float @llvm.log2.f32(float %i)
# |                                                ^
# | <stdin>:523:2: note: possible intended match here
# |  %i2 = fmul nnan float %i1, %y
# |  ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll:1115:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[I5:%.*]] = fmul float [[ARG1]], [[I3]]
# |               ^
# | <stdin>:536:58: note: scanning from here
# |  %i3 = tail call float @llvm.log2.f32(float noundef %arg)
# |                                                          ^
# | <stdin>:536:58: note: with "ARG1" equal to "%arg1"
# |  %i3 = tail call float @llvm.log2.f32(float noundef %arg)
# |                                                          ^
# | <stdin>:536:58: note: with "I3" equal to "%i3"
# |  %i3 = tail call float @llvm.log2.f32(float noundef %arg)
# |                                                          ^
# | <stdin>:537:2: note: possible intended match here
# |  %i5 = fmul nnan float %arg1, %i3
# |  ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll:1144:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[I3:%.*]] = fmul float [[I2]], [[ARG1]]
# |               ^
# | <stdin>:547:56: note: scanning from here
# |  %i2 = tail call float @llvm.log2.f32(float noundef %i)
# |                                                        ^
# | <stdin>:547:56: note: with "I2" equal to "%i2"
# |  %i2 = tail call float @llvm.log2.f32(float noundef %i)
# |                                                        ^
# | <stdin>:547:56: note: with "ARG1" equal to "%arg1"
# |  %i2 = tail call float @llvm.log2.f32(float noundef %i)
# |                                                        ^
# | <stdin>:553:2: note: possible intended match here
# |  %i8 = fmul float %i5, 5.000000e-01
# |  ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll:1586:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[NAN_USER:%.*]] = fmul float [[X]], [[Y]]
# |               ^
# | <stdin>:754:40: note: scanning from here
# |  store float %select, ptr %ptr, align 4
# |                                        ^
# | <stdin>:754:40: note: with "X" equal to "%x"
# |  store float %select, ptr %ptr, align 4
# |                                        ^
# | <stdin>:754:40: note: with "Y" equal to "%y"
# |  store float %select, ptr %ptr, align 4
# |                                        ^
# | <stdin>:755:4: note: possible intended match here
# |  %nan.user = fmul nnan float %x, %y
# |    ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll:1600:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[NAN_USER:%.*]] = fmul float [[X]], [[Y]]
# |               ^
# | <stdin>:761:40: note: scanning from here
# |  store float %select, ptr %ptr, align 4
# |                                        ^
# | <stdin>:761:40: note: with "X" equal to "%x"
# |  store float %select, ptr %ptr, align 4
# |                                        ^
# | <stdin>:761:40: note: with "Y" equal to "%y"
# |  store float %select, ptr %ptr, align 4
# |                                        ^
# | <stdin>:762:4: note: possible intended match here
# |  %nan.user = fmul nnan float %x, %y
# |    ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\simplify-demanded-fpclass.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            517: } 
# |            518:  
# |            519: define nofpclass(nan inf nzero nsub nnorm) float @powr_issue64870(float nofpclass(nan inf) %x, float nofpclass(nan inf) %y) { 
# |            520: entry: 
# |            521:  %i = tail call float @llvm.fabs.f32(float %x) 
# |            522:  %i1 = tail call float @llvm.log2.f32(float %i) 
# | next:1080'0                                                    X error: no match found
# | next:1080'1                                                      with "I1" equal to "%i1"
# | next:1080'2                                                      with "Y" equal to "%y"
# |            523:  %i2 = fmul nnan float %i1, %y 
# | next:1080'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:1080'3      ?                              possible intended match
# |            524:  %i3 = tail call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float %i2) 
# | next:1080'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            525:  %i6 = fcmp oeq float %x, 0.000000e+00 
# | next:1080'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            526:  %i7 = select i1 %i6, float 0.000000e+00, float %i3 
# | next:1080'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            527:  %i8 = fcmp oeq float %y, 0.000000e+00 
# | next:1080'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            528:  %i11 = fcmp oeq float %x, 1.000000e+00 
# | next:1080'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# |            531:  ret float %i12 
# | next:1080'0     ~~~~~~~~~~~~~~~~
# |            532: } 
# | next:1080'0     ~~
# |            533:  
# | next:1080'0     ~
# |            534: define nofpclass(nan inf nzero nsub nnorm) float @test_powr_issue64870_2(float nofpclass(nan inf) %arg, float nofpclass(nan inf) %arg1) { 
# | next:1080'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            535: bb: 
# |            536:  %i3 = tail call float @llvm.log2.f32(float noundef %arg) 
# | next:1115'0                                                              X error: no match found
# | next:1115'1                                                                with "ARG1" equal to "%arg1"
# | next:1115'2                                                                with "I3" equal to "%i3"
# |            537:  %i5 = fmul nnan float %arg1, %i3 
# | next:1115'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:1115'3      ?                                 possible intended match
# |            538:  %i6 = tail call noundef nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float noundef %i5) 
# | next:1115'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            539:  %0 = fcmp oeq float %arg, 0.000000e+00 
# | next:1115'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            540:  %i12 = select i1 %0, float 0.000000e+00, float %i6 
# | next:1115'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            541:  ret float %i12 
# | next:1115'0     ~~~~~~~~~~~~~~~~
# |            542: } 
# | next:1115'0     ~~
# |            543:  
# | next:1115'0     ~
# |            544: define nofpclass(nan inf) float @pow_f32(float nofpclass(nan inf) %arg, float nofpclass(nan inf) %arg1) { 
# | next:1115'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            545: bb: 
# |            546:  %i = tail call nofpclass(ninf nzero nsub nnorm) float @llvm.fabs.f32(float noundef %arg) 
# |            547:  %i2 = tail call float @llvm.log2.f32(float noundef %i) 
# | next:1144'0                                                            X error: no match found
# | next:1144'1                                                              with "I2" equal to "%i2"
# | next:1144'2                                                              with "ARG1" equal to "%arg1"
# |            548:  %i3 = fmul nnan float %i2, %arg1 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            549:  %i4 = tail call noundef float @llvm.exp2.f32(float noundef %i3) 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            550:  %i5 = tail call nofpclass(ninf nzero nsub nnorm) float @llvm.fabs.f32(float noundef %arg1) 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            551:  %i6 = tail call float @llvm.trunc.f32(float noundef %i5) 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            552:  %i7 = fcmp oeq float %i6, %i5 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            553:  %i8 = fmul float %i5, 5.000000e-01 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:1144'3      ?                                   possible intended match
# |            554:  %i9 = tail call float @llvm.trunc.f32(float noundef %i8) 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            555:  %i10 = fcmp une float %i9, %i8 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            556:  %i11 = and i1 %i7, %i10 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
# |            557:  %i12 = select i1 %i11, float %arg, float 1.000000e+00 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            558:  %i13 = tail call noundef float @llvm.copysign.f32(float noundef %i4, float noundef %i12) 
# | next:1144'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# |            749:  ret float %fmul 
# |            750: } 
# |            751:  
# |            752: define nofpclass(nan) float @ret_nonan_fmul_select_nan_other_use(i1 %cond, float noundef %x, float %y, ptr %ptr) { 
# |            753:  %select = select i1 %cond, float %x, float 0x7FF8000000000000 
# |            754:  store float %select, ptr %ptr, align 4 
# | next:1586'0                                            X error: no match found
# | next:1586'1                                              with "X" equal to "%x"
# | next:1586'2                                              with "Y" equal to "%y"
# |            755:  %nan.user = fmul nnan float %x, %y 
# | next:1586'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:1586'3        ?                                 possible intended match
# |            756:  ret float %nan.user 
# | next:1586'0     ~~~~~~~~~~~~~~~~~~~~~
# |            757: } 
# | next:1586'0     ~~
# |            758:  
# | next:1586'0     ~
# |            759: define nofpclass(nan) float @ret_nonan_fmul_select_nan_other_use_commute(i1 %cond, float noundef %x, float %y, ptr %ptr) { 
# | next:1586'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            760:  %select = select i1 %cond, float 0x7FF8000000000000, float %x 
# |            761:  store float %select, ptr %ptr, align 4 
# | next:1600'0                                            X error: no match found
# | next:1600'1                                              with "X" equal to "%x"
# | next:1600'2                                              with "Y" equal to "%y"
# |            762:  %nan.user = fmul nnan float %x, %y 
# | next:1600'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:1600'3        ?                                 possible intended match
# |            763:  ret float %nan.user 
# | next:1600'0     ~~~~~~~~~~~~~~~~~~~~~
# |            764: } 
# | next:1600'0     ~~
# |            765:  
# | next:1600'0     ~
# |            766: ; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) 
# | next:1600'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            767: declare float @llvm.exp.f32(float) #0 
# | next:1600'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/175854


More information about the llvm-commits mailing list