[llvm-commits] [llvm] r40458 - in /llvm/trunk: lib/Analysis/PostDominators.cpp test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll
Devang Patel
dpatel at apple.com
Mon Jul 23 18:02:26 PDT 2007
Author: dpatel
Date: Mon Jul 23 20:02:25 2007
New Revision: 40458
URL: http://llvm.org/viewvc/llvm-project?rev=40458&view=rev
Log:
Unreachable block is not a root node in post dominator tree.
Added:
llvm/trunk/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll
Modified:
llvm/trunk/lib/Analysis/PostDominators.cpp
Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=40458&r1=40457&r2=40458&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Mon Jul 23 20:02:25 2007
@@ -112,8 +112,12 @@
// relationships. These blocks, which have no successors, end with return and
// unwind instructions.
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
- if (succ_begin(I) == succ_end(I))
- Roots.push_back(I);
+ if (succ_begin(I) == succ_end(I)) {
+ Instruction *Insn = I->getTerminator();
+ // Unreachable block is not a root node.
+ if (!isa<UnreachableInst>(Insn))
+ Roots.push_back(I);
+ }
Vertex.push_back(0);
Added: llvm/trunk/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll?rev=40458&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll (added)
+++ llvm/trunk/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll Mon Jul 23 20:02:25 2007
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -adce | llvm-dis | grep switch
+; PR 1564
+
+define fastcc void @out() {
+ start:
+ br label %loop
+ unreachable:
+ unreachable
+ loop:
+ switch i32 0, label %unreachable [
+ i32 0, label %loop
+ ]
+}
More information about the llvm-commits
mailing list