> -----Original Message-----
> From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
> ow...@gcc.gnu.org] On Behalf Of Jakub Jelinek
> Sent: Friday, December 14, 2012 12:09 PM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH][Cilkplus] Fix pragma simd info being lost
> 
> On Fri, Dec 14, 2012 at 05:01:48PM +0000, Iyer, Balaji V wrote:
> > > Why do you think fatal_error is the right thing here?  Why doesn't
> > > normal error work?  Generally, if one function contains 10 #pragma
> > > simd loops that require vectorization and 5 out of them aren't
> > > vectorized, it is nicer for users to be told about all 5 of them, rather 
> > > than just
> the first one.
> > > fatal_error will exit immediately.
> >
> > The #pragma simd assert requires the compiler to halt compilation if
> > the loop is not vectorized.  This is why I used fatal_error.  The
> > default case is noassert.
> 
> The compilation is halted even with error, compiler will exit with non-zero 
> exit
> status, won't compile any further functions, etc.

Here is a patch where I have replaced all fatal_errors with error_at.

Thanks,

Balaji V. Iyer.

> 
>       Jakub
Index: gcc/ChangeLog.cilkplus
===================================================================
--- gcc/ChangeLog.cilkplus      (revision 194585)
+++ gcc/ChangeLog.cilkplus      (working copy)
@@ -1,3 +1,11 @@
+2012-12-18  Balaji V. Iyer  <balaji.v.i...@intel.com>
+
+       * tree-vect-loop.c (vect_determine_vectorization_factor): Replaced all
+       occurances of "fatal_error" with error_at with vect_location.
+       (vect_analyze_loop_form): Likewise.
+       (vect_analyze_loop_operations): Likewise.
+       (vect_analyze_loop): Likewise.
+
 2012-12-16  Balaji V. Iyer  <balaji.v.i...@intel.com>
 
        * tree.h (GTY): Added new field in struct called "decl_auto."
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c        (revision 194585)
+++ gcc/tree-vect-loop.c        (working copy)
@@ -233,10 +233,8 @@
                    }
                  if (flag_enable_cilk && pragma_simd_assert_requested_p
                      (loop->pragma_simd_index))
-                   {
-                     fatal_error ("Loop not vectorized. " 
-                                  "Exiting as requested by Pragma SIMD");
-                   }
+                   error_at (vect_location, "loop not vectorized. " 
+                             "Exiting as requested by Pragma SIMD");
                  return false;
                }
              /* here we set the linear info */
@@ -411,10 +409,8 @@
                }
              if (flag_enable_cilk && pragma_simd_assert_requested_p 
                  (loop->pragma_simd_index))
-               {
-                 fatal_error ("Loop not vectorized. " 
-                              "Exiting as requested by PRAGMA SIMD");
-               }
+               error_at (vect_location, "loop not vectorized. " 
+                         "Exiting as requested by PRAGMA SIMD");
              return false;
            }
 
@@ -428,10 +424,8 @@
                }
              if (flag_enable_cilk && pragma_simd_assert_requested_p 
                  (loop->pragma_simd_index))
-               {
-                 fatal_error ("Loop not vectorized. " 
-                              "Exiting as requested by PRAGMA SIMD");
-               }
+               error_at (vect_location, "loop not vectorized. " 
+                         "Exiting as requested by PRAGMA SIMD");
              return false;
            }
 
@@ -468,11 +462,9 @@
                                          scalar_type);
                    }
                  if (flag_enable_cilk && pragma_simd_assert_requested_p 
-                     (loop->pragma_simd_index))
-                   {
-                     fatal_error ("Loop not vectorized. " 
-                                  "Exiting as requested by PRAGMA SIMD");
-                   }
+                     (loop->pragma_simd_index)) 
+                   error_at (vect_location, "loop not vectorized. " 
+                             "Exiting as requested by PRAGMA SIMD");   
                  return false;
                }
                /* here we set the linear info */
@@ -517,10 +509,8 @@
                }
              if (flag_enable_cilk && pragma_simd_assert_requested_p 
                  (loop->pragma_simd_index))
-               {
-                 fatal_error ("Loop not vectorized. " 
-                              "Exiting as requested by PRAGMA SIMD");
-               }
+               error_at (vect_location, "loop not vectorized. " 
+                         "Exiting as requested by PRAGMA SIMD");
              return false;
            }
 
@@ -540,10 +530,8 @@
                }
              if (flag_enable_cilk && pragma_simd_assert_requested_p 
                  (loop->pragma_simd_index))
-               {
-                 fatal_error ("Loop not vectorized. " 
-                              "Exiting as requested by PRAGMA SIMD");
-               }
+               error_at (vect_location, "loop not vectorized. " 
+                         "Exiting as requested by PRAGMA SIMD");
              return false;
            }
 
@@ -606,10 +594,8 @@
 
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
          (loop->pragma_simd_index))
-       {
-         fatal_error ("Loop not vectorized. " 
-                      "Exiting as requested by Pragma SIMD");
-       }
+       error_at (vect_location, "loop not vectorized. " 
+                 "Exiting as requested by Pragma SIMD");       
       return false;
     }
   LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
@@ -1191,8 +1177,8 @@
                             "not vectorized: control flow in loop."); 
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
           return NULL;
         }
 
@@ -1203,8 +1189,8 @@
                             "not vectorized: empty loop.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD");
          return NULL;
        }
     }
@@ -1237,8 +1223,8 @@
                             "not vectorized: multiple nested loops.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD");
          return NULL;
        }
 
@@ -1251,8 +1237,8 @@
                             "not vectorized: Bad inner loop.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD");
          return NULL;
        }
 
