[llvm] r307729 - [IPO] Temporarily rollback r307215.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 16:10:18 PDT 2017


Author: davide
Date: Tue Jul 11 16:10:17 2017
New Revision: 307729

URL: http://llvm.org/viewvc/llvm-project?rev=307729&view=rev
Log:
[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.

Removed:
    llvm/trunk/test/Transforms/GlobalOpt/pr33686.ll
Modified:
    llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp

Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=307729&r1=307728&r2=307729&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Jul 11 16:10:17 2017
@@ -2026,24 +2026,6 @@ OptimizeFunctions(Module &M, TargetLibra
       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);
 
     if (!F->hasLocalLinkage())

Removed: llvm/trunk/test/Transforms/GlobalOpt/pr33686.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GlobalOpt/pr33686.ll?rev=307728&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/GlobalOpt/pr33686.ll (original)
+++ llvm/trunk/test/Transforms/GlobalOpt/pr33686.ll (removed)
@@ -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:  }
-
- at glob = external global i16, align 1
-
-define void @beth() {
-entry:
-  ret void
-
-notreachable:
-  %patatino = select i1 undef, i16* @glob, i16* %patatino
-  br label %notreachable
-}




More information about the llvm-commits mailing list