[llvm-commits] [llvm] r48096 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/unwindto.ll

Nick Lewycky nicholas at mxc.ca
Sat Mar 8 23:36:38 PST 2008


Author: nicholas
Date: Sun Mar  9 01:36:38 2008
New Revision: 48096

URL: http://llvm.org/viewvc/llvm-project?rev=48096&view=rev
Log:
A BB that unwind_to an "unwind" inst is that same as one that doesn't unwind_to
at all.

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
    llvm/trunk/test/Transforms/SimplifyCFG/unwindto.ll

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=48096&r1=48095&r2=48096&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Sun Mar  9 01:36:38 2008
@@ -1370,7 +1370,7 @@
           new UnwindInst(Pred);            // Use unwind.
           Changed = true;
         }
-      } else if (InvokeInst *II = dyn_cast<InvokeInst>(Pred->getTerminator()))
+      } else if (InvokeInst *II = dyn_cast<InvokeInst>(Pred->getTerminator())) {
         if (II->getUnwindDest() == BB) {
           // Insert a new branch instruction before the invoke, because this
           // is now a fall through...
@@ -1388,6 +1388,9 @@
           delete II;
           Changed = true;
         }
+      } else if (Pred->getUnwindDest() == BB) {
+        Pred->setUnwindDest(NULL);
+      }
 
       Preds.pop_back();
     }

Modified: llvm/trunk/test/Transforms/SimplifyCFG/unwindto.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/unwindto.ll?rev=48096&r1=48095&r2=48096&view=diff

==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/unwindto.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/unwindto.ll Sun Mar  9 01:36:38 2008
@@ -33,3 +33,11 @@
 cleanup:
   ret i32 1
 }
+
+define i32 @f3() {
+entry: unwind_to %cleanup
+  call void @g(i32 0)
+  ret i32 0
+cleanup:
+  unwind
+}





More information about the llvm-commits mailing list