mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-12 22:30:12 +00:00
f844eaced2
Factor out the reachability such that multiple queries to find reachability of values are fast. This is based on finding the ANTIC points in the CFG which do not change during hoisting. The ANTIC points are basically the dominance-frontiers in the inverse graph. So we introduce a data structure (CHI nodes) to keep track of values flowing out of a basic block. We only do this for values with multiple occurrences in the function as they are the potential hoistable candidates. This patch allows us to hoist instructions to a basic block with >2 successors, as well as deal with infinite loops in a trivial way. Relevant test cases are added to show the functionality as well as regression fixes from PR32821. Regression from previous GVNHoist: We do not hoist fully redundant expressions because fully redundant expressions are already handled by NewGVN Differential Revision: https://reviews.llvm.org/D35918 Reviewers: dberlin, sebpop, gberry, git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313116 91177308-0d34-0410-b5e6-96231b3b80d8
32 lines
479 B
LLVM
32 lines
479 B
LLVM
; RUN: opt -gvn-hoist -S < %s | FileCheck %s
|
|
|
|
; CHECK: store
|
|
; CHECK-NOT: store
|
|
|
|
; Check that an instruction can be hoisted to a basic block
|
|
; with more than two successors.
|
|
|
|
@G = external global i32, align 4
|
|
|
|
define void @foo(i32 %c1) {
|
|
entry:
|
|
switch i32 %c1, label %exit1 [
|
|
i32 0, label %sw0
|
|
i32 1, label %sw1
|
|
]
|
|
|
|
sw0:
|
|
store i32 1, i32* @G
|
|
br label %exit
|
|
|
|
sw1:
|
|
store i32 1, i32* @G
|
|
br label %exit
|
|
|
|
exit1:
|
|
store i32 1, i32* @G
|
|
ret void
|
|
exit:
|
|
ret void
|
|
}
|