diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-01-21 20:19:54 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-01-21 20:19:54 +0000 |
| commit | fcc7c1a0baf8341b2d0926bd2e5244d684b48d8d (patch) | |
| tree | 15eb980c3cd59427508dbc7cc8a4c7e9782b1ec5 /llvm/test/Transforms | |
| parent | 88d79a06b73952affd09f38da90e57d549fdaa5e (diff) | |
| download | bcm5719-llvm-fcc7c1a0baf8341b2d0926bd2e5244d684b48d8d.tar.gz bcm5719-llvm-fcc7c1a0baf8341b2d0926bd2e5244d684b48d8d.zip | |
[LibCallSimplifier] don't get fooled by a fake fmin()
This is similar to the bug/fix:
https://llvm.org/bugs/show_bug.cgi?id=26211
http://reviews.llvm.org/rL258325
The fmin() test case reveals another bug caused by sloppy
code duplication. It will crash without this patch because
fp128 is a valid floating-point type, but we would think
that we had matched a function that used doubles.
The new helper function can be used to replace similar
checks that are used in several other places in this file.
llvm-svn: 258428
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/double-float-shrink-1.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll b/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll index d3dd0f6746b..5d015bc99ae 100644 --- a/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll +++ b/llvm/test/Transforms/InstCombine/double-float-shrink-1.ll @@ -364,6 +364,26 @@ define float @max1(float %a, float %b) { ; CHECK-NEXT: ret } +; A function can have a name that matches a common libcall, +; but with the wrong type(s). Let it be. + +define float @fake_fmin(float %a, float %b) { + %c = fpext float %a to fp128 + %d = fpext float %b to fp128 + %e = call fp128 @fmin(fp128 %c, fp128 %d) + %f = fptrunc fp128 %e to float + ret float %f + +; CHECK-LABEL: fake_fmin( +; CHECK-NEXT: %c = fpext float %a to fp128 +; CHECK-NEXT: %d = fpext float %b to fp128 +; CHECK-NEXT: %e = call fp128 @fmin(fp128 %c, fp128 %d) +; CHECK-NEXT: %f = fptrunc fp128 %e to float +; CHECK-NEXT: ret float %f +} + +declare fp128 @fmin(fp128, fp128) ; This is not the 'fmin' you're looking for. + declare double @fmax(double, double) declare double @tanh(double) |

