[llvm] 83bf1d6 - [InstCombine] Thwart complexity-based canonicalization in sqrt test (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 07:47:50 PDT 2024
Author: Nikita Popov
Date: 2024-08-16T16:42:58+02:00
New Revision: 83bf1d661213cb8ec8e79ac085f793009721aaf5
URL: https://github.com/llvm/llvm-project/commit/83bf1d661213cb8ec8e79ac085f793009721aaf5
DIFF: https://github.com/llvm/llvm-project/commit/83bf1d661213cb8ec8e79ac085f793009721aaf5.diff
LOG: [InstCombine] Thwart complexity-based canonicalization in sqrt test (NFC)
Added:
Modified:
llvm/test/Transforms/InstCombine/fast-math.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll
index da403555ebe24..7f83328d360d6 100644
--- a/llvm/test/Transforms/InstCombine/fast-math.ll
+++ b/llvm/test/Transforms/InstCombine/fast-math.ll
@@ -709,13 +709,15 @@ define double @sqrt_intrinsic_three_args5(double %x, double %y) {
ret double %sqrt
}
-define double @sqrt_intrinsic_three_args6(double %x, double %y) {
+define double @sqrt_intrinsic_three_args6(double %x, ptr %yp) {
; CHECK-LABEL: @sqrt_intrinsic_three_args6(
-; CHECK-NEXT: [[FABS:%.*]] = call fast double @llvm.fabs.f64(double [[X:%.*]])
-; CHECK-NEXT: [[SQRT1:%.*]] = call fast double @llvm.sqrt.f64(double [[Y:%.*]])
-; CHECK-NEXT: [[SQRT:%.*]] = fmul fast double [[FABS]], [[SQRT1]]
+; CHECK-NEXT: [[Y:%.*]] = load double, ptr [[YP:%.*]], align 8
+; CHECK-NEXT: [[MUL:%.*]] = fmul fast double [[X:%.*]], [[X]]
+; CHECK-NEXT: [[MUL2:%.*]] = fmul fast double [[Y]], [[MUL]]
+; CHECK-NEXT: [[SQRT:%.*]] = call fast double @llvm.sqrt.f64(double [[MUL2]])
; CHECK-NEXT: ret double [[SQRT]]
;
+ %y = load double, ptr %yp ; thwart complexity-based canonicalization
%mul = fmul fast double %x, %x
%mul2 = fmul fast double %y, %mul
%sqrt = call fast double @llvm.sqrt.f64(double %mul2)
More information about the llvm-commits
mailing list