Browse Source

[IPO] Temporarily rollback r307215.

[GlobalOpt] Remove unreachable blocks before optimizing a function.
While the change is presumably correct, it exposes a latent bug
in DI which breaks on of the CFI checks. I'll analyze it further
and try to understand what's going on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307729 91177308-0d34-0410-b5e6-96231b3b80d8
Davide Italiano 8 years ago
parent
commit
dd0b140c37
2 changed files with 0 additions and 35 deletions
  1. 0 18
      lib/Transforms/IPO/GlobalOpt.cpp
  2. 0 17
      test/Transforms/GlobalOpt/pr33686.ll

+ 0 - 18
lib/Transforms/IPO/GlobalOpt.cpp

@@ -2026,24 +2026,6 @@ OptimizeFunctions(Module &M, TargetLibraryInfo *TLI,
       continue;
       continue;
     }
     }
 
 
-    // LLVM's definition of dominance allows instructions that are cyclic
-    // in unreachable blocks, e.g.:
-    // %pat = select i1 %condition, @global, i16* %pat
-    // because any instruction dominates an instruction in a block that's
-    // not reachable from entry.
-    // So, remove unreachable blocks from the function, because a) there's
-    // no point in analyzing them and b) GlobalOpt should otherwise grow
-    // some more complicated logic to break these cycles.
-    // Removing unreachable blocks might invalidate the dominator so we
-    // recalculate it.
-    if (!F->isDeclaration()) {
-      if (removeUnreachableBlocks(*F)) {
-        auto &DT = LookupDomTree(*F);
-        DT.recalculate(*F);
-        Changed = true;
-      }
-    }
-
     Changed |= processGlobal(*F, TLI, LookupDomTree);
     Changed |= processGlobal(*F, TLI, LookupDomTree);
 
 
     if (!F->hasLocalLinkage())
     if (!F->hasLocalLinkage())

+ 0 - 17
test/Transforms/GlobalOpt/pr33686.ll

@@ -1,17 +0,0 @@
-; RUN: opt -S -globalopt %s | FileCheck %s
-
-; CHECK-LABEL: define void @beth
-; CHECK-NEXT:   entry:
-; CHECK-NEXT:   ret void
-; CHEC-NEXT:  }
-
-@glob = external global i16, align 1
-
-define void @beth() {
-entry:
-  ret void
-
-notreachable:
-  %patatino = select i1 undef, i16* @glob, i16* %patatino
-  br label %notreachable
-}