diff options
author | Davide Italiano <davide@freebsd.org> | 2017-07-11 23:10:17 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2017-07-11 23:10:17 +0000 |
commit | b8ad3eebcad9417cab81418d302dfda4b910f5eb (patch) | |
tree | 8ef2f7360c24f9c4e79062d340a77d3a347f2775 | |
parent | a69df6f843ce8f6ce22bbe1b36f642ab8c42ba4f (diff) | |
download | bcm5719-llvm-b8ad3eebcad9417cab81418d302dfda4b910f5eb.tar.gz bcm5719-llvm-b8ad3eebcad9417cab81418d302dfda4b910f5eb.zip |
[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.
llvm-svn: 307729
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 18 | ||||
-rw-r--r-- | llvm/test/Transforms/GlobalOpt/pr33686.ll | 17 |
2 files changed, 0 insertions, 35 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 93eab680ca6..3d57acf06e7 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -2026,24 +2026,6 @@ OptimizeFunctions(Module &M, TargetLibraryInfo *TLI, 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()) diff --git a/llvm/test/Transforms/GlobalOpt/pr33686.ll b/llvm/test/Transforms/GlobalOpt/pr33686.ll deleted file mode 100644 index 153a85f8e0c..00000000000 --- a/llvm/test/Transforms/GlobalOpt/pr33686.ll +++ /dev/null @@ -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 -} |