@@ -1264,8 +1250,8 @@
                             "not vectorized: inner-loop count not invariant.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
          destroy_loop_vec_info (inner_loop_vinfo, true);
          return NULL;
        }
@@ -1277,8 +1263,8 @@
                             "not vectorized: control flow in loop.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
          destroy_loop_vec_info (inner_loop_vinfo, true);
          return NULL;
         }
@@ -1297,8 +1283,8 @@
                             "not vectorized: unsupported outerloop form.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
          destroy_loop_vec_info (inner_loop_vinfo, true);
          return NULL;
        }
@@ -1319,16 +1305,16 @@
                               "not vectorized: multiple exits."); 
              if (flag_enable_cilk && pragma_simd_assert_requested_p 
                  (loop->pragma_simd_index)) 
-               fatal_error ("Loop not vectorized. " 
-                            "Exiting as requested by Pragma SIMD"); 
+               error_at (vect_location, "loop not vectorized. " 
+                         "Exiting as requested by Pragma SIMD"); 
            }
           else if (EDGE_COUNT (loop->header->preds) != 2)
            dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, 
                             "not vectorized: too many incoming edges.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
         }
       if (inner_loop_vinfo)
        destroy_loop_vec_info (inner_loop_vinfo, true);
@@ -1347,8 +1333,8 @@
                         "not vectorized: unexpected loop form.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
        destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1371,8 +1357,8 @@
                             "not vectorized: abnormal loop exit edge.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
          if (inner_loop_vinfo)
            destroy_loop_vec_info (inner_loop_vinfo, true);
          return NULL;
@@ -1387,8 +1373,8 @@
                         "not vectorized: complicated exit condition.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
        destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1402,8 +1388,8 @@
                         "computed.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
        destroy_loop_vec_info (inner_loop_vinfo, true);
       return NULL;
@@ -1435,8 +1421,8 @@
                         "not vectorized: number of iterations = 0.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
       if (inner_loop_vinfo)
         destroy_loop_vec_info (inner_loop_vinfo, false);
       return NULL;
@@ -1600,8 +1586,8 @@
                                 "not vectorized: value used after loop.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
               return false;
             }
 
@@ -1614,8 +1600,8 @@
                                 "not vectorized: scalar dependence cycle.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
               return false;
             }
 
@@ -1636,8 +1622,8 @@
                   dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, phi, 0);
                  if (flag_enable_cilk && pragma_simd_assert_requested_p 
                      (loop->pragma_simd_index)) 
-                   fatal_error ("Loop not vectorized. " 
-                                "Exiting as requested by Pragma SIMD"); 
+                   error_at (vect_location, "loop not vectorized. " 
+                             "Exiting as requested by Pragma SIMD"); 
                 }
              return false;
             }
@@ -1667,8 +1653,8 @@
                         "vectorize.");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
          (loop->pragma_simd_index)) 
-       fatal_error ("Loop not vectorized. " 
-                    "Exiting as requested by Pragma SIMD"); 
+       error_at (vect_location, "loop not vectorized. " 
+                 "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1692,8 +1678,8 @@
                         "vectorization factor.");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
          (loop->pragma_simd_index)) 
-       fatal_error ("Loop not vectorized. " 
-                    "Exiting as requested by Pragma SIMD"); 
+       error_at (vect_location, "loop not vectorized. " 
+                 "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1718,8 +1704,8 @@
                         "profitable.");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
          (loop->pragma_simd_index)) 
-       fatal_error ("Loop not vectorized. " 
-                    "Exiting as requested by Pragma SIMD"); 
+       error_at (vect_location, "loop not vectorized. " 
+                 "Exiting as requested by Pragma SIMD");
       return false;
     }
 
@@ -1749,8 +1735,8 @@
                         "iterations (whichever is more conservative).");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
          (loop->pragma_simd_index)) 
-       fatal_error ("Loop not vectorized. " 
-                    "Exiting as requested by Pragma SIMD"); 
+       error_at (vect_location, "loop not vectorized. " 
+                 "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1770,8 +1756,8 @@
                          "conservative).");
       if (flag_enable_cilk && pragma_simd_assert_requested_p 
          (loop->pragma_simd_index)) 
-       fatal_error ("Loop not vectorized. " 
-                    "Exiting as requested by Pragma SIMD"); 
+       error_at (vect_location, "loop not vectorized. " 
+                 "Exiting as requested by Pragma SIMD"); 
       return false;
     }
 
@@ -1788,8 +1774,8 @@
                             "not vectorized: can't create epilog loop 1.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD");
           return false;
         }
       if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
@@ -1799,8 +1785,8 @@
                             "not vectorized: can't create epilog loop 2.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p 
              (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD");
           return false;
         }
     }
@@ -2003,10 +1989,9 @@
                             "bad loop form.");
          if (flag_enable_cilk && pragma_simd_assert_requested_p
              (loop->pragma_simd_index))
-           {
-             fatal_error ("Loop not vectorized. " 
-                          "Exiting as requested by Pragma SIMD");
-           }
+           error_at (vect_location, "loop not vectorized. "
+                     "Exiting as requested by Pragma SIMD");
+           
 
          return NULL;
        }
@@ -2026,8 +2011,8 @@
        { 
          if (flag_enable_cilk 
              && pragma_simd_assert_requested_p (loop->pragma_simd_index)) 
-           fatal_error ("Loop not vectorized. " 
-                        "Exiting as requested by Pragma SIMD"); 
+           error_at (vect_location, "loop not vectorized. " 
+                     "Exiting as requested by Pragma SIMD"); 
          return NULL;
        }
       /* Try the next biggest vector size.  */

Reply via email to