diff --git a/gcc/testsuite/gcc.dg/pr94269.c b/gcc/testsuite/gcc.dg/pr94269.c
new file mode 100644
index 0000000..49d5704
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr94269.c
@@ -0,0 +1,26 @@
+/* { dg-do compile { target aarch64*-*-* } } */
+/* { dg-options "-O2 -ftree-loop-vectorize -funsafe-math-optimizations -march=armv8.2-a+sve -msve-vector-bits=256" } */
+
+float
+foo(long n, float *x, int inc_x,
+            float *y, int inc_y)
+{
+  float dot = 0.0;
+  int ix = 0, iy = 0;
+
+  if (n < 0) {
+    return dot;
+  }
+
+  int i = 0;
+  while (i < n) {
+    dot += y[iy] * x[ix];
+    ix  += inc_x;
+    iy  += inc_y;
+    i++;
+  }
+
+  return dot;
+}
+
+/* { dg-final { scan-assembler-not "smaddl" { target aarch64*-*-* } } } */
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 54ba035..57d05e9 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -2715,13 +2715,16 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple *stmt,
      multiply-and-accumulate instructions.
 
      If the widened-multiplication result has more than one uses, it is
-     probably wiser not to do the conversion.  */
+     probably wiser not to do the conversion.  Also restrict this operation
+     to single basic block to avoid moving the multiply to a different block
+     with a higher execution frequency.  */
   if (code == PLUS_EXPR
       && (rhs1_code == MULT_EXPR || rhs1_code == WIDEN_MULT_EXPR))
     {
       if (!has_single_use (rhs1)
 	  || !is_widening_mult_p (rhs1_stmt, &type1, &mult_rhs1,
-				  &type2, &mult_rhs2))
+				  &type2, &mult_rhs2)
+	  || gimple_bb (rhs1_stmt) != gimple_bb (stmt))
 	return false;
       add_rhs = rhs2;
       conv_stmt = conv1_stmt;
@@ -2730,7 +2733,8 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple *stmt,
     {
       if (!has_single_use (rhs2)
 	  || !is_widening_mult_p (rhs2_stmt, &type1, &mult_rhs1,
-				  &type2, &mult_rhs2))
+				  &type2, &mult_rhs2)
+	  || gimple_bb (rhs2_stmt) != gimple_bb (stmt))
 	return false;
       add_rhs = rhs1;
       conv_stmt = conv2_stmt;
