Skip to content

Conversation

@c8ef
Copy link
Contributor

@c8ef c8ef commented Oct 29, 2024

This patch adds support for constant folding for the tgamma and tgammaf libc functions.

@c8ef c8ef changed the title Draft [ConstantFold] Fold tgamma and tgammaf when the input parameter is a constant value. Oct 30, 2024
@c8ef c8ef marked this pull request as ready for review October 30, 2024 15:02
@llvmbot llvmbot added llvm:analysis Includes value tracking, cost tables and constant folding llvm:transforms labels Oct 30, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 30, 2024

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-llvm-analysis

Author: None (c8ef)

Changes

This patch adds support for constant folding for the tgamma and tgammaf libc functions.


Full diff: https://github.com/llvm/llvm-project/pull/114065.diff

2 Files Affected:

  • (modified) llvm/lib/Analysis/ConstantFolding.cpp (+17-3)
  • (added) llvm/test/Transforms/InstCombine/tgamma.ll (+237)
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index c5a2c2f52f8dc2..19327c5c5afb7b 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -57,6 +57,7 @@
 #include <cassert>
 #include <cerrno>
 #include <cfenv>
+#include <cfloat>
 #include <cmath>
 #include <cstdint>
 
@@ -1698,9 +1699,9 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, const Function *F) {
            Name == "sinh" || Name == "sinhf" ||
            Name == "sqrt" || Name == "sqrtf";
   case 't':
-    return Name == "tan" || Name == "tanf" ||
-           Name == "tanh" || Name == "tanhf" ||
-           Name == "trunc" || Name == "truncf";
+    return Name == "tan" || Name == "tanf" || Name == "tanh" ||
+           Name == "tanhf" || Name == "trunc" || Name == "truncf" ||
+           Name == "tgamma" || Name == "tgammaf";
   case '_':
     // Check for various function names that get used for the math functions
     // when the header files are preprocessed with the macro
@@ -2417,6 +2418,15 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
       if (TLI->has(Func))
         return ConstantFoldFP(erf, APF, Ty);
       break;
+    case LibFunc_tgamma:
+    case LibFunc_tgammaf:
+      // NOTE: These boundaries are somewhat conservative.
+      if (TLI->has(Func) && (Ty->isDoubleTy() && (APF > APFloat(1 / DBL_MAX) &&
+                                                  APF < APFloat(171.0)) ||
+                             Ty->isFloatTy() && (APF > APFloat(1 / FLT_MAX) &&
+                                                 APF < APFloat(35.0f))))
+        return ConstantFoldFP(tgamma, APF, Ty);
+      break;
     case LibFunc_nearbyint:
     case LibFunc_nearbyintf:
     case LibFunc_rint:
@@ -3629,6 +3639,10 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
       case LibFunc_sqrtf:
         return Op.isNaN() || Op.isZero() || !Op.isNegative();
 
+      case LibFunc_tgamma:
+      case LibFunc_tgammaf:
+        return true;
+
       // FIXME: Add more functions: sqrt_finite, atanh, expm1, log1p,
       // maybe others?
       default:
diff --git a/llvm/test/Transforms/InstCombine/tgamma.ll b/llvm/test/Transforms/InstCombine/tgamma.ll
new file mode 100644
index 00000000000000..e79687e41d8af5
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/tgamma.ll
@@ -0,0 +1,237 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+
+define float @tgammaf_const() {
+; CHECK-LABEL: define float @tgammaf_const() {
+; CHECK-NEXT:    ret float 0x479A216280000000
+;
+  %r = call float @tgammaf(float 34.0)
+  ret float %r
+}
+
+define double @tgamma_const() {
+; CHECK-LABEL: define double @tgamma_const() {
+; CHECK-NEXT:    ret double 0x605166C698CF183B
+;
+  %r = call double @tgamma(double 100.0)
+  ret double %r
+}
+
+define float @tgammaf_const_overflow() {
+; CHECK-LABEL: define float @tgammaf_const_overflow() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 3.600000e+01)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 36.0)
+  ret float %r
+}
+
+define double @tgamma_const_overflow() {
+; CHECK-LABEL: define double @tgamma_const_overflow() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 1.720000e+02)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 172.0)
+  ret double %r
+}
+
+define float @tgammaf_minus_one() {
+; CHECK-LABEL: define float @tgammaf_minus_one() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float -1.000000e+00)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float -1.000000e+00)
+  ret float %r
+}
+
+define double @tgamma_minus_one() {
+; CHECK-LABEL: define double @tgamma_minus_one() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double -1.000000e+00)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double -1.000000e+00)
+  ret double %r
+}
+
+define float @tgammaf_minus_one_memory_none() {
+; CHECK-LABEL: define float @tgammaf_minus_one_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float -1.000000e+00) #[[ATTR1:[0-9]+]]
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float -1.000000e+00) readnone
+  ret float %r
+}
+
+define double @tgamma_minus_one_memory_none() {
+; CHECK-LABEL: define double @tgamma_minus_one_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double -1.000000e+00) #[[ATTR1]]
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double -1.000000e+00) readnone
+  ret double %r
+}
+
+define float @tgammaf_zero() {
+; CHECK-LABEL: define float @tgammaf_zero() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 0.000000e+00)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 0.000000e+00)
+  ret float %r
+}
+
+define double @tgamma_zero() {
+; CHECK-LABEL: define double @tgamma_zero() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 0.000000e+00)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 0.000000e+00)
+  ret double %r
+}
+
+define float @tgammaf_neg_zero() {
+; CHECK-LABEL: define float @tgammaf_neg_zero() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float -0.000000e+00)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float -0.000000e+00)
+  ret float %r
+}
+
+define double @tgamma_neg_zero() {
+; CHECK-LABEL: define double @tgamma_neg_zero() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double -0.000000e+00)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double -0.000000e+00)
+  ret double %r
+}
+
+define float @tgammaf_inf() {
+; CHECK-LABEL: define float @tgammaf_inf() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 0x7FF0000000000000)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 0x7FF0000000000000)
+  ret float %r
+}
+
+define double @tgamma_inf() {
+; CHECK-LABEL: define double @tgamma_inf() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 0x7FF0000000000000)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 0x7FF0000000000000)
+  ret double %r
+}
+
+define float @tgammaf_inf_memory_none() {
+; CHECK-LABEL: define float @tgammaf_inf_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 0x7FF0000000000000) #[[ATTR1]]
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 0x7FF0000000000000) readnone
+  ret float %r
+}
+
+define double @tgamma_inf_memory_none() {
+; CHECK-LABEL: define double @tgamma_inf_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 0x7FF0000000000000) #[[ATTR1]]
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 0x7FF0000000000000) readnone
+  ret double %r
+}
+
+define float @tgammaf_neg_inf() {
+; CHECK-LABEL: define float @tgammaf_neg_inf() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 0xFFF0000000000000)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 0xFFF0000000000000)
+  ret float %r
+}
+
+define double @tgamma_neg_inf() {
+; CHECK-LABEL: define double @tgamma_neg_inf() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 0xFFF0000000000000)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 0xFFF0000000000000)
+  ret double %r
+}
+
+define float @tgammaf_neg_inf_memory_none() {
+; CHECK-LABEL: define float @tgammaf_neg_inf_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 0xFFF0000000000000) #[[ATTR1]]
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 0xFFF0000000000000) readnone
+  ret float %r
+}
+
+define double @tgamma_neg_inf_memory_none() {
+; CHECK-LABEL: define double @tgamma_neg_inf_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 0xFFF0000000000000) #[[ATTR1]]
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 0xFFF0000000000000) readnone
+  ret double %r
+}
+
+define float @tgammaf_nan() {
+; CHECK-LABEL: define float @tgammaf_nan() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 0x7FF8000000000000)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 0x7FF8000000000000)
+  ret float %r
+}
+
+define double @tgamma_nan() {
+; CHECK-LABEL: define double @tgamma_nan() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 0x7FF8000000000000)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 0x7FF8000000000000)
+  ret double %r
+}
+
+define float @tgammaf_nan_memory_none() {
+; CHECK-LABEL: define float @tgammaf_nan_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float 0x7FF8000000000000) #[[ATTR1]]
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float 0x7FF8000000000000) readnone
+  ret float %r
+}
+
+define double @tgamma_nan_memory_none() {
+; CHECK-LABEL: define double @tgamma_nan_memory_none() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double 0x7FF8000000000000) #[[ATTR1]]
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double 0x7FF8000000000000) readnone
+  ret double %r
+}
+
+define float @tgammaf_poison() {
+; CHECK-LABEL: define float @tgammaf_poison() {
+; CHECK-NEXT:    [[R:%.*]] = call float @tgammaf(float poison)
+; CHECK-NEXT:    ret float [[R]]
+;
+  %r = call float @tgammaf(float poison)
+  ret float %r
+}
+
+define double @tgamma_poison() {
+; CHECK-LABEL: define double @tgamma_poison() {
+; CHECK-NEXT:    [[R:%.*]] = call double @tgamma(double poison)
+; CHECK-NEXT:    ret double [[R]]
+;
+  %r = call double @tgamma(double poison)
+  ret double %r
+}
+
+declare float @tgammaf(float) willreturn
+declare double @tgamma(double) willreturn

@c8ef c8ef requested review from arsenm and davemgreen October 30, 2024 15:03

case LibFunc_tgamma:
case LibFunc_tgammaf:
return true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we explicitly limit the input range, it should be safe to return true here. Ideally, this function could be integrated into the constant folding process.

@arsenm arsenm added the floating-point Floating-point math label Oct 30, 2024
Comment on lines 2424 to 2427
if (TLI->has(Func) && (Ty->isDoubleTy() && (APF > APFloat(1 / DBL_MAX) &&
APF < APFloat(171.0)) ||
Ty->isFloatTy() && (APF > APFloat(1 / FLT_MAX) &&
APF < APFloat(35.0f))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests for at and above these limits?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define float @tgammaf_const_overflow() {
; CHECK-LABEL: define float @tgammaf_const_overflow() {
; CHECK-NEXT: [[R:%.*]] = call float @tgammaf(float 3.600000e+01)
; CHECK-NEXT: ret float [[R]]
;
%r = call float @tgammaf(float 36.0)
ret float %r
}
define double @tgamma_const_overflow() {
; CHECK-LABEL: define double @tgamma_const_overflow() {
; CHECK-NEXT: [[R:%.*]] = call double @tgamma(double 1.720000e+02)
; CHECK-NEXT: ret double [[R]]
;
%r = call double @tgamma(double 172.0)
ret double %r
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think the double case is covered? Also the 1 / MAX?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test case for in and out of range.

case LibFunc_tgammaf:
// NOTE: These boundaries are somewhat conservative.
if (TLI->has(Func) &&
(Ty->isDoubleTy() && APF > APFloat(DBL_MIN) && APF < APFloat(171.0) ||
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that 1 / DBL_MAX < DBL_MIN, and we don't want to constant fold subnormal floating point as a parameter. I believe using MIN will be sufficient.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't want to constant fold subnormal floating point as a parameter.

Yes we do

@c8ef c8ef requested a review from arsenm October 31, 2024 14:52
@c8ef c8ef merged commit 1f07f99 into llvm:main Nov 1, 2024
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 1, 2024

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/6990

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/InstCombine/tgamma.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /buildbot/worker/arc-folder/build/bin/opt < /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll -passes=instcombine -S | /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll
+ /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll
+ /buildbot/worker/arc-folder/build/bin/opt -passes=instcombine -S
/buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll:14:15: error: CHECK-NEXT: expected string not found in input
; CHECK-NEXT: ret double 0x605166C698CF183B
              ^
<stdin>:8:35: note: scanning from here
define double @tgamma_in_range() {
                                  ^
<stdin>:9:2: note: possible intended match here
 ret double 0x605166C698CF194B
 ^

Input file: <stdin>
Check file: /buildbot/worker/arc-folder/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: ; ModuleID = '<stdin>' 
           2: source_filename = "<stdin>" 
           3:  
           4: define float @tgammaf_in_range() { 
           5:  ret float 0x479A216280000000 
           6: } 
           7:  
           8: define double @tgamma_in_range() { 
next:14'0                                       X error: no match found
           9:  ret double 0x605166C698CF194B 
next:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:14'1      ?                              possible intended match
          10: } 
next:14'0     ~~
          11:  
next:14'0     ~
          12: define float @tgammaf_const_left_range() { 
next:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          13:  %r = call float @tgammaf(float 0x3810000000000000) 
          14:  ret float %r 
           .
           .
           .
>>>>>>

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 1, 2024

LLVM Buildbot has detected a new failure on builder clang-ve-ninja running on hpce-ve-main while building llvm at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/12/builds/8711

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/ve-linux.py ...' (failure)
...
[668/669] Running the LLVM regression tests
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
An error occurred retrieving the git revision: Command '['git', '-C', '/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm', 'rev-parse', 'HEAD']' returned non-zero exit status 129.
-- Testing: 56254 tests, 48 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.
FAIL: LLVM :: Transforms/InstCombine/tgamma.ll (43648 of 56254)
******************** TEST 'LLVM :: Transforms/InstCombine/tgamma.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/opt < /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll -passes=instcombine -S | /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/FileCheck /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll
+ /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/opt -passes=instcombine -S
+ /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/FileCheck /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll
/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll:14:15: error: CHECK-NEXT: expected string not found in input
; CHECK-NEXT: ret double 0x605166C698CF183B
              ^
<stdin>:8:35: note: scanning from here
define double @tgamma_in_range() {
                                  ^
<stdin>:9:2: note: possible intended match here
 ret double 0x605166C698CF194B
 ^

Input file: <stdin>
Check file: /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: ; ModuleID = '<stdin>' 
           2: source_filename = "<stdin>" 
           3:  
           4: define float @tgammaf_in_range() { 
           5:  ret float 0x479A216280000000 
           6: } 
           7:  
           8: define double @tgamma_in_range() { 
next:14'0                                       X error: no match found
           9:  ret double 0x605166C698CF194B 
next:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:14'1      ?                              possible intended match
          10: } 
Step 8 (check-llvm) failure: check-llvm (failure)
...
[668/669] Running the LLVM regression tests
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
An error occurred retrieving the git revision: Command '['git', '-C', '/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm', 'rev-parse', 'HEAD']' returned non-zero exit status 129.
-- Testing: 56254 tests, 48 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.
FAIL: LLVM :: Transforms/InstCombine/tgamma.ll (43648 of 56254)
******************** TEST 'LLVM :: Transforms/InstCombine/tgamma.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/opt < /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll -passes=instcombine -S | /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/FileCheck /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll
+ /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/opt -passes=instcombine -S
+ /scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/bin/FileCheck /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll
/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll:14:15: error: CHECK-NEXT: expected string not found in input
; CHECK-NEXT: ret double 0x605166C698CF183B
              ^
<stdin>:8:35: note: scanning from here
define double @tgamma_in_range() {
                                  ^
<stdin>:9:2: note: possible intended match here
 ret double 0x605166C698CF194B
 ^

Input file: <stdin>
Check file: /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/test/Transforms/InstCombine/tgamma.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: ; ModuleID = '<stdin>' 
           2: source_filename = "<stdin>" 
           3:  
           4: define float @tgammaf_in_range() { 
           5:  ret float 0x479A216280000000 
           6: } 
           7:  
           8: define double @tgamma_in_range() { 
next:14'0                                       X error: no match found
           9:  ret double 0x605166C698CF194B 
next:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:14'1      ?                              possible intended match
          10: } 

c8ef added a commit that referenced this pull request Nov 1, 2024
@c8ef c8ef deleted the tgamma branch November 1, 2024 01:29
smallp-o-p pushed a commit to smallp-o-p/llvm-project that referenced this pull request Nov 3, 2024
…s a constant value. (llvm#114065)

This patch adds support for constant folding for the `tgamma` and
`tgammaf` libc functions.
smallp-o-p pushed a commit to smallp-o-p/llvm-project that referenced this pull request Nov 3, 2024
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
…s a constant value. (llvm#114065)

This patch adds support for constant folding for the `tgamma` and
`tgammaf` libc functions.
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

floating-point Floating-point math llvm:analysis Includes value tracking, cost tables and constant folding llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants