diff options
author | Sanjay Patel <spatel@rotateright.com> | 2020-01-08 10:33:44 -0500 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2020-01-08 10:33:44 -0500 |
commit | 5dfd52398f5c1b67024106febdc68e6b12f8ad37 (patch) | |
tree | d15effd888a015a527f51f59839ca63698609e35 | |
parent | 780ba1f22b53116918cf12decccaed7ba2292bd5 (diff) | |
download | bcm5719-llvm-5dfd52398f5c1b67024106febdc68e6b12f8ad37.tar.gz bcm5719-llvm-5dfd52398f5c1b67024106febdc68e6b12f8ad37.zip |
[InstCombine] Adding testcase for Z / (1.0 / Y) => (Y * Z); NFC
The added testcase shows the current transformation for the operation
Z / (1.0 / Y), which remains unchanged. This will be updated to align
with the transformed code (Y * Z) with D72319.
The existing transformation Z / (X / Y) => (Y * Z) / X is not handling
this case as there are multiple uses for (1.0 / Y) in this testcase.
Patch by: @raghesh (Raghesh Aloor)
Differential Revision: https://reviews.llvm.org/D72388
-rw-r--r-- | llvm/test/Transforms/InstCombine/fdiv.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll index 777bdca87e6..8bfeb67f6e0 100644 --- a/llvm/test/Transforms/InstCombine/fdiv.ll +++ b/llvm/test/Transforms/InstCombine/fdiv.ll @@ -187,6 +187,21 @@ define float @div_with_div_denominator_extra_use(float %x, float %y, float %z) { ret float %div2 } +; Z / (1.0 / Y) + +define float @div_with_div_denominator_with_one_as_numerator_extra_use(float %x, float %y, float %z) { +; CHECK-LABEL: @div_with_div_denominator_with_one_as_numerator_extra_use( +; CHECK-NEXT: [[DIV1:%.*]] = fdiv float 1.000000e+00, [[Y:%.*]] +; CHECK-NEXT: [[DIV2:%.*]] = fdiv fast float [[Z:%.*]], [[DIV1]] +; CHECK-NEXT: call void @use_f32(float [[DIV1]]) +; CHECK-NEXT: ret float [[DIV2]] +; + %div1 = fdiv float 1.0, %y + %div2 = fdiv fast float %z, %div1 + call void @use_f32(float %div1) + ret float %div2 +} + define float @fneg_fneg(float %x, float %y) { ; CHECK-LABEL: @fneg_fneg( ; CHECK-NEXT: [[DIV:%.*]] = fdiv float [[X:%.*]], [[Y:%.*]] |