[llvm-commits] [llvm-gcc-4.2] r41486 - /llvm-gcc-4.2/trunk/gcc/except.c

Duncan Sands baldrick at free.fr
Mon Aug 27 09:08:37 PDT 2007


Author: baldrick
Date: Mon Aug 27 11:08:37 2007
New Revision: 41486

URL: http://llvm.org/viewvc/llvm-project?rev=41486&view=rev
Log:
Fix a mismatch between can_throw_external_1 (CTE) and
foreach_reachable_handler (FRH): CTE should visit the
same handlers as FRE (indeed it could have been implemented
using FRE but seems to have been open-coded as an
optimization) but is missing one piece of FRH logic.
This causes problems in the case of cleanups contained
inside an empty filter (i.e. a filter that catches
everything): FRH didn't visit the filter while CTE did.
The testcase is gcc's crossjump1.C, which produced
eh.selectors with only the exception and personality
arguments.

Modified:
    llvm-gcc-4.2/trunk/gcc/except.c

Modified: llvm-gcc-4.2/trunk/gcc/except.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=41486&r1=41485&r2=41486&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/except.c (original)
+++ llvm-gcc-4.2/trunk/gcc/except.c Mon Aug 27 11:08:37 2007
@@ -2800,9 +2800,21 @@
 
   /* If the exception is caught or blocked by any containing region,
      then it is not seen by any calling function.  */
-  for (; region ; region = region->outer)
-    if (reachable_next_level (region, type_thrown, NULL) >= RNL_CAUGHT)
-      return false;
+  /* LLVM local begin */
+  while (region)
+    {
+      if (reachable_next_level (region, type_thrown, NULL) >= RNL_CAUGHT)
+        return false;
+      /* If we have processed one cleanup, there is no point in
+         processing any more of them.  Each cleanup will have an edge
+         to the next outer cleanup region, so the flow graph will be
+         accurate.  */
+      if (region->type == ERT_CLEANUP)
+        region = region->u.cleanup.prev_try;
+      else
+        region = region->outer;
+    }
+  /* LLVM local end */
 
   return true;
 }





More information about the llvm-commits mailing